Skip to content

Repository files navigation

Jevlin

Tip my tokens

A typed Zig SDK for TypeSafe AI's Jev. Ask yes/no, classification, and scoring questions in one request. Get probabilities and Zig enums back.

Zig 0.16.0 · Experimental · Independent of TypeSafe AI

const Team = enum { billing, technical, sales };
const questions = .{
    .urgent = jevlin.noul("Does this need urgent attention?"),
    .team = jevlin.choice(Team, "Which team should handle this?", .{}),
    .severity = jevlin.score("How severe?", [3][]const u8{
        "Minor", "Workaround available", "Cannot use the service",
    }),
};
const result = try client.evaluate(
    .{ .ticket = "I was charged twice." }, questions, "jev-latest",
    workspace, &diagnostics,
);
// result.answers.team.choice is a Team.

The complete example shows client setup, buffers, and cleanup. Offline examples cover structured questions, error handling, and bounded parallel use.

Use it

For a local checkout, add this to your build.zig.zon dependencies:

.jevlin = .{ .path = "../jevlin" },

In build.zig, add the dependency to your application module:

const jevlin = b.dependency("jevlin", .{ .target = target, .optimize = optimize });
exe.root_module.addImport("jevlin", jevlin.module("jevlin"));

You own the request, response, and scratch buffers. Results borrow that memory; copy borrowed data before reusing it. Give each concurrent worker its own client and workspace. HTTP/TLS uses the allocator you supply.

Run the checks

zig build check
zig build check -Doptimize=ReleaseSafe
zig build examples

Checks run locally without API credentials. Transport tests use loopback sockets. Native CI covers Linux, macOS, and Windows in both modes, including TLS rejection and allocation recovery. Separate manual workflows run coverage-guided fuzzing and soak tests.

With TYPESAFE_API_KEY set, zig build live sends a real request. It is billable, and retries can incur additional charges. The SDK does not read credential files.

Details

Still pre-release. Dynamic schemas, model discovery, and connection pooling are not implemented. Licensed under MIT.

About

Zig SDK for TypeSafe AI's Jev decision API. Typed classification, scoring and yes/no probabilities with bounded buffers, retries and deadlines.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages