
“Once again Saltmarch has knocked it out of the park with interesting speakers, engaging content and challenging ideas. No jetlag fog at all, which counts for how interesting the whole thing was."
Cybersecurity Lead, PwC
In a recent announcement, Microsoft unveiled TypeChat, a library designed to simplify the creation of natural language interfaces. This innovation, spearheaded by a team including TypeScript inventor Anders Heljsberg, aims to add structure to conversational AI, a task that has traditionally been complex and intricate.
Building natural language interfaces has traditionally been a complex task. Applications often relied on intricate decision trees to determine intent and collect the necessary inputs to take action. Large language models (LLMs) have simplified this process by enabling the matching of natural language input from a user to intent. However, this introduced challenges such as 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.
TypeChat addresses these challenges by replacing prompt engineering with schema engineering. Developers simply define types that represent the intents supported in their natural language application. These could range from simple interfaces for categorizing sentiment to more complex types for applications like shopping carts or music applications. Developers can add additional intents to a schema by adding more types into a discriminated union. They can also make schemas hierarchical by using a "meta-schema" to choose one or more sub-schemas based on user input.
Once the types are defined, TypeChat takes over by constructing a prompt to the LLM using types, validating the LLM response conforms to the schema, and if the validation fails, repairing the non-conforming output through further language model interaction. It also summarizes the instance succinctly, confirming that it aligns with user intent.
By focusing on well-typed responses, this tool promises to enhance the user experience, present new opportunities for developers, and shape the future of natural language processing.
To better understand the potential of TypeChat, let's delve into some real-world examples provided by Microsoft:
1. Sentiment Analysis: This is the "hello world" of TypeChat. It's a sentiment classifier that categorizes user input as negative, neutral, or positive.
2. Coffee Shop: This example demonstrates an intelligent agent for a coffee shop. It translates user intent into a list of coffee order items.
3. Calendar: This is an intelligent scheduler that translates user intent into a sequence of actions to modify a calendar.
4. Restaurant: This example showcases an intelligent agent for taking orders at a restaurant. It's similar to the coffee shop example but uses a more complex schema to model more complex linguistic input.
5. Math: This example highlights TypeChat's program generation capabilities. It translates calculations into simple programs given an API that can perform the four basic mathematical operators.
6. Music: This example demonstrates an app for playing music, creating playlists, etc. on Spotify through natural language. Each user intent is translated into a series of actions in JSON which correspond to a simple dataflow program.
Developers can experiment with these examples on their local machine with Node.js or use GitHub Codespaces for a cloud-hosted development environment. After setting up the development environment and building the TypeChat examples, developers can run the examples interactively or with provided input files.
These examples provide a glimpse into the practical applications of TypeChat, demonstrating how it can simplify the process of building natural language interfaces and enhance the user experience.
The announcement of TypeChat has stirred a vibrant discussion among developers, with reactions ranging from enthusiastic endorsement to cautious skepticism. The conversation threads on platforms like GitHub and Hacker News offer a fascinating glimpse into the diverse perspectives within the developer community.
On one end of the spectrum, some developers question the value that TypeChat brings to the table, "I don't see the value add here. All these LLM libraries are just crappy APIs to the underlying API. It is trivial to write a script that does the same and will be much more flexible as models and user needs evolve". Others see the value in the unique approach that TypeChat takes. "The value is in running the typescript type checker against what is returned by the LLM. If there are type errors, combining those into a 'repair prompt' that will have a higher likelihood of eliciting an LLM output that type checks". Some developers express concerns about the practicality of these AI libraries. "The ergonomics of most of these AI libraries are built around using whatever models they provide integrations for: according to the file you linked retries won't even work unless you go and roll them in your implementation."
There are also those who question the preference for independent projects over established solutions. "I don't know where all you people work that your employer would prefer a random git repo (that has no support and no guarantee of updates) over a solution from Microsoft". Finally, some developers caution against overrating the influence of Microsoft's name on the project. "You're overrating the influence of the name Microsoft here. It's just some devs from the company working on this with no proper guarantee backing the project."
Despite these concerns, the appeal of TypeChat lies in its familiarity. TypeScript is already known to millions of developers, and the seniority of the team behind TypeChat, which includes not only Hejlsberg but also Daniel Rosenwasser, TypeScript senior program manager, and Technical Fellow Steve Lucco, lends the project credibility.
As the developer community continues to explore and debate the implications of tools like TypeChat, it's clear that the future of programming will be shaped by a multitude of perspectives and voices. Whether TypeChat will prove to be a developer's delight or a dilemma remains to be seen.
Have questions or comments about this article? Reach out to us here.
Banner Image Credits: Attendees at Great International Developer Summit
“Once again Saltmarch has knocked it out of the park with interesting speakers, engaging content and challenging ideas. No jetlag fog at all, which counts for how interesting the whole thing was."
Cybersecurity Lead, PwC
“Very much looking forward to next year. I will be keeping my eye out for the date so I can make sure I lock it in my calendar."
Software Engineering Specialist, Intuit
“Best conference I have ever been to with lots of insights and information on next generation technologies and those that are the need of the hour."
Software Architect, GroupOn
“Happy to meet everyone who came from near and far. Glad to know you've discovered some great lessons here, and glad you joined us for all the discoveries great and small."
Web Architect & Principal Engineer, Scott Davis
“Wonderful set of conferences, well organized, fantastic speakers, and an amazingly interactive set of audience. Thanks for having me at the events!"
Founder of Agile Developer Inc., Dr. Venkat Subramaniam
“What a buzz! The events have been instrumental in bringing the whole software community together. There has been something for everyone from developers to architects to business to vendors. Thanks everyone!"
Voltaire Yap, Global Events Manager, Oracle Corp.