TypeChatSharp 0.2.0

.NET 6.0 .NET Standard 2.0 .NET Framework 4.7
dotnet add package TypeChatSharp --version 0.2.0
NuGet\Install-Package TypeChatSharp -Version 0.2.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="TypeChatSharp" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TypeChatSharp --version 0.2.0
#r "nuget: TypeChatSharp, 0.2.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.
// Install TypeChatSharp as a Cake Addin
#addin nuget:?package=TypeChatSharp&version=0.2.0

// Install TypeChatSharp as a Cake Tool
#tool nuget:?package=TypeChatSharp&version=0.2.0

publish to nuget Nuget Nuget Twitter URL


TypeChatSharp is a library that makes it easy to build natural language interfaces using types in C#. It is a direct port from TypeChat, but is not maintained by Microsoft.

Much of the text below and in other places in this repository is a direct copy or slightly modified version of text in the original TypeChat repository. The copyright for these texts belongs to Microsoft.

Building natural language interfaces has traditionally been difficult. These apps often relied on complex decision trees to determine intent and collect the required inputs to take action. Large language models (LLMs) have made this easier by enabling us to take natural language input from a user and match to intent. This has introduced its own challenges including the need to constrain the model's reply for safety, structure responses from the model for further processing, and ensuring that the reply from the model is valid. Prompt engineering aims to solve these problems, but comes with a steep learning curve and increased fragility as the prompt increases in size.

TypeChatSharp, like TypeChat, replaces prompt engineering with schema engineering.

Simply define types that represent the intents supported in your natural language application. That could be as simple as a type for categorizing sentiment or more complex examples like types for a shopping cart or music application. For example, to add additional intents to a schema, a developer can add additional types.

After defining your types, TypeChat takes care of the rest by:

  1. Constructing a prompt to the LLM using types.
  2. Validating the LLM response conforms to the schema. If the validation fails, repair the non-conforming output through further language model interaction.
  3. Summarizing succinctly (without use of a LLM) the instance and confirm that it aligns with user intent.

Types are all you need!

Getting Started

Install TypeChatSharp:

dotnet add package TypeChatSharp

You can also build TypeChatSharp from source:

cd TypeChatSharp
dotnet build

To see TypeChat in action, we recommend exploring the Example projects.

To learn more about TypeChat, visit the documentation which includes more information on TypeChat and how to get started. Much of it will also apply to TypeChatSharp.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

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.2.0 171 9/8/2023
0.1.0 159 9/7/2023