Skip to content

o1 Model fails when making tool calls #761

Open
@mtessar

Description

@mtessar

Thanks for integrating the o1 model. I can use o1 agents without tools, but when I try and use tools, I get an unsupported parameter error due to the parallel_tool_calls being set by the pydantic ai framework.

Here is some code that shows the agent working without tools and produces a BadRequestError when using tools:

agent = Agent(
    'openai:o1',
    system_prompt=(
        'You are a helpful assistant.  Today is 2024-12-12'
    ),
)
result = agent.run_sync("What is today's date?")
print(result)
"""
Today is January 24, 2025.
"""

@agent.tool
def get_joke(str) -> str:
    return 'Why did the chicken cross the road? To get to the other side!'

result = agent.run_sync("Call the `get_joke` function")
"""
---------------------------------------------------------------------------
BadRequestError                           Traceback (most recent call last)
<ipython-input-12-512d4a647163> in <cell line: 0>()
     19     return 'Why did the chicken cross the road? To get to the other side!'
     20 
---> 21 result = agent.run_sync("Call the `get_joke` function")
     22 

10 frames
/usr/local/lib/python3.11/dist-packages/openai/_base_client.py in _request(self, cast_to, options, stream, stream_cls, retries_taken)
   1642 
   1643             log.debug("Re-raising status error")
-> 1644             raise self._make_status_error_from_response(err.response) from None
   1645 
   1646         return await self._process_response(

BadRequestError: Error code: 400 - {'error': {'message': "Unsupported parameter: 'parallel_tool_calls' is not supported with this model.", 'type': 'invalid_request_error', 'param': 'parallel_tool_calls', 'code': 'unsupported_parameter'}}
"""

This code works for openai:gpt-4o but not o1. Thanks!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions