API Reference TypeSafe AI v#0.1.0-alpha.3

Copy Markdown View Source

Modules

Unofficial Elixir client for the TypeSafe AI API. Not affiliated with or endorsed by TypeSafe AI.

Decodes one wire answer against the question that produced it, and turns any answer into a routing decision.

A decoded Choice answer: which option the model picked, and how sure it was about every option it was offered.

A decoded Noul answer: the model's probability that the answer is yes.

A decoded Score answer: a point on the scale, plus enough structure to use it without hand-decoding probabilities yourself.

Starts the one process this library owns: a Task.Supervisor named TypeSafeAPI.TaskSupervisor, used by TypeSafeAPI.FanOut.

Connection settings for the TypeSafe API, resolved once and passed around.

The single error value returned by every {:error, _} tuple in this library.

Evaluate many states against one question set, concurrently.

Layer 1: the raw HTTP client. Maps in, maps out.

A successful raw response: the decoded JSON body plus the metadata the typed layer and support conversations need.

A value that has already been serialized to JSON iodata, and encodes as those bytes wherever it appears.

A JSON object that encodes its pairs in the order given.

Request-side registry of caller-supplied keys, so answers come back under the keys you sent.

A model available to the account, as listed by TypeSafeAPI.models/1.

The models endpoint: GET /v1/models.

The three question types and the functions that validate and encode them.

Pick one option from a set you define.

A yes/no judgment. The instructions may be a question ("Does this convey urgency?") or a statement to evaluate ("This message contains unsolicited advertising."); the answer is the probability that the answer is yes, or that the statement holds.

Rate the state along an ordered scale you describe in steps.

A fully decoded response: every answer keyed by the caller's own question ids, plus usage and the raw decoded body for anything this layer doesn't expose yet.

Retry policy mirroring the official TypeSafe SDKs, implemented as a Req step.

Layer 2 for the evaluation endpoint: typed questions in, typed answers out.

A question set that has been validated, encoded, and had its caller keys recorded, ready to send with any number of states.

Telemetry events emitted by this library, plus a small logger handler.

Stub the TypeSafe API in your tests without fixtures or a network.

Token counts for one call.