Skip to content

Commit 29d8030

Browse files
some changes to address merge problems
1 parent c8bc581 commit 29d8030

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

pydantic_ai_slim/pydantic_ai/models/openai.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,9 @@ async def _completions_create(
505505
raise ModelHTTPError(status_code=status_code, model_name=self.model_name, body=e.body) from e
506506
raise # pragma: lax no cover
507507

508-
def _process_response(self, response: chat.ChatCompletion | str) -> ModelResponse:
508+
def _process_response(
509+
self, response: chat.ChatCompletion | str, model_request_parameters: ModelRequestParameters
510+
) -> ModelResponse:
509511
"""Process a non-streamed response, and prepare a message to return."""
510512
# Although the OpenAI SDK claims to return a Pydantic model (`ChatCompletion`) from the chat completions function:
511513
# * it hasn't actually performed validation (presumably they're creating the model with `model_construct` or something?!)

tests/models/test_model_names.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ def get_model_names(model_name_type: Any) -> Iterator[str]:
7070
moonshotai_names = [f'moonshotai:{n}' for n in get_model_names(MoonshotAIModelName)]
7171
mistral_names = [f'mistral:{n}' for n in get_model_names(MistralModelName)]
7272
openai_names = [f'openai:{n}' for n in get_model_names(OpenAIModelName)] + [
73-
n for n in get_model_names(OpenAIModelName) if n.startswith('o1') or n.startswith('gpt') or n.startswith('o3')
73+
n
74+
for n in get_model_names(OpenAIModelName)
75+
if n.startswith('o1') or n.startswith('gpt') or n.startswith('o3') or n.startswith('o4')
7476
]
7577
bedrock_names = [f'bedrock:{n}' for n in get_model_names(BedrockModelName)]
7678
deepseek_names = ['deepseek:deepseek-chat', 'deepseek:deepseek-reasoner']

tests/models/test_openai_responses.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,9 @@ def test_openai_responses_model_freeform_function_unsupported_model_error():
19421942
# GPT-4 doesn't support freeform function calling
19431943
model = OpenAIResponsesModel('gpt-4o', provider=OpenAIProvider(api_key='foobar'))
19441944

1945-
with pytest.raises(UserError, match='uses freeform function calling but gpt-4o does not support'):
1945+
with pytest.raises(
1946+
UserError, match='uses freeform function calling but .* does not support freeform function calling'
1947+
):
19461948
model._map_tool_definition(freeform_tool) # type: ignore[reportPrivateUsage]
19471949

19481950

0 commit comments

Comments
 (0)