fix typing for tools (#600)

This commit is contained in:
Eduard van Valkenburg
2025-09-03 20:07:44 +02:00
committed by GitHub
Unverified
parent d54edf20c9
commit d42ebc8df6
6 changed files with 23 additions and 39 deletions
@@ -15,11 +15,9 @@ from openai.types.chat.chat_completion_chunk import Choice as ChunkChoice
from openai.types.chat.chat_completion_message_custom_tool_call import ChatCompletionMessageCustomToolCall
from pydantic import BaseModel, SecretStr, ValidationError
from agent_framework import AIFunction, AITool, UsageContent
from .._clients import ChatClientBase, use_tool_calling
from .._logging import get_logger
from .._tools import HostedWebSearchTool
from .._tools import AIFunction, AITool, HostedWebSearchTool
from .._types import (
AIContents,
ChatFinishReason,
@@ -31,6 +29,7 @@ from .._types import (
FunctionCallContent,
FunctionResultContent,
TextContent,
UsageContent,
UsageDetails,
)
from ..exceptions import (
@@ -31,8 +31,6 @@ from openai.types.responses.web_search_tool_param import UserLocation as WebSear
from openai.types.responses.web_search_tool_param import WebSearchToolParam
from pydantic import BaseModel, SecretStr, ValidationError
from agent_framework import DataContent, TextReasoningContent, UriContent, UsageContent
from .._clients import ChatClientBase, use_tool_calling
from .._logging import get_logger
from .._tools import AIFunction, AITool, HostedCodeInterpreterTool, HostedFileSearchTool, HostedWebSearchTool
@@ -44,12 +42,16 @@ from .._types import (
ChatResponseUpdate,
ChatRole,
CitationAnnotation,
DataContent,
FunctionCallContent,
FunctionResultContent,
HostedFileContent,
HostedVectorStoreContent,
TextContent,
TextReasoningContent,
TextSpanRegion,
UriContent,
UsageContent,
UsageDetails,
)
from ..exceptions import (
@@ -109,11 +111,9 @@ class OpenAIResponsesClientBase(OpenAIHandler, ChatClientBase):
temperature: float | None = None,
tool_choice: "ChatToolMode" | Literal["auto", "required", "none"] | dict[str, Any] | None = "auto",
tools: AITool
| list[AITool]
| Callable[..., Any]
| list[Callable[..., Any]]
| MutableMapping[str, Any]
| list[MutableMapping[str, Any]]
| list[AITool | Callable[..., Any] | MutableMapping[str, Any]]
| None = None,
top_p: float | None = None,
user: str | None = None,
@@ -201,11 +201,9 @@ class OpenAIResponsesClientBase(OpenAIHandler, ChatClientBase):
temperature: float | None = None,
tool_choice: "ChatToolMode" | Literal["auto", "required", "none"] | dict[str, Any] | None = "auto",
tools: AITool
| list[AITool]
| Callable[..., Any]
| list[Callable[..., Any]]
| MutableMapping[str, Any]
| list[MutableMapping[str, Any]]
| list[AITool | Callable[..., Any] | MutableMapping[str, Any]]
| None = None,
top_p: float | None = None,
user: str | None = None,