File tree Expand file tree Collapse file tree 4 files changed +8
-7
lines changed
Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 44import logging
55import struct
66from contextlib import asynccontextmanager
7- from typing import TYPE_CHECKING , Any , assert_never
7+ from typing import TYPE_CHECKING , Any
88
99from fastapi import FastAPI , WebSocket , WebSocketDisconnect
1010from fastapi .responses import FileResponse
1111from fastapi .staticfiles import StaticFiles
12+ from typing_extensions import assert_never
1213
1314from agents .realtime import RealtimeRunner , RealtimeSession , RealtimeSessionEvent
1415
Original file line number Diff line number Diff line change 2020from openai import NOT_GIVEN , AsyncStream , NotGiven
2121from openai .types .chat import (
2222 ChatCompletionChunk ,
23+ ChatCompletionMessageCustomToolCall ,
2324 ChatCompletionMessageFunctionToolCall ,
2425)
2526from openai .types .chat .chat_completion_message import (
2829 ChatCompletionMessage ,
2930)
3031from openai .types .chat .chat_completion_message_function_tool_call import Function
31- from openai .types .chat .chat_completion_message_tool_call import ChatCompletionMessageToolCall
3232from openai .types .responses import Response
3333
3434from ... import _debug
@@ -366,7 +366,7 @@ def convert_message_to_openai(
366366 if message .role != "assistant" :
367367 raise ModelBehaviorError (f"Unsupported role: { message .role } " )
368368
369- tool_calls : list [ChatCompletionMessageToolCall ] | None = (
369+ tool_calls : list [ChatCompletionMessageFunctionToolCall | ChatCompletionMessageCustomToolCall ] | None = (
370370 [LitellmConverter .convert_tool_call_to_openai (tool ) for tool in message .tool_calls ]
371371 if message .tool_calls
372372 else None
Original file line number Diff line number Diff line change @@ -291,7 +291,7 @@ def function_schema(
291291 # Default factory to empty list
292292 fields [name ] = (
293293 ann ,
294- Field (default_factory = list , description = field_description ), # type: ignore
294+ Field (default_factory = list , description = field_description ),
295295 )
296296
297297 elif param .kind == param .VAR_KEYWORD :
@@ -309,7 +309,7 @@ def function_schema(
309309
310310 fields [name ] = (
311311 ann ,
312- Field (default_factory = dict , description = field_description ), # type: ignore
312+ Field (default_factory = dict , description = field_description ),
313313 )
314314
315315 else :
Original file line number Diff line number Diff line change @@ -175,10 +175,10 @@ async def _apply_dynamic_tool_filter(
175175 ) -> list [MCPTool ]:
176176 """Apply dynamic tool filtering using a callable filter function."""
177177
178- # Ensure we have a callable filter and cast to help mypy
178+ # Ensure we have a callable filter
179179 if not callable (self .tool_filter ):
180180 raise ValueError ("Tool filter must be callable for dynamic filtering" )
181- tool_filter_func = cast ( ToolFilterCallable , self .tool_filter )
181+ tool_filter_func = self .tool_filter
182182
183183 # Create filter context
184184 filter_context = ToolFilterContext (
You can’t perform that action at this time.
0 commit comments