![]() |
https://www.pexels.com/photo/broken-circuit-board-6755144/ |
We often encounter the situation when we need LLM to generate structured data in its response. And very often, JSON is the desired data format. We can use few-shots and even provide tools to generate them.
In the OpenAI's 2025-04-01-preview
version, we have the text_format parameter for instructing LLM to generate these JSON response adhering to a pydantic model. The generated response are Python class instance.
Source code is available here. The main code is here.
Comments
Post a Comment