-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsuported role system for openai-o1-mini #974
Comments
Which |
Sorry for not providing on the first message. Tested with |
Can you please share a MRE? |
MREimport os
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIModel
model = OpenAIModel(
model_name='o1-mini',
api_key=os.getenv('OPENAI_API_KEY'),
)
agent = Agent(
model=model,
system_prompt='You are a helpful assistant.',
)
agent.run_sync('Hi') |
It seems that with: from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIModel
model = OpenAIModel('o1-mini') # , system_prompt_role='developer')
agent = Agent(model=model, system_prompt='You are a helpful assistant.')
print(agent.run_sync('Hi')) I have: openai.BadRequestError: Error code: 400 - {'error': {'message': "Unsupported value: 'messages[0].role' does not support 'system' with this model.", 'type': 'invalid_request_error', 'param': 'messages[0].role', 'code': 'unsupported_value'}} And... If I use the from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIModel
model = OpenAIModel('o1-mini', system_prompt_role='developer')
agent = Agent(model=model, system_prompt='You are a helpful assistant.')
print(agent.run_sync('Hi')) I have this error instead: openai.BadRequestError: Error code: 400 - {'error': {'message': "Unsupported value: 'messages[0].role' does not support 'developer' with this model.", 'type': 'invalid_request_error', 'param': 'messages[0].role', 'code': 'unsupported_value'}} So... 🤷♂ I've read on their docs that it's recommended to use from pydantic_ai import Agent
agent = Agent(model='openai:o3-mini', system_prompt='You are a helpful assistant.')
print(agent.run_sync('Hi')) |
For what I've found in other forums, it just seems that |
Anyway, since we have the parameter The problem here is that the model doesn't support either |
You can use the |
@Kludex this seems like a reasonable workaround, but shouldn't it be possible to automatically set the |
I think it's a valid point. 👍 |
Got an error while using this:
Error from the model
Looking at the docs of OpenAI, I saw that
system
prompts were replaced bydeveloper
prompts(see https://platform.openai.com/docs/api-reference/chat/create)
The text was updated successfully, but these errors were encountered: