You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't want to use the built-in WebSearchTool, I want to use a custom search tool.
After the program is run, it does output [debug] web_search_tool input query=xxx, but it also reports an error: agents.exceptions.MaxTurnsExceeded: Max turns (1) exceeded. How should I write my custom search function correctly?
@rm-openai Thank you, I changed max_turns to 3 and the program works normally.
In addition, I also found that when adding model_settings=ModelSettings(tool_choice="required") to Agent, MaxTurnsExceeded will still appear when max_turns=3. However, max_turns=3 remains unchanged, and the program works normally when model_settings=ModelSettings(tool_choice="required") is commented out. I don't know why this happens at the moment.
As a few folks have mentioned, setting tool_choice="required" seems to force the agent to use the web_search_tool at every iteration rather than processing the result. Best bet is to remove that setting and instead give a clear instruction to the agent to only run the web_search_tool once, which I've found to work reliably.
Question
I don't want to use the built-in WebSearchTool, I want to use a custom search tool.
After the program is run, it does output [debug] web_search_tool input query=xxx, but it also reports an error: agents.exceptions.MaxTurnsExceeded: Max turns (1) exceeded. How should I write my custom search function correctly?
The text was updated successfully, but these errors were encountered: