TypeSafe-AI.Sdk
0.0.1-preview-05
This is a prerelease version of TypeSafe-AI.Sdk.
dotnet add package TypeSafe-AI.Sdk --version 0.0.1-preview-05
NuGet\Install-Package TypeSafe-AI.Sdk -Version 0.0.1-preview-05
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="TypeSafe-AI.Sdk" Version="0.0.1-preview-05" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TypeSafe-AI.Sdk" Version="0.0.1-preview-05" />
<PackageReference Include="TypeSafe-AI.Sdk" />
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 TypeSafe-AI.Sdk --version 0.0.1-preview-05
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TypeSafe-AI.Sdk, 0.0.1-preview-05"
#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 TypeSafe-AI.Sdk@0.0.1-preview-05
#: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=TypeSafe-AI.Sdk&version=0.0.1-preview-05&prerelease
#tool nuget:?package=TypeSafe-AI.Sdk&version=0.0.1-preview-05&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
TypeSafe-AI.Sdk
Examples
Register
var apiKey = Environment.GetEnvironmentVariable("TYPESAFE_API_KEY") ?? string.Empty;
if (string.IsNullOrWhiteSpace(apiKey))
{
Console.WriteLine("Please set TYPESAFE_API_KEY before running the example.");
return;
}
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddTypeSafeSdk(options =>
{
options.ApiKey = apiKey;
});
using var host = builder.Build();
var client = host.Services.GetRequiredService<ITypeSafeClient>();
Create a Noulrequest
var requestNoul = new EvaluateRequest
{
State = "Help! My payouts have been failing for 3 days.",
Model = "jev-latest",
Questions = new Dictionary<string, Question>
{
["is_urgent"] = Question.Noul(
"Does this convey urgency?",
yesCriteria: "Explicitly time-sensitive",
noCriteria: "No urgency expressed"),
},
};
var responseNoul = await client.EvaluateAsync(requestNoul);
if (responseNoul.Answers.TryGetValue("is_urgent", out var answerNoul))
{
Console.WriteLine($"Type: {answerNoul.Type}");
Console.WriteLine($"Noul: {answerNoul.Noul:0.###}");
Console.WriteLine($"Confidence: {answerNoul.Confidence:0.###}");
}
Console.WriteLine($"Model: {responseNoul.Model}");
Console.WriteLine($"Usage: InputTokens={responseNoul.Usage.InputTokens}, OutputTokens={responseNoul.Usage.OutputTokens}");
Create a Choice request
var requestChoice = new EvaluateRequest
{
State = "My running shoes arrived in the wrong size. Can I swap them for a size 10?",
Model = "jev-latest",
Questions = new Dictionary<string, Question>
{
["instructions"] = Question.Choice(
"Which team should handle this?",
criteria: new Dictionary<string, object?>
{
["returns"] = "Exchanges, wrong or damaged items",
["shipping"] = "Delivery status, delays, lost packages",
["billing"] = "Charges, invoices, payment problems"
})
},
};
var responseChoice = await client.EvaluateAsync(requestChoice);
if (responseChoice.Answers.TryGetValue("instructions", out var answerChoice))
{
Console.WriteLine($"Type: {answerChoice.Type}");
Console.WriteLine($"Choice: {answerChoice.Choice}");
Console.WriteLine($"Confidence: {answerChoice.Confidence:0.###}");
}
Console.WriteLine($"Model: {responseChoice.Model}");
Console.WriteLine($"Usage: InputTokens={responseChoice.Usage.InputTokens}, OutputTokens={responseChoice.Usage.OutputTokens}");
Create a Score request
var requestScore = new EvaluateRequest
{
State = "The export button crashes the settings page in Safari. It works in Chrome, but a few of our customers only use Safari.",
Model = "jev-latest",
Questions = new Dictionary<string, Question>
{
["bug_severity"] = Question.Score(
"How severe is the reported issue?",
criteria:
[
"Cosmetic; no impact to functionality",
"Broken or degraded feature, but workaround exists",
"Blocking issue; no workaround exists"
])
},
};
var responseScore = await client.EvaluateAsync(requestScore);
if (responseScore.Answers.TryGetValue("bug_severity", out var answerScore))
{
Console.WriteLine($"Type: {answerScore.Type}");
Console.WriteLine($"Score: {answerScore.Score}");
Console.WriteLine($"Confidence: {answerScore.Confidence:0.###}");
}
Console.WriteLine($"Model: {responseScore.Model}");
Console.WriteLine($"Usage: InputTokens={responseScore.Usage.InputTokens}, OutputTokens={responseScore.Usage.OutputTokens}");
Sponsors
Entity Framework Extensions and Dapper Plus are major sponsors and proud to contribute to the development of TypeSafe-AI.Sdk.
| Product | Versions 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
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.12)
- ZeroAlloc.Rest (>= 1.3.4)
- ZeroAlloc.Rest.SystemTextJson (>= 1.3.4)
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.0.1-preview-05 | 48 | 9/20/2026 |
| 0.0.1-preview-04 | 46 | 9/20/2026 |

