package verdict

  1. Overview
  2. Docs
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

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.