TimDinh.TypeSafe 0.1.0

dotnet add package TimDinh.TypeSafe --version 0.1.0
                    
NuGet\Install-Package TimDinh.TypeSafe -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TimDinh.TypeSafe" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TimDinh.TypeSafe" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="TimDinh.TypeSafe" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TimDinh.TypeSafe --version 0.1.0
                    
#r "nuget: TimDinh.TypeSafe, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TimDinh.TypeSafe@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TimDinh.TypeSafe&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=TimDinh.TypeSafe&version=0.1.0
                    
Install as a Cake Tool

TimDinh.TypeSafe

A high-performance .NET 10 client library for the TypeSafe evaluation API (POST /v1/systemone). Evaluate a state against typed questions and get back structured answers.

Performance design

  • Source-generated System.Text.Json — reflection-free serialization; AOT/trim safe, lower allocations and startup cost.
  • Streaming bodies — request and response JSON are streamed (ResponseHeadersRead), never buffered into intermediate strings.
  • HttpClient injection — pass a pooled client (e.g. from IHttpClientFactory) to avoid socket exhaustion; the client is thread-safe, create once and reuse.
  • Automatic retries — 429 / 529 responses are retried with exponential backoff + jitter (honours Retry-After).

Quick start

using TimDinh.TypeSafe;

using var client = new TypeSafeClient(new TypeSafeClientOptions
{
    ApiKey = "<API_KEY>",
});

var response = await client.EvaluateAsync(new EvaluationRequest
{
    State = "Help! My payouts have been failing for 3 days.",
    Model = "jev-latest",
    Questions = new Dictionary<string, Question>
    {
        ["is_urgent"] = new NoulQuestion { Instructions = "Does this convey urgency?" },
    },
});

var isUrgent = (NoulAnswer)response.Answers["is_urgent"];
Console.WriteLine(isUrgent.Noul); // 0.95

State and Instructions are JsonNode — assign a string directly (implicit conversion), or any JsonObject/JsonArray for structured data.

With dependency injection

services.AddHttpClient<ITypeSafeClient, TypeSafeClient>(client =>
    client.BaseAddress = new Uri("https://api.typesafe.ai/"));
// resolve TypeSafeClientOptions from configuration in your own factory

Question types

Question Answer Key members
NoulQuestion NoulAnswer Noul (0–1)
ChoiceQuestion ChoiceAnswer Choice, Probabilities, Confidence
ScoreQuestion ScoreAnswer Score, Legend, Probabilities, Confidence

Errors

Non-success responses (after retries for 429/529) throw TypeSafeApiException with StatusCode and ResponseBody.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 118 9/21/2026