Skip to content

About

Unofficial jev client for JuliaLang

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JevClient

Build Status Docs

Unofficial Julia client for TypeSafe AI.

Usage

using JevClient

questions = QuestionSet(
    "julia_related" => Noul(
        "Is this question about Julia?";
        criteria = NoulCriteria(
            yes = "It concerns the Julia programming language",
            no = "It does not concern the Julia programming language",
        ),
    ),
    "category" => Choice(
        "Which category does this Julia question belong to?";
        criteria = [
            "language"    => "Syntax, semantics, types, standard library",
            "packages"    => "Package management, registries, versions",
            "performance" => "Benchmarks, allocations, profiling",
        ],
    ),
    "difficulty" => Score(
        "How difficult is this Julia question?";
        criteria = ["Beginner", "Intermediate", "Advanced"],
    ),
)

result = with_client(
    model = PinnedModel("jev-1.13.0"),
    credential = EnvCredential("TYPESAFE_API_KEY"),
) do client
    state = "How do I make a Julia function type-stable when benchmarking allocations with @allocated?"
    response = system_one(client; state = state, questions = questions)

    julia_related = answer(response, "julia_related")::NoulAnswer
    category = answer(response, "category")::ChoiceAnswer
    difficulty = answer(response, "difficulty")::ScoreAnswer

    (
        julia_related = julia_related.noul,
        category = category.choice,
        category_probabilities = category.probabilities,
        category_confidence = category.confidence,
        difficulty = difficulty.score,
        difficulty_probabilities = difficulty.probabilities,
        difficulty_confidence = difficulty.confidence,
    )
end

with_client builds a Client, passes it to the block, and closes it in a finally clause whether the block succeeds or throws. If you need explicit ownership, build a Client and call close(client) yourself.

Images and Box questions (experimental)

TypeSafe offers still PNG/JPEG image input (Jev 1.13+) and bounding-box Box questions (Jev 1.14+) as experimental "danger zone" features. Opt in per call with danger_zone_images = true; images are uploaded as multipart file parts.

photo = Image("door.jpg")  # PNG or JPEG, 280-1568 px per side, at most 16 MiB

questions = QuestionSet(
    "present" => Noul("Is there a door in `photo`?"),
    "where" => Box("Locate the door in `photo`."),
)

with_client(model = PinnedModel("jev-1.14.0")) do client
    response = system_one(client; state = (photo = photo,), questions = questions,
                          danger_zone_images = true)
    box = answer(response, "where")::BoxAnswer
    (box.left, box.top, box.right, box.bottom, box.confidence)  # normalized to [0, 1]
end

A Box answer always contains a box, so check presence with a Noul question. Multimodal accuracy is lower than text-only accuracy upstream.

Security and Privacy

Jev results are untrusted data. Before taking an action, map Choice values through an application-owned allowlist, and do not use model output for shell, SQL, file paths, URLs, code, authorization decisions, or high-impact decisions. Request and response bodies, API keys, and question contents are not written to logs.

The regular API must not be assumed to provide zero data retention. Review TypeSafe's current privacy policy, DPA, and data residency terms before sending sensitive data, and minimize or pseudonymize state before transmission.

About

Unofficial jev client for JuliaLang

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages