Build a natural-language shopping cart where user input like 'add two apples' is automatically converted to a structured cart update object your app can process.
Add a plain-English command interface to any existing app by defining TypeScript interfaces for each supported action, no prompt engineering required.
Replace fragile LLM output parsing in your app with a validation loop that automatically asks the model to self-correct if its reply doesn't match your schema.
Requires an API key from an LLM provider such as OpenAI or Azure OpenAI.
TypeChat is a Microsoft open-source library for TypeScript and JavaScript (with Python and C# versions available) that helps developers build apps where users can type plain English and the app understands what they want. Think of it as a structured bridge between a conversational AI model and your application logic. Traditionally, building this kind of natural language interface meant writing complex decision trees to figure out what the user intended and what data to collect. Large language models made that easier, but introduced new problems: their replies can be unpredictable, unsafe, or in a format your app cannot process. TypeChat solves this by replacing prompt engineering with what the authors call schema engineering. The idea is straightforward. A developer writes TypeScript types that describe all the valid actions or intents the app supports. TypeChat takes those types, sends them along with the user's message to the language model, and tells the model to reply in a format that matches the types. It then checks whether the model's reply actually conforms to the schema. If it does not, TypeChat automatically sends a follow-up to the model asking it to correct the output. This validation loop means your app always receives structured, trustworthy data rather than free-form text. A simple example might be a sentiment classifier described as a TypeScript interface. A more complex one could be a shopping cart with items, quantities, and modifications. Developers add new capabilities by adding new types, which is a much more predictable process than tuning a long prose prompt. To get started, install the package from npm with a single command. The repository includes example projects you can run locally or in a browser-based GitHub Codespace, and the official documentation site covers the full API.
← microsoft on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.