package verdict
Unofficial Eio-native OCaml client for TypeSafe AI's Jev
Install
dune-project
Dependency
Authors
Maintainers
Sources
0.1.4.tar.gz
md5=6caba5991ee6dd97c798a8c17be81ecd
sha512=e855f2a76872cd4e8ea090d8544c0ef11a8d9f1df7266c93bc893f0f4a2ec55f11dd161cbafb90e8164a644016d4df90a19b2b265fae3cbcb5cc1c58203d98f8
doc/verdict.html
Verdict: an OCaml client for the TypeSafe AI evaluation API
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)Modules
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 to0,1, for distributions and for answer confidences respectively.Verdict.Host— validated base URL host, either an IP address or a TLS hostname (internal).
Errors
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.
Safety
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.