|
|
|
|
|
by alyt
435 days ago
|
|
> Every time I need to specify output schema for LLMs, I need to write a converter from Pydantic models to the schema. Pydantic V2's model_json_schema is not supported by some platforms like OpenAI or n8n. Interesting idea; I'm not familiar with n8n, but doesn't OpenAI's API natively support Pydantic models? You can just pass in the model directly as the `response_format` argument: https://platform.openai.com/docs/guides/structured-outputs?a... Definitely possible I'm missing which use cases you're thinking of. Would be cool to see some more concrete examples of how this has been useful for you! |
|
Yes, if we're talking about coding, luckily we don't need to deal with JSON schema in most cases. But there are places like OpenAI's playground and low-code platforms that don't support Pydantic model definition. I also doubt they will ever add Pydantic support because of the nature of such products.
Besides, I feel we need some automatic prompt engineering for structured output, then it'll probably be better done on JSON schema than on JS/Python code because you can use JSON as part of the prompt. But maybe I'm betting wrong on the future!