microsoft/TypeChat

TypeChat is a library that makes it easy to build natural language interfaces using types.

What it solves

Building natural language interfaces is traditionally difficult and relies on complex decision trees. While large language models (LLMs) make it easier to match user input to intent, they introduce challenges such as ensuring safety, structuring responses, and guaranteeing that the model's output is valid. TypeChat addresses this by replacing traditional prompt engineering with schema engineering.

How it works

Developers define types that represent the intents supported in their application, such as sentiment categorization or shopping cart actions. TypeChat then constructs a prompt to the LLM using these types, validates that the LLM's response conforms to the schema, repairs any non-conforming output through further language model interaction, and succinctly summarizes the instance to confirm alignment with user intent.

Who it’s for

TypeChat is for developers building natural language applications in TypeScript, JavaScript, Python, or C#/.NET who want a structured, type-safe way to handle LLM inputs and outputs.

Highlights

  • Replaces error-prone prompt engineering with schema engineering using types.
  • Automatically validates and repairs LLM responses to ensure they conform to defined schemas.
  • Supports hierarchical schemas using meta-schemas to choose sub-schemas based on user input.
  • Available for TypeScript/JavaScript, Python, and C#/.NET.

Related

  • Project
  • Project
  • Project
  • Project
  • Project