File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
import asyncio
2
2
from dataclasses import dataclass , field , fields
3
- from typing import Any , Optional
3
+ from typing import Any , Optional , Union
4
4
5
5
from openai .types .responses import ResponseFunctionToolCall
6
6
@@ -25,13 +25,21 @@ class ToolContext(RunContextWrapper[TContext]):
25
25
tool_call_id : str = field (default_factory = _assert_must_pass_tool_call_id )
26
26
"""The ID of the tool call."""
27
27
28
- _event_queue : asyncio .Queue [Any ] | None = field (default = None , init = False , repr = False )
28
+ _event_queue : Optional [asyncio .Queue [Any ]] = field (default = None , init = False , repr = False )
29
+
30
+ @property
31
+ def event_queue (self ) -> Optional [asyncio .Queue [Any ]]:
32
+ return self ._event_queue
33
+
34
+ @event_queue .setter
35
+ def event_queue (self , queue : Optional [asyncio .Queue [Any ]]) -> None :
36
+ self ._event_queue = queue
29
37
30
38
@classmethod
31
39
def from_agent_context (
32
40
cls ,
33
41
context : RunContextWrapper [TContext ],
34
- tool_call_id : str | int ,
42
+ tool_call_id : Union [ str , int ] ,
35
43
tool_call : Optional [ResponseFunctionToolCall ] = None ,
36
44
) -> "ToolContext" :
37
45
"""
You can’t perform that action at this time.
0 commit comments