microsoft / TypeChat

TypeChat is a library that makes it easy to build natural language interfaces using types.
https://microsoft.github.io/TypeChat/
MIT License
8.06k stars 379 forks source link

Add support for translating dataclasses #168

Closed DanielRosenwasser closed 5 months ago

DanielRosenwasser commented 6 months ago

This change enables translation of dataclasses into TypeScript schemas. Using dataclasses allows developers to operate over actual Python objects - in contrast, if we took an approach where we only permitted TypedDicts, developers would be restricted to only operating over dictionaries. With this, schemas can be generated from one, the other, or a mix of both.

Fixes #160