by spdustin on 8/12/2024, 4:25:08 PM
by namanyayg on 8/12/2024, 1:54:25 PM
nice work on extracting and open-sourcing this lib!
I'm working on an agentic b2b ai myself and i found the process to add different tools quite annoying. This is a great solution. alas, my code is in TypeScript.
i'm curious, how do you handle errors and edge cases when the LLM-generated params don't quite match the function signature?
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.