Hacker News new | ask | show | jobs
by spdustin 668 days ago
The issue with using Pydantic's model_to_json is that nested objects will return a nested schema, and OpenAI ignores description annotations for anything not at the root level. In practice, that means any nested parameters (e.g. array of objects) need to be really well-named, or have their descriptions hoisted up to the parent parameter.

Even better: extract them to their own function, list all the resulting functions when composing the completion request, and re-assemble the final object when the completion is returned.