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


Sequin - Open Source Message Stream Built On Postgres
31/10/2024

Sequin is a tool for capturing changes and streaming data out of your Postgres database, guaranteeing exactly once processing. What does that mean?



Gender Differences In Coding Style
13/11/2024

A novel investigation into the gender gap between men and women regarding coding ability was undertaken by Dr Siân Brooke. Her conclusion? There is a difference in the Python code [ ... ]


More News

espbook

 

Comments




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

Last Updated ( Monday, 31 July 2023 )