#OpenAI Structured Output

1 messages · Page 1 of 1 (latest)

plush wadi
#

Hello, everyone. Now I am developing AI project using openAI api. And I am trying to generate MongoDB aggregation pipeline and filter using pydantic. It seems like that recursive schema using pydantic is required. Have you any example, or solution?

sly scarab
#

Consider simplifying the task for your v1. Output as a JSON object that doesn't nest too many layers. Convert that with code or other queries into a format to loop data between your source and target.

That exercise may help you to articulate for the model what you want. You might just need a two step process, or to call functions or agents.

Just remember that a Language Model isn't a replacement for Pandas or other data manipulation with code. Use the tool where it fits but don't compel it to operate beyond its design - you'll lose the battle and maybe blame the machine.

After you get the v1 working, try a v2 if it's still worthwhile.