Show HN: Tysm, a Rust crate for using ChatGPT with Structured Outputs

github.com

7 points by ChadNauseam a day ago

Hi HN! This Christmas I made `tysm`, a rust crates which simplifies using ChatGPT with Structured Outputs. Essentially you just tell it the rust type you want the output to conform to, and it handles creating the JSON Schema, passing it to ChatGPT's chat-completions API, and deserializing the response. Structured Outputs are very useful because they guarantee that the response will conform to whatever type you expect. I'm already finding my crate very useful since I love using Structured Outputs but I hate writing JSON Schemas myself.

Technical details for rust heads: To generate the JSON Schema, it uses an unreleased version of the `schemars` crate. (Hopefully it will be released soon and then I won't have to put up this disclaimer anymore.) For deserialization, it uses `serde`.