Microsoft Introduces TypeChat
Written by Kay Ewbank   
Monday, 31 July 2023

Microsoft has introduced TypeChat, an experimental library that makes it easy to build natural language interfaces using types.

Microsoft says the library aims to answer questions such as:

"How do we augment traditional UI with natural language interfaces?"

and

"How do we use AI to take a user request and turn it into something our apps can operate on?"

TypeChat uses the type definitions in your codebase to retrieve structured AI responses that are type-safe.

microsoft

The library is intended to provide an alternative to the difficulties of building natural language interfaces that rely on complex decision trees to determine intent and collect the required inputs to take action. The TypeChat team says that while large language models (LLMs) have made this easier by enabling developers to take natural language input from a user and match that to intent, they introduced their own challenges including the need to constrain the model's reply for safety, structure responses from the model for further processing, and ensuring that the reply from the model is valid. The team says that prompt engineering aims to solve these problems, but comes with a steep learning curve and increased fragility as the prompt increases in size.

TypeChat replaces prompt engineering with schema engineering. To use it you define types that represent the intents supported in your natural language application. Developers can add additional intents to a schema into a discriminated union, or can make schemas hierarchical by using a "meta-schema" to choose one or more sub-schemas based on user input.

For example, a UI for a coffee shop might have a schema that included:

export type Product = BakeryProducts | LatteDrinks |
EspressoDrinks | CoffeeDrinks;
export interface BakeryProducts {
    type: 'BakeryProducts';
    name: 'apple bran muffin' | 'blueberry muffin' |
'lemon poppyseed muffin' | 'bagel';
    options: (BakeryOptions | BakeryPreparations)[];
}

After defining your types, TypeChat then constructs a prompt to the LLM using types. It also validates the LLM response to confirm it conforms to the schema, and if the validation fails, repairs the non-conforming output through further language model interaction. Finally, it summarizes the instance and confirms that it aligns with user intent.

The team says that in addition to using a data schema to turn some user intent into a structured response; TypeChat also makes it possible to use an "API schema" to construct basic programs. This is the sort of fusion of techniques that are going to be needed to tame the wilder aspects of large language models.

TypeChat is available now on GitHub.

microsoft

More Information

TypeChat On GitHub

Related Articles

Google's Large Language Model Takes Control

Open AI And Microsoft Exciting Times For AI 

Runaway Success Of ChatGPT

ChatGPT Coming Soon To Azure OpenAI Services

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Azure Container Apps Dynamic Sessions Generally Available
02/12/2024

Dynamic Session support has been added to Azure Container Apps. Azure Container Apps is a serverless platform for running containerized applications, and dynamic sessions is designed to provide fast a [ ... ]



OpenSilver Adds XAML Designer For Visual Studio Code
12/12/2024

OpenSilver 3.1 has been released. This version adds a drag-and-drop XAML designer for Visual Studio Code (VS Code), a new modern UI theme, and expanded support for WPF features. The open-source altern [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 31 July 2023 )