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
microsoft/TypeAgentTypeAgent is a Microsoft open‑source sample that shows how to build a single personal AI assistant using large language models, structured prompting, and a novel “Structured RAG” memory system. It includes an Electron shell, a dispatcher that routes natural‑language requests to typed agents, a memory layer that stores conversation facts as logical entities, and a cache to reduce LLM calls. The repo provides many example agents (calendar, email, browser, etc.) and an SDK for adding custom agents. It is early‑stage sample code, tested with Azure OpenAI in English, and not intended for production without further validation.
- Project
outcrawlai/scoutScout is an open‑source TypeScript library that lets you give a natural‑language web task to an AI‑driven browser agent. It works with any chat‑completion model you provide, runs on Outcrawl’s cloud (residential IP, captcha solving, replay recordings) or locally via Playwright, and returns structured results plus a step‑by‑step replay.
- Project
microsoft/typeagent-pytypeagent is an experimental Python package (requires Python 3.13+) aiming to bring structured RAG functionality from a TypeScript project to Python. It's still a prototype, sends input to a third-party LLM (so don't use it with confidential data), and installs via `pip install typeagent`.
- Project
TypeLLM/TypeLLMTypeLLM is a library that makes LLMs produce outputs that exactly match a schema you define (numbers, booleans, enums, objects, etc.), without changing the model. It works with open-source LLMs via SGLang, supports thinking, images, and dependencies, and offers both a cloud API and self-hosting.
- Project
lmstudio-ai/lmstudio-jsThe official TypeScript/JavaScript SDK for LM Studio, enabling developers to integrate local LLMs into applications with advanced model management and agentic capabilities.