I am trying to give my agent the ability to search...
# agents
c
I am trying to give my agent the ability to search onlin by using the openAI API but everytime the openai client is invoked in my agnet, my agent crashes. I have verfieid my API key is valid and I am correclty importing OpenAI but not sure what happened. Before 1.3.3, it used to work fine
Any advice or sample code to invoking openai in a tool call?
l
Why is your agent crashing? Do you have logs? It it worked prior to 1.3.3, I would expect it to still work since the team haven't introduced any breaking changes. You should just be able to invoke the OpenAI REST API from within a function_tool (for example using aiohttp). We don't have an example of this specifically, but I would use a syntax similar to https://github.com/livekit-examples/public-course/blob/main/public_modules/05-integrating-external-systems/src/agent.py#L81.
c
I changed my code to call my own backend function which wraps the openai client and it works fine
something wrong with the python openai client.. not sure..
✅ 1