File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
pydantic_ai_slim/pydantic_ai/models Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff 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?!)
Original file line number Diff line number Diff 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' ]
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments