# microsoft/typechat

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/microsoft-typechat).**

8,666 stars · 414 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/microsoft/TypeChat
- Homepage: https://microsoft.github.io/TypeChat/
- awesome-repositories: https://awesome-repositories.com/repository/microsoft-typechat.md

## Description

TypeChat is a schema enforcement library and framework for building natural language interfaces. It ensures that responses from large language models strictly adhere to predefined TypeScript type definitions, translating unstructured human language into predictable, structured data.

The project functions as both a prompt generator and an output validator. It automatically creates model instructions by extracting requirements from type schemas to replace manual prompt engineering and verifies that model outputs match the required format.

The system handles structured output generation and response validation through a process that detects formatting errors or missing properties. It uses an iterative correction loop to send validation errors back to the language model to prompt the generation of a corrected response.

## Tags

### Artificial Intelligence & ML

- [Structured Output Generators](https://awesome-repositories.com/f/artificial-intelligence-ml/natural-language-code-generators/structured-generation-engines/structured-output-generators.md) — Ensures language model responses strictly follow a predefined schema to produce machine-readable, typed data.
- [Automated Prompt Generation](https://awesome-repositories.com/f/artificial-intelligence-ml/ai-prompt-engineering-templates/automated-prompt-generation.md) — Automatically produces model prompts by extracting requirements from type definitions to eliminate manual engineering. ([source](https://github.com/microsoft/typechat#readme))
- [Automated Prompt Engineering](https://awesome-repositories.com/f/artificial-intelligence-ml/automated-prompt-engineering.md) — Programmatically generates and refines prompt instructions based on predefined types to automate prompt design.
- [Automatic Prompt Engineering](https://awesome-repositories.com/f/artificial-intelligence-ml/automatic-prompt-engineering.md) — Automatically generates model instructions from type schemas to replace manual prompt engineering.
- [Error-Correction Feedback Loops](https://awesome-repositories.com/f/artificial-intelligence-ml/model-feedback-loops/error-correction-feedback-loops.md) — Implements a recursive loop that provides structural error feedback to the model for iterative response correction.
- [Model Output Formatting](https://awesome-repositories.com/f/artificial-intelligence-ml/model-output-formatting.md) — Enforces structured data schemas on language model responses to ensure consistency and usability within interfaces. ([source](https://github.com/microsoft/typechat#readme))
- [Schema Enforcement Layers](https://awesome-repositories.com/f/artificial-intelligence-ml/model-response-parsers/schema-enforcement-layers.md) — Provides a layer that forces model outputs to adhere strictly to predefined TypeScript type definitions.
- [Natural Language Interfaces](https://awesome-repositories.com/f/artificial-intelligence-ml/natural-language-interfaces.md) — Enables the construction of interfaces that translate human natural language into predictable, typed data structures.

### Data & Databases

- [Schema-Enforced Output Parsers](https://awesome-repositories.com/f/data-databases/data-governance-modeling/data-modeling-schemas/data-schemas/schema-validated-data-structures/schema-enforced-output-parsers.md) — Provides utilities that constrain and parse model outputs into predefined TypeScript data structures.
- [Schema-Constrained Sampling](https://awesome-repositories.com/f/data-databases/json-schema-modeling/schema-validators/schema-constrained-sampling.md) — Restricts model output to a predefined JSON schema to ensure the data is parsable into typed objects.

### Software Engineering & Architecture

- [Model Response Validation Wrappers](https://awesome-repositories.com/f/software-engineering-architecture/data-validation/model-response-validation-wrappers.md) — Wraps model outputs in a validation layer to ensure compliance with specific schemas and trigger corrections. ([source](https://github.com/microsoft/typechat#readme))
- [Prompt Generation](https://awesome-repositories.com/f/software-engineering-architecture/type-structure-generation/prompt-generation.md) — Extracts requirements from TypeScript definitions to automatically generate structured instructions for the model.

### Part of an Awesome List

- [Application Frameworks](https://awesome-repositories.com/f/awesome-lists/ai/application-frameworks.md) — Library for building natural language interfaces using types.
