Package-level declarations
Types
JevApi as blocking calls, for scripts, main, and tests.
The answer to a Choice: the highest-probability option, the probability of every option, and a confidence from 0 to 1 derived from how concentrated probabilities is. Confidence is not the winner's probability.
A Choice's options, in order. Option keys and descriptions are both sent to the model.
401: the API key is missing or invalid.
400: the request was malformed.
A Jev client over Ktor (CIO). Configure it inline, or rely on TYPESAFE_API_KEY:
Resolved client settings. Build one with JevConfigBuilder or the JevClient { } constructor.
Builder for JevConfig. Each setting resolves as: explicit value, then environment variable, then default.
The client could not be configured, e.g. no API key was supplied.
No HTTP response was received (DNS, TLS, refused or dropped connection).
Environment variable names, defaults, and header names shared with the official TypeSafe SDKs.
Base class for every error raised by jev4k.
5xx: a server-side failure.
404: unknown endpoint or resource.
529: TypeSafe is temporarily overloaded.
403: the API key may not do this.
429: rate limited. retryAfter is the server's hint, when it sent one.
A successful response was missing data or didn't match the questions asked; fieldPath locates the problem.
The answers to one request. Read them with the handles you declared (result[Triage.department]) or by id (result.noul("urgent")). A missing or mismatched answer raises JevResponseValidationException when it is read; an id or handle that wasn't part of the request raises IllegalArgumentException.
A request attempt exceeded the configured timeout.
422: the request failed server-side validation; body names the offending field.
A request was rejected locally, before anything was sent. problems lists every issue found.
The answer to a Noul: noul is the probability, from 0 to 1, that the answer is yes. Nouls have no confidence.
Optional descriptions of what a Noul's yes and no mean.
Collects the questions for one request, keyed by ids you choose. Every function returns a QuestionRef handle, so val urgent = noul(...) then result[urgent] works too.
What one question asks, independent of its id: instructions plus criteria, each arbitrary JSON (usually a string). Named after the TypeSafe JS SDK's Question / NoulQuestion / ChoiceQuestion / ScoreQuestion. A QuestionRef pairs one with an id.
Creates a question when it is bound to a JevQuery property, using the property name as the default id.
An ordered, validated set of questions: everything one request asks about a single state.
When and how failed requests are retried. The defaults match the official Python and JS SDKs: two retries, 0.5 s backoff doubling to a 5 s cap with up to 25% subtracted as jitter, and server retry-after-ms / Retry-After hints honored up to maxRetryAfter.
The answer to a Score: score is the probability-weighted level (Σ level × p), so it can fall between levels. probabilities and legend are keyed by level number; the legend holds the level entries that were sent. levelCount is the number of levels asked about.
A Score's levels, lowest first. Describe situations, not degrees; each level is judged on its own.
Rate along ordered levels; a level's number is its index.
An answer of a type this version of jev4k doesn't know; raw is the answer object as received.
Properties
Functions
Builds a structured JSON entry for instructions, option descriptions, or levels, e.g. entry("question" to "Which team?", "focus" to "The primary request"). Keys keep their order, and the model sees both the keys and the values.
The JevApiException subclass the client raises for HTTP status, for testing a caller's error handling: 429 gives a JevRateLimitException, 401 a JevAuthenticationException, and so on.
The same, from the response body as JSON text.
A JevResult built from a raw response body, as JevApi.evaluate would have returned it for questions.
Encodes a @Serializable value as JSON, keeping fields that equal their defaults.
Converts plain Kotlin values (null, strings, numbers, booleans, enums, maps with string keys, iterables, arrays, and JSON elements) to JSON. Use jsonEntry for @Serializable values.
Asks inline questions about a @Serializable state.
Asks inline questions about a text state.
Asks inline questions about a JSON state.
Builds a validated QuestionSet inline.