Rosenwasser contrasts conversational answers with the precise data traditional apps need. He warns that parsing model responses by line breaks or punctuation is fragile, even when prompts encourage a consistent format. JSON helps, but still needs validation and can become difficult to specify for complex cases.
Pragmatic AI with TypeChat
Speaker
Daniel Rosenwasser, the TypeScript program manager at Microsoft, presents TypeChat at the AI Engineer conference and explains how types can help connect language models to traditional applications.
TypeChat uses TypeScript interfaces to describe the output an application expects. A language model uses those types to translate user intent, and TypeScript compiler errors can help identify and repair invalid results. Rosenwasser describes the approach as schema engineering: defining types that guide the model and anticipate unclear input.
In a coffee shop example, a user can order a latte with foam, or combine an order with an unexpected request for a purple gorilla named Bonsai. The schema can capture unrecognized text so the app can report what it did not understand while keeping the recognized order. Rosenwasser says the example uses under 40 lines of code.
For tasks that need multiple commands and shared results, TypeChat experiments with a constrained, JSON-based representation of a program. References connect steps, while a generated TypeScript program checks that only available methods are called and that inputs match the API types. A calculator example adds 1 to 41 and then divides by 7 by calling methods at each step.
Rosenwasser says the team is experimenting with Python, using types and method descriptions to guide translations. Examples include a calculator and a CSV API for filtering, joining, and dropping rows containing NaN values. He invites attendees to try TypeChat and share what they are building.
Takeaways
- Describe expected model outputs with the types your application already uses.
- Validate generated data before passing it into application code, and use errors to guide repair.
- Design schemas to represent unrecognized input so the app can recover gracefully.
- For multi-step tasks, constrain generated actions to defined methods and check argument types.
- Treat TypeChat's Python work as a prototype, as Rosenwasser described it.
Mentioned in this talk
Search inside this talk
What was claimed 6
- works atDaniel Rosenwasser works at
MicrosoftPrincipal Product Manager“I'm the program manager on TypeScript”
YouTube Unverified2 sources· Talk, Web· archived
- feature
TypeChat: Uses types to guide language models and validate their output
“types can also validate the results”
YouTube Unverified1 source· Talk
- feature
TypeChat: Uses TypeScript compiler errors to help repair invalid model results
“the compiler produces an error message that can be used to repair the result”
YouTube Unverified1 source· Talk
- feature
TypeChat: Available as a library on npm
“It's a library on npm right now”
YouTube Unverified1 source· Talk
- feature
TypeChat: Supports translating requests into validated sequences of commands using a constrained JSON format
“generate a fake language still based on the types, but in the form of JSON”
YouTube Unverified1 source· Talk
- feature
TypeChat: Python implementation is a prototype and not yet production-ready
“This is just a prototype of the Python stuff we've been working on. It's not prime time”
YouTube Unverified1 source· Talk














