Repository navigation
Public API
Root namespace TypeSafeSharp. Nullable annotations are part of the contract. Configurable
types use { get; set; }; response types are get-only, so C# 7.3 callers on .NET Framework can
use every member.
| Type | What it does |
|---|---|
TypeSafeClient |
One thread-safe client per app. SystemOneAsync runs one request, EvaluateManyAsync a batch. |
ModelsClient |
ListAsync returns the models and aliases available to the key. |
ModelCard |
A model or alias: Name, Description, ReleaseDate. |
| Type | What it does |
|---|---|
SystemOneRequest |
The state and questions for one call, plus an optional Model. |
Question |
Abstract base. Build with Question.Noul, Question.Choice or Question.Score. Question.FromJson passes through kinds this package does not model yet. |
NoulQuestion, ChoiceQuestion, ScoreQuestion
|
The three question kinds. |
| Type | What it does |
|---|---|
SystemOneResponse |
Model, Answers, Usage, RequestId, and typed GetNoul, GetChoice, GetScore. |
Answer |
Abstract base with a Type. |
NoulAnswer, ChoiceAnswer, ScoreAnswer
|
The typed answers. |
UnknownAnswer |
An answer kind this package does not model, kept with its raw JSON. |
Usage |
Input and output token counts. |
TypeSafeModelFactory |
Builds responses, answers and exceptions for callers' unit tests. |
| Type | What it does |
|---|---|
TypeSafeClientOptions |
Key, base URL, default model, timeouts, retries and logging. |
TypeSafeRequestOptions |
Per-call overrides for timeouts and retries. |
RetryPolicy |
Default (two retries, retry timeouts) or None. |
BatchOptions |
MaxConcurrency and per-call options for EvaluateManyAsync. |
Each status has its own type under TypeSafeApiException, which carries StatusCode,
RequestId, Endpoint, Body and Headers. TypeSafeTimeoutException and
TypeSafeConnectionException cover the transport. TypeSafeResponseValidationException covers a
2xx body that is not the documented shape, and TypeSafeConfigurationException a bad key, base
URL or browser use. All derive from TypeSafeException.
| Type | What it does |
|---|---|
BatchItem<TItem> |
One item's Index, Item, Response or Exception, Elapsed and Succeeded. |
AddTypeSafe(IConfiguration) and AddTypeSafe(Action<TypeSafeClientOptions>) on
IServiceCollection register a singleton TypeSafeClient over a named HttpClient, bind
options AOT-safely and check the key at host start. They live in
TypeSafeSharp.Extensions.DependencyInjection.