Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
An Eio-native client for the TypeSafe AI evaluation API. Questions carry their answer type, so answers cannot be read as the wrong kind of answer:
let ( let* ) = Result.bind
let* spam = Verdict.Question.noul ~id:"spam" () in
let* request =
Verdict.Request.create ~state:(Verdict.Content.text "...") [Verdict.Question.pack spam]
in
let* responses = Verdict.Client.evaluate client ~sw request in
Option.map
(fun (answer : Verdict.Answer.Noul.t) ->
Verdict.Probability.to_float answer.probability)
(Verdict.Response.find responses spam)Verdict.Client — entry point; performs requests and applies the retry policy.Verdict.Config — validated configuration (API key, base URL, model, limits).Verdict.Request / Verdict.Response — typed wire records for POST /v1/systemone.Verdict.Question / Verdict.Answer — typed question handles and their answers.Verdict.Content — state, instructions and criteria: string, object or array.Verdict.Model / Verdict.Usage — results of GET /v1/models and token counts.Verdict.Error — closed error taxonomy with server request ids.Verdict.Retry — backoff and Retry-After handling.Verdict.Transport — bounded HTTP/TLS transport (internal, exposed for testing).Verdict.Decode — JSON decoding with dotted error paths (internal).Verdict.Version — SDK version string, generated from dune-project (internal).Verdict.Probability / Verdict.Confidence — values bounded to 0,1, for distributions and for answer confidences respectively.Verdict.Host — validated base URL host, either an IP address or a TLS hostname (internal).Every failure is an Verdict.Error value. Timeout, Connection and retryable Api statuses are retried according to Verdict.Retry; Configuration, Tls, Decode, Response_too_large and other Api errors are returned immediately. Error.Api and Error.Decode carry the x-typesafe-request-id header when the server provides one.
Response bodies are capped by Verdict.Config.max_response_bytes, each attempt runs under Verdict.Config.timeout on its own connection, and the API key is never included in error messages or logs.