Skip to content

Commit a77030b

Browse files
committed
add coverage-n
1 parent c84be82 commit a77030b

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

pydantic_ai_slim/pydantic_ai/builtin_tools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from abc import ABC
44
from dataclasses import dataclass
5-
from typing import Any, Literal
5+
from typing import Literal
66

77
from typing_extensions import TypedDict
88

@@ -19,7 +19,7 @@ class AbstractBuiltinTool(ABC):
1919
"""
2020

2121
# TODO(Marcelo): We need to handle custom tool definitions per model base.
22-
def handle_custom_tool_definition(self, model: str) -> Any: ...
22+
# def handle_custom_tool_definition(self, model: str) -> Any: ...
2323

2424

2525
@dataclass
@@ -97,5 +97,5 @@ class CodeExecutionTool(AbstractBuiltinTool):
9797
9898
Supported by:
9999
* Anthropic
100-
* Gemini
100+
* Google
101101
"""

pydantic_ai_slim/pydantic_ai/models/google.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,8 @@ def _get_tools(self, model_request_parameters: ModelRequestParameters) -> list[T
229229
for tool in model_request_parameters.builtin_tools:
230230
if isinstance(tool, WebSearchTool):
231231
tools.append(ToolDict(google_search=GoogleSearchDict()))
232-
elif isinstance(tool, CodeExecutionTool):
232+
elif isinstance(tool, CodeExecutionTool): # pragma: no branch
233233
tools.append(ToolDict(code_execution=ToolCodeExecutionDict()))
234-
else:
235-
raise UserError(f'Unsupported builtin tool: {tool}')
236234
return tools or None
237235

238236
def _get_tool_config(
@@ -511,10 +509,10 @@ def _content_model_response(m: ModelResponse) -> ContentDict:
511509
# please open an issue. The below code is the code to send thinking to the provider.
512510
# parts.append({'text': item.content, 'thought': True})
513511
pass
514-
elif isinstance(item, ServerToolCallPart):
512+
elif isinstance(item, ServerToolCallPart): # pragma: no cover
515513
# Never returned from google
516514
pass
517-
elif isinstance(item, ServerToolReturnPart):
515+
elif isinstance(item, ServerToolReturnPart): # pragma: no cover
518516
# Never returned from google
519517
pass
520518
else:

pydantic_ai_slim/pydantic_ai/models/openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ def _get_tools(self, model_request_parameters: ModelRequestParameters) -> list[r
832832
def _get_builtin_tools(self, model_request_parameters: ModelRequestParameters) -> list[responses.ToolParam]:
833833
tools: list[responses.ToolParam] = []
834834
for tool in model_request_parameters.builtin_tools:
835-
if isinstance(tool, WebSearchTool):
835+
if isinstance(tool, WebSearchTool): # pragma: no branch
836836
web_search_tool = responses.WebSearchToolParam(
837837
type='web_search_preview', search_context_size=tool.search_context_size
838838
)

0 commit comments

Comments
 (0)