Paul Krill
Editor at Large

Microsoft unveils TypeChat library for building natural language interfaces

news
Jul 21, 20232 mins

Open source library draws on TypeScript and type definitions to retrieve structured responses from AI models that are type-safe.

Microsoft with its TypeChat library is looking to enable easy development of natural language interfaces to large language models (LLMs) using types.

Available on GitHub, TypeChat is an open source library that uses TypeScript and generative AI to bridge natural language, application schema, and APIs. TypeChat uses type definitions in your application to retrieve structured AI responses that are type-safe.

Introduced July 20 by a team featuring C# and TypeScript lead developer Anders Hejlsberg, a Microsoft technical fellow, TypeChat addresses the difficulty of developing natural language interfaces, with apps relying on complex decision trees to determine intent and collect required inputs to take action.

TypeChat replaces prompt engineering with schema engineering, TypeChat’s creators said. Developers can define types that represent the intents supported in a natural language application. This could be as simple as an interface to categorize sentiment or more complex, such as types for a shopping cart or music application.

After the developer defines the types, TypeChat constructs a prompt to the LLM using those types and validates that the LLM response conforms to the schema. If validation fails, further language model interaction is used to repair the non-conforming output. TypeChat also summarizes the instance and confirms that it aligns with user intent.

Developers can install TypeChat through NPM:

npm install typechat

TypeChat also can be built from source:

npm run build

Elaborating on TypeChat, its creators said that the recent “rush of excitement” around LLMs has raised many questions for developers. While chat assistants have been the most direct application, there have been questions regarding how to integrate these models into existing app interfaces, such as how to augment traditional UIs with natural language interfaces and how to use AI to convert a user request into a form that apps can operate on. TypeChat is intended to answer these questions.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author