TypeSafe SDK for .NET
Structured answers
from C#.
TypeSafe System One turns application state into Choice, Score, Noul, and Box answers. One NuGet package. The same questions as the JavaScript SDK.
Community port of @typesafe-ai/sdk by Dario Kondratiuk. Not an official TypeSafe product.
dotnet add package TypeSafe.AI.SdkOne package. It targets net10.0 and netstandard2.0.TypeSafe.AI.Sdk on NuGet.
using TypeSafe.AI.Sdk;
using var client = new TypeSafeClient();
var response = await client.SystemOneAsync(
new
{
document = "I was charged twice. Please fix this ASAP.",
},
(
"category",
Question.Choice(
"What is this ticket about?",
("billing", null),
("technical", null),
("other", null))));
Console.WriteLine(
response.GetChoice("category").Choice);Package
TypeSafe.AI.Sdk
NuGet package id
Targets
net10.0
and netstandard2.0
Default model
jev-latest
TYPESAFE_DEFAULT_MODEL
License
MIT
Free for commercial use
Why this SDK
The same System One questions, in the C# you already write.
Choice, Score, Noul, and Box
QuestionsQuestion.Choice,Question.Score,Question.Noul, andQuestion.Box. Read them back withGetChoice,GetScore,GetNoul, andGetBox.Batch them in one call
Independent questions go in one
Getting startedSystemOneAsynccall. The state is your own object, the same way the JavaScript SDK takes state.Images, when you opt in
Experimental. PNG or JPEG, behind the
ImagesTypeSafe-Danger-Zone-Imagesheader.Question.Boxlocates a region with thejev-previewmodel.Retries, compression, and DI
Two retries by default, zstd on bodies of 1 KiB or more, and
ConfigurationAddTypeSafeClientforIServiceCollection.
Get started
From an empty project to a typed answer, in three steps.
Install the package, call System One, then read the answer. Each step links to the page that has the rest.
Read the getting-started guideInstall the package
Add
TypeSafe.AI.Sdkto a project that targetsnet10.0ornetstandard2.0.
Getting starteddotnet add package TypeSafe.AI.SdkCall System One
TypeSafeClientreadsTYPESAFE_API_KEY. Pass state and one or more questions toSystemOneAsync.
Quickstartusing var client = new TypeSafeClient();Read the answer
GetChoicereturns the label, probabilities, and confidence. Score, Noul, and Box have their own readers.
QuestionsConsole.WriteLine(response.GetChoice("category").Choice);