# TypeSafe AI v0.1.0-alpha.1 - Table of Contents

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

## Pages

- [typesafe_api](readme.md)
- [Changelog](changelog.md)
- [Design notes](design.md)

- Guides
  - [TypeSafe cheatsheet](cheatsheet.md)
  - [Speculative fan-out](speculative_fan_out.md)
  - [Confidence-gated routing](confidence_gated_routing.md)
  - [Composite scoring](composite_scoring.md)

## Modules

- Getting started
  - [TypeSafe](TypeSafe.md): Unofficial Elixir client for the TypeSafe AI API.
Not affiliated with or endorsed by TypeSafe AI.
  - [TypeSafe.Client](TypeSafe.Client.md): Connection settings for the TypeSafe API, resolved once and passed around.

- Evaluating
  - [TypeSafe.FanOut](TypeSafe.FanOut.md): Evaluate many states against one question set, concurrently.
  - [TypeSafe.Models](TypeSafe.Models.md): The models endpoint: `GET /v1/models`.
  - [TypeSafe.SystemOne](TypeSafe.SystemOne.md): Layer 2 for the evaluation endpoint: typed questions in, typed answers out.
  - [TypeSafe.SystemOne.Prepared](TypeSafe.SystemOne.Prepared.md): A question set that has been validated, encoded, and had its caller keys
recorded, ready to send with any number of states.

- Questions
  - [TypeSafe.Question](TypeSafe.Question.md): The three question types and the functions that validate and encode them.
  - [TypeSafe.Question.Choice](TypeSafe.Question.Choice.md): Pick one option from a set you define.
  - [TypeSafe.Question.Noul](TypeSafe.Question.Noul.md): A yes/no question. The answer is the probability that the answer is yes.
  - [TypeSafe.Question.Score](TypeSafe.Question.Score.md): Rate the state along an ordered scale you describe in steps.

- Answers
  - [TypeSafe.Answer](TypeSafe.Answer.md): Decodes one wire answer against the question that produced it, and turns
any answer into a routing decision.
  - [TypeSafe.Answer.Choice](TypeSafe.Answer.Choice.md): A decoded Choice answer: which option the model picked, and how sure it was
about every option it was offered.
  - [TypeSafe.Answer.Noul](TypeSafe.Answer.Noul.md): A decoded Noul answer: the model's probability that the answer is yes.
  - [TypeSafe.Answer.Score](TypeSafe.Answer.Score.md): A decoded Score answer: a point on the scale, plus enough structure to use
it without hand-decoding probabilities yourself.

- Results and errors
  - [TypeSafe.Error](TypeSafe.Error.md): The single error value returned by every `{:error, _}` tuple in this library.
  - [TypeSafe.Model](TypeSafe.Model.md): A model available to the account, as listed by `TypeSafe.models/1`.
  - [TypeSafe.Result](TypeSafe.Result.md): 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.
  - [TypeSafe.Usage](TypeSafe.Usage.md): Token counts for one call, when the API reports them.

- Raw HTTP, retries, telemetry
  - [TypeSafe.HTTP](TypeSafe.HTTP.md): Layer 1: the raw HTTP client. Maps in, maps out.
  - [TypeSafe.HTTP.Response](TypeSafe.HTTP.Response.md): A successful raw response: the decoded JSON body plus the metadata the
typed layer and support conversations need.
  - [TypeSafe.Retry](TypeSafe.Retry.md): Retry policy mirroring the official TypeSafe SDKs, implemented as a Req step.
  - [TypeSafe.Telemetry](TypeSafe.Telemetry.md): Telemetry events emitted by this library, plus a small logger handler.

- Testing
  - [TypeSafe.Test](TypeSafe.Test.md): Stub the TypeSafe API in your tests without fixtures or a network.

- Internals
  - [TypeSafe.JSON.OrderedObject](TypeSafe.JSON.OrderedObject.md): A JSON object that encodes its pairs in the order given.
  - [TypeSafe.Keys](TypeSafe.Keys.md): Request-side registry of caller-supplied keys, so answers come back under
the keys you sent.

