openai-agents 0.2.8__py3-none-any.whl → 0.6.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agents/__init__.py +105 -4
- agents/_debug.py +15 -4
- agents/_run_impl.py +1203 -96
- agents/agent.py +164 -19
- agents/apply_diff.py +329 -0
- agents/editor.py +47 -0
- agents/exceptions.py +35 -0
- agents/extensions/experimental/__init__.py +6 -0
- agents/extensions/experimental/codex/__init__.py +92 -0
- agents/extensions/experimental/codex/codex.py +89 -0
- agents/extensions/experimental/codex/codex_options.py +35 -0
- agents/extensions/experimental/codex/codex_tool.py +1142 -0
- agents/extensions/experimental/codex/events.py +162 -0
- agents/extensions/experimental/codex/exec.py +263 -0
- agents/extensions/experimental/codex/items.py +245 -0
- agents/extensions/experimental/codex/output_schema_file.py +50 -0
- agents/extensions/experimental/codex/payloads.py +31 -0
- agents/extensions/experimental/codex/thread.py +214 -0
- agents/extensions/experimental/codex/thread_options.py +54 -0
- agents/extensions/experimental/codex/turn_options.py +36 -0
- agents/extensions/handoff_filters.py +13 -1
- agents/extensions/memory/__init__.py +120 -0
- agents/extensions/memory/advanced_sqlite_session.py +1285 -0
- agents/extensions/memory/async_sqlite_session.py +239 -0
- agents/extensions/memory/dapr_session.py +423 -0
- agents/extensions/memory/encrypt_session.py +185 -0
- agents/extensions/memory/redis_session.py +261 -0
- agents/extensions/memory/sqlalchemy_session.py +334 -0
- agents/extensions/models/litellm_model.py +449 -36
- agents/extensions/models/litellm_provider.py +3 -1
- agents/function_schema.py +47 -5
- agents/guardrail.py +16 -2
- agents/{handoffs.py → handoffs/__init__.py} +89 -47
- agents/handoffs/history.py +268 -0
- agents/items.py +237 -11
- agents/lifecycle.py +75 -14
- agents/mcp/server.py +280 -37
- agents/mcp/util.py +24 -3
- agents/memory/__init__.py +22 -2
- agents/memory/openai_conversations_session.py +91 -0
- agents/memory/openai_responses_compaction_session.py +249 -0
- agents/memory/session.py +19 -261
- agents/memory/sqlite_session.py +275 -0
- agents/memory/util.py +20 -0
- agents/model_settings.py +14 -3
- agents/models/__init__.py +13 -0
- agents/models/chatcmpl_converter.py +303 -50
- agents/models/chatcmpl_helpers.py +63 -0
- agents/models/chatcmpl_stream_handler.py +290 -68
- agents/models/default_models.py +58 -0
- agents/models/interface.py +4 -0
- agents/models/openai_chatcompletions.py +103 -49
- agents/models/openai_provider.py +10 -4
- agents/models/openai_responses.py +162 -46
- agents/realtime/__init__.py +4 -0
- agents/realtime/_util.py +14 -3
- agents/realtime/agent.py +7 -0
- agents/realtime/audio_formats.py +53 -0
- agents/realtime/config.py +78 -10
- agents/realtime/events.py +18 -0
- agents/realtime/handoffs.py +2 -2
- agents/realtime/items.py +17 -1
- agents/realtime/model.py +13 -0
- agents/realtime/model_events.py +12 -0
- agents/realtime/model_inputs.py +18 -1
- agents/realtime/openai_realtime.py +696 -150
- agents/realtime/session.py +243 -23
- agents/repl.py +7 -3
- agents/result.py +197 -38
- agents/run.py +949 -168
- agents/run_context.py +13 -2
- agents/stream_events.py +1 -0
- agents/strict_schema.py +14 -0
- agents/tool.py +413 -15
- agents/tool_context.py +22 -1
- agents/tool_guardrails.py +279 -0
- agents/tracing/__init__.py +2 -0
- agents/tracing/config.py +9 -0
- agents/tracing/create.py +4 -0
- agents/tracing/processor_interface.py +84 -11
- agents/tracing/processors.py +65 -54
- agents/tracing/provider.py +64 -7
- agents/tracing/spans.py +105 -0
- agents/tracing/traces.py +116 -16
- agents/usage.py +134 -12
- agents/util/_json.py +19 -1
- agents/util/_transforms.py +12 -2
- agents/voice/input.py +5 -4
- agents/voice/models/openai_stt.py +17 -9
- agents/voice/pipeline.py +2 -0
- agents/voice/pipeline_config.py +4 -0
- {openai_agents-0.2.8.dist-info → openai_agents-0.6.8.dist-info}/METADATA +44 -19
- openai_agents-0.6.8.dist-info/RECORD +134 -0
- {openai_agents-0.2.8.dist-info → openai_agents-0.6.8.dist-info}/WHEEL +1 -1
- openai_agents-0.2.8.dist-info/RECORD +0 -103
- {openai_agents-0.2.8.dist-info → openai_agents-0.6.8.dist-info}/licenses/LICENSE +0 -0
agents/realtime/config.py
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
|
|
5
|
-
Literal,
|
|
6
|
-
Union,
|
|
7
|
-
)
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, Literal, Union
|
|
8
5
|
|
|
6
|
+
from openai.types.realtime.realtime_audio_formats import (
|
|
7
|
+
RealtimeAudioFormats as OpenAIRealtimeAudioFormats,
|
|
8
|
+
)
|
|
9
9
|
from typing_extensions import NotRequired, TypeAlias, TypedDict
|
|
10
10
|
|
|
11
|
+
from agents.prompts import Prompt
|
|
12
|
+
|
|
11
13
|
from ..guardrail import OutputGuardrail
|
|
12
14
|
from ..handoffs import Handoff
|
|
13
15
|
from ..model_settings import ToolChoice
|
|
@@ -15,19 +17,28 @@ from ..tool import Tool
|
|
|
15
17
|
|
|
16
18
|
RealtimeModelName: TypeAlias = Union[
|
|
17
19
|
Literal[
|
|
20
|
+
"gpt-realtime",
|
|
21
|
+
"gpt-realtime-2025-08-28",
|
|
18
22
|
"gpt-4o-realtime-preview",
|
|
19
23
|
"gpt-4o-mini-realtime-preview",
|
|
20
24
|
"gpt-4o-realtime-preview-2025-06-03",
|
|
21
25
|
"gpt-4o-realtime-preview-2024-12-17",
|
|
22
26
|
"gpt-4o-realtime-preview-2024-10-01",
|
|
23
27
|
"gpt-4o-mini-realtime-preview-2024-12-17",
|
|
28
|
+
"gpt-realtime-mini",
|
|
29
|
+
"gpt-realtime-mini-2025-10-06",
|
|
24
30
|
],
|
|
25
31
|
str,
|
|
26
32
|
]
|
|
27
33
|
"""The name of a realtime model."""
|
|
28
34
|
|
|
29
35
|
|
|
30
|
-
RealtimeAudioFormat: TypeAlias = Union[
|
|
36
|
+
RealtimeAudioFormat: TypeAlias = Union[
|
|
37
|
+
Literal["pcm16", "g711_ulaw", "g711_alaw"],
|
|
38
|
+
str,
|
|
39
|
+
Mapping[str, Any],
|
|
40
|
+
OpenAIRealtimeAudioFormats,
|
|
41
|
+
]
|
|
31
42
|
"""The audio format for realtime audio streams."""
|
|
32
43
|
|
|
33
44
|
|
|
@@ -54,6 +65,13 @@ class RealtimeInputAudioTranscriptionConfig(TypedDict):
|
|
|
54
65
|
"""An optional prompt to guide transcription."""
|
|
55
66
|
|
|
56
67
|
|
|
68
|
+
class RealtimeInputAudioNoiseReductionConfig(TypedDict):
|
|
69
|
+
"""Noise reduction configuration for input audio."""
|
|
70
|
+
|
|
71
|
+
type: NotRequired[Literal["near_field", "far_field"]]
|
|
72
|
+
"""Noise reduction mode to apply to input audio."""
|
|
73
|
+
|
|
74
|
+
|
|
57
75
|
class RealtimeTurnDetectionConfig(TypedDict):
|
|
58
76
|
"""Turn detection config. Allows extra vendor keys if needed."""
|
|
59
77
|
|
|
@@ -78,6 +96,33 @@ class RealtimeTurnDetectionConfig(TypedDict):
|
|
|
78
96
|
threshold: NotRequired[float]
|
|
79
97
|
"""The threshold for voice activity detection."""
|
|
80
98
|
|
|
99
|
+
idle_timeout_ms: NotRequired[int]
|
|
100
|
+
"""Threshold for server-vad to trigger a response if the user is idle for this duration."""
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class RealtimeAudioInputConfig(TypedDict, total=False):
|
|
104
|
+
"""Configuration for audio input in realtime sessions."""
|
|
105
|
+
|
|
106
|
+
format: RealtimeAudioFormat | OpenAIRealtimeAudioFormats
|
|
107
|
+
noise_reduction: RealtimeInputAudioNoiseReductionConfig | None
|
|
108
|
+
transcription: RealtimeInputAudioTranscriptionConfig
|
|
109
|
+
turn_detection: RealtimeTurnDetectionConfig
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class RealtimeAudioOutputConfig(TypedDict, total=False):
|
|
113
|
+
"""Configuration for audio output in realtime sessions."""
|
|
114
|
+
|
|
115
|
+
format: RealtimeAudioFormat | OpenAIRealtimeAudioFormats
|
|
116
|
+
voice: str
|
|
117
|
+
speed: float
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class RealtimeAudioConfig(TypedDict, total=False):
|
|
121
|
+
"""Audio configuration for realtime sessions."""
|
|
122
|
+
|
|
123
|
+
input: RealtimeAudioInputConfig
|
|
124
|
+
output: RealtimeAudioOutputConfig
|
|
125
|
+
|
|
81
126
|
|
|
82
127
|
class RealtimeSessionModelSettings(TypedDict):
|
|
83
128
|
"""Model settings for a realtime model session."""
|
|
@@ -88,24 +133,36 @@ class RealtimeSessionModelSettings(TypedDict):
|
|
|
88
133
|
instructions: NotRequired[str]
|
|
89
134
|
"""System instructions for the model."""
|
|
90
135
|
|
|
136
|
+
prompt: NotRequired[Prompt]
|
|
137
|
+
"""The prompt to use for the model."""
|
|
138
|
+
|
|
91
139
|
modalities: NotRequired[list[Literal["text", "audio"]]]
|
|
92
140
|
"""The modalities the model should support."""
|
|
93
141
|
|
|
142
|
+
output_modalities: NotRequired[list[Literal["text", "audio"]]]
|
|
143
|
+
"""The output modalities the model should support."""
|
|
144
|
+
|
|
145
|
+
audio: NotRequired[RealtimeAudioConfig]
|
|
146
|
+
"""The audio configuration for the session."""
|
|
147
|
+
|
|
94
148
|
voice: NotRequired[str]
|
|
95
149
|
"""The voice to use for audio output."""
|
|
96
150
|
|
|
97
151
|
speed: NotRequired[float]
|
|
98
152
|
"""The speed of the model's responses."""
|
|
99
153
|
|
|
100
|
-
input_audio_format: NotRequired[RealtimeAudioFormat]
|
|
154
|
+
input_audio_format: NotRequired[RealtimeAudioFormat | OpenAIRealtimeAudioFormats]
|
|
101
155
|
"""The format for input audio streams."""
|
|
102
156
|
|
|
103
|
-
output_audio_format: NotRequired[RealtimeAudioFormat]
|
|
157
|
+
output_audio_format: NotRequired[RealtimeAudioFormat | OpenAIRealtimeAudioFormats]
|
|
104
158
|
"""The format for output audio streams."""
|
|
105
159
|
|
|
106
160
|
input_audio_transcription: NotRequired[RealtimeInputAudioTranscriptionConfig]
|
|
107
161
|
"""Configuration for transcribing input audio."""
|
|
108
162
|
|
|
163
|
+
input_audio_noise_reduction: NotRequired[RealtimeInputAudioNoiseReductionConfig | None]
|
|
164
|
+
"""Noise reduction configuration for input audio."""
|
|
165
|
+
|
|
109
166
|
turn_detection: NotRequired[RealtimeTurnDetectionConfig]
|
|
110
167
|
"""Configuration for detecting conversation turns."""
|
|
111
168
|
|
|
@@ -161,6 +218,9 @@ class RealtimeRunConfig(TypedDict):
|
|
|
161
218
|
tracing_disabled: NotRequired[bool]
|
|
162
219
|
"""Whether tracing is disabled for this run."""
|
|
163
220
|
|
|
221
|
+
async_tool_calls: NotRequired[bool]
|
|
222
|
+
"""Whether function tool calls should run asynchronously. Defaults to True."""
|
|
223
|
+
|
|
164
224
|
# TODO (rm) Add history audio storage config
|
|
165
225
|
|
|
166
226
|
|
|
@@ -174,6 +234,14 @@ class RealtimeUserInputText(TypedDict):
|
|
|
174
234
|
"""The text content from the user."""
|
|
175
235
|
|
|
176
236
|
|
|
237
|
+
class RealtimeUserInputImage(TypedDict, total=False):
|
|
238
|
+
"""An image input from the user (Realtime)."""
|
|
239
|
+
|
|
240
|
+
type: Literal["input_image"]
|
|
241
|
+
image_url: str
|
|
242
|
+
detail: NotRequired[Literal["auto", "low", "high"] | str]
|
|
243
|
+
|
|
244
|
+
|
|
177
245
|
class RealtimeUserInputMessage(TypedDict):
|
|
178
246
|
"""A message input from the user."""
|
|
179
247
|
|
|
@@ -183,8 +251,8 @@ class RealtimeUserInputMessage(TypedDict):
|
|
|
183
251
|
role: Literal["user"]
|
|
184
252
|
"""The role identifier for user messages."""
|
|
185
253
|
|
|
186
|
-
content: list[RealtimeUserInputText]
|
|
187
|
-
"""List of
|
|
254
|
+
content: list[RealtimeUserInputText | RealtimeUserInputImage]
|
|
255
|
+
"""List of content items (text and image) in the message."""
|
|
188
256
|
|
|
189
257
|
|
|
190
258
|
RealtimeUserInput: TypeAlias = Union[str, RealtimeUserInputMessage]
|
agents/realtime/events.py
CHANGED
|
@@ -69,6 +69,10 @@ class RealtimeToolStart:
|
|
|
69
69
|
"""The agent that updated."""
|
|
70
70
|
|
|
71
71
|
tool: Tool
|
|
72
|
+
"""The tool being called."""
|
|
73
|
+
|
|
74
|
+
arguments: str
|
|
75
|
+
"""The arguments passed to the tool as a JSON string."""
|
|
72
76
|
|
|
73
77
|
info: RealtimeEventInfo
|
|
74
78
|
"""Common info for all events, such as the context."""
|
|
@@ -86,6 +90,9 @@ class RealtimeToolEnd:
|
|
|
86
90
|
tool: Tool
|
|
87
91
|
"""The tool that was called."""
|
|
88
92
|
|
|
93
|
+
arguments: str
|
|
94
|
+
"""The arguments passed to the tool as a JSON string."""
|
|
95
|
+
|
|
89
96
|
output: Any
|
|
90
97
|
"""The output of the tool call."""
|
|
91
98
|
|
|
@@ -216,6 +223,16 @@ class RealtimeGuardrailTripped:
|
|
|
216
223
|
type: Literal["guardrail_tripped"] = "guardrail_tripped"
|
|
217
224
|
|
|
218
225
|
|
|
226
|
+
@dataclass
|
|
227
|
+
class RealtimeInputAudioTimeoutTriggered:
|
|
228
|
+
"""Called when the model detects a period of inactivity/silence from the user."""
|
|
229
|
+
|
|
230
|
+
info: RealtimeEventInfo
|
|
231
|
+
"""Common info for all events, such as the context."""
|
|
232
|
+
|
|
233
|
+
type: Literal["input_audio_timeout_triggered"] = "input_audio_timeout_triggered"
|
|
234
|
+
|
|
235
|
+
|
|
219
236
|
RealtimeSessionEvent: TypeAlias = Union[
|
|
220
237
|
RealtimeAgentStartEvent,
|
|
221
238
|
RealtimeAgentEndEvent,
|
|
@@ -230,5 +247,6 @@ RealtimeSessionEvent: TypeAlias = Union[
|
|
|
230
247
|
RealtimeHistoryUpdated,
|
|
231
248
|
RealtimeHistoryAdded,
|
|
232
249
|
RealtimeGuardrailTripped,
|
|
250
|
+
RealtimeInputAudioTimeoutTriggered,
|
|
233
251
|
]
|
|
234
252
|
"""An event emitted by the realtime session."""
|
agents/realtime/handoffs.py
CHANGED
|
@@ -13,10 +13,10 @@ from ..strict_schema import ensure_strict_json_schema
|
|
|
13
13
|
from ..tracing.spans import SpanError
|
|
14
14
|
from ..util import _error_tracing, _json
|
|
15
15
|
from ..util._types import MaybeAwaitable
|
|
16
|
+
from . import RealtimeAgent
|
|
16
17
|
|
|
17
18
|
if TYPE_CHECKING:
|
|
18
19
|
from ..agent import AgentBase
|
|
19
|
-
from . import RealtimeAgent
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
# The handoff input type is the type of data passed when the agent is called via a handoff.
|
|
@@ -74,7 +74,7 @@ def realtime_handoff(
|
|
|
74
74
|
"""Create a handoff from a RealtimeAgent.
|
|
75
75
|
|
|
76
76
|
Args:
|
|
77
|
-
agent: The RealtimeAgent to handoff to
|
|
77
|
+
agent: The RealtimeAgent to handoff to.
|
|
78
78
|
tool_name_override: Optional override for the name of the tool that represents the handoff.
|
|
79
79
|
tool_description_override: Optional override for the description of the tool that
|
|
80
80
|
represents the handoff.
|
agents/realtime/items.py
CHANGED
|
@@ -34,6 +34,22 @@ class InputAudio(BaseModel):
|
|
|
34
34
|
model_config = ConfigDict(extra="allow")
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
class InputImage(BaseModel):
|
|
38
|
+
"""Image input content for realtime messages."""
|
|
39
|
+
|
|
40
|
+
type: Literal["input_image"] = "input_image"
|
|
41
|
+
"""The type identifier for image input."""
|
|
42
|
+
|
|
43
|
+
image_url: str | None = None
|
|
44
|
+
"""Data/remote URL string (data:... or https:...)."""
|
|
45
|
+
|
|
46
|
+
detail: str | None = None
|
|
47
|
+
"""Optional detail hint (e.g., 'auto', 'high', 'low')."""
|
|
48
|
+
|
|
49
|
+
# Allow extra data (e.g., `detail`)
|
|
50
|
+
model_config = ConfigDict(extra="allow")
|
|
51
|
+
|
|
52
|
+
|
|
37
53
|
class AssistantText(BaseModel):
|
|
38
54
|
"""Text content from the assistant in realtime responses."""
|
|
39
55
|
|
|
@@ -100,7 +116,7 @@ class UserMessageItem(BaseModel):
|
|
|
100
116
|
role: Literal["user"] = "user"
|
|
101
117
|
"""The role identifier for user messages."""
|
|
102
118
|
|
|
103
|
-
content: list[Annotated[InputText | InputAudio, Field(discriminator="type")]]
|
|
119
|
+
content: list[Annotated[InputText | InputAudio | InputImage, Field(discriminator="type")]]
|
|
104
120
|
"""List of content items, can be text or audio."""
|
|
105
121
|
|
|
106
122
|
# Allow extra data
|
agents/realtime/model.py
CHANGED
|
@@ -118,6 +118,12 @@ class RealtimeModelConfig(TypedDict):
|
|
|
118
118
|
the OpenAI Realtime model will use the default OpenAI WebSocket URL.
|
|
119
119
|
"""
|
|
120
120
|
|
|
121
|
+
headers: NotRequired[dict[str, str]]
|
|
122
|
+
"""The headers to use when connecting. If unset, the model will use a sane default.
|
|
123
|
+
Note that, when you set this, authorization header won't be set under the hood.
|
|
124
|
+
e.g., {"api-key": "your api key here"} for Azure OpenAI Realtime WebSocket connections.
|
|
125
|
+
"""
|
|
126
|
+
|
|
121
127
|
initial_model_settings: NotRequired[RealtimeSessionModelSettings]
|
|
122
128
|
"""The initial model settings to use when connecting."""
|
|
123
129
|
|
|
@@ -133,6 +139,13 @@ class RealtimeModelConfig(TypedDict):
|
|
|
133
139
|
is played to the user.
|
|
134
140
|
"""
|
|
135
141
|
|
|
142
|
+
call_id: NotRequired[str]
|
|
143
|
+
"""Attach to an existing realtime call instead of creating a new session.
|
|
144
|
+
|
|
145
|
+
When provided, the transport connects using the `call_id` query string parameter rather than a
|
|
146
|
+
model name. This is used for SIP-originated calls that are accepted via the Realtime Calls API.
|
|
147
|
+
"""
|
|
148
|
+
|
|
136
149
|
|
|
137
150
|
class RealtimeModel(abc.ABC):
|
|
138
151
|
"""Interface for connecting to a realtime model and sending/receiving events."""
|
agents/realtime/model_events.py
CHANGED
|
@@ -85,6 +85,17 @@ class RealtimeModelInputAudioTranscriptionCompletedEvent:
|
|
|
85
85
|
type: Literal["input_audio_transcription_completed"] = "input_audio_transcription_completed"
|
|
86
86
|
|
|
87
87
|
|
|
88
|
+
@dataclass
|
|
89
|
+
class RealtimeModelInputAudioTimeoutTriggeredEvent:
|
|
90
|
+
"""Input audio timeout triggered."""
|
|
91
|
+
|
|
92
|
+
item_id: str
|
|
93
|
+
audio_start_ms: int
|
|
94
|
+
audio_end_ms: int
|
|
95
|
+
|
|
96
|
+
type: Literal["input_audio_timeout_triggered"] = "input_audio_timeout_triggered"
|
|
97
|
+
|
|
98
|
+
|
|
88
99
|
@dataclass
|
|
89
100
|
class RealtimeModelTranscriptDeltaEvent:
|
|
90
101
|
"""Partial transcript update."""
|
|
@@ -174,6 +185,7 @@ RealtimeModelEvent: TypeAlias = Union[
|
|
|
174
185
|
RealtimeModelAudioEvent,
|
|
175
186
|
RealtimeModelAudioInterruptedEvent,
|
|
176
187
|
RealtimeModelAudioDoneEvent,
|
|
188
|
+
RealtimeModelInputAudioTimeoutTriggeredEvent,
|
|
177
189
|
RealtimeModelInputAudioTranscriptionCompletedEvent,
|
|
178
190
|
RealtimeModelTranscriptDeltaEvent,
|
|
179
191
|
RealtimeModelItemUpdatedEvent,
|
agents/realtime/model_inputs.py
CHANGED
|
@@ -24,12 +24,26 @@ class RealtimeModelInputTextContent(TypedDict):
|
|
|
24
24
|
text: str
|
|
25
25
|
|
|
26
26
|
|
|
27
|
+
class RealtimeModelInputImageContent(TypedDict, total=False):
|
|
28
|
+
"""An image to be sent to the model.
|
|
29
|
+
|
|
30
|
+
The Realtime API expects `image_url` to be a string data/remote URL.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
type: Literal["input_image"]
|
|
34
|
+
image_url: str
|
|
35
|
+
"""String URL (data:... or https:...)."""
|
|
36
|
+
|
|
37
|
+
detail: NotRequired[str]
|
|
38
|
+
"""Optional detail hint such as 'high', 'low', or 'auto'."""
|
|
39
|
+
|
|
40
|
+
|
|
27
41
|
class RealtimeModelUserInputMessage(TypedDict):
|
|
28
42
|
"""A message to be sent to the model."""
|
|
29
43
|
|
|
30
44
|
type: Literal["message"]
|
|
31
45
|
role: Literal["user"]
|
|
32
|
-
content: list[RealtimeModelInputTextContent]
|
|
46
|
+
content: list[RealtimeModelInputTextContent | RealtimeModelInputImageContent]
|
|
33
47
|
|
|
34
48
|
|
|
35
49
|
RealtimeModelUserInput: TypeAlias = Union[str, RealtimeModelUserInputMessage]
|
|
@@ -81,6 +95,9 @@ class RealtimeModelSendToolOutput:
|
|
|
81
95
|
class RealtimeModelSendInterrupt:
|
|
82
96
|
"""Send an interrupt to the model."""
|
|
83
97
|
|
|
98
|
+
force_response_cancel: bool = False
|
|
99
|
+
"""Force sending a response.cancel event even if automatic cancellation is enabled."""
|
|
100
|
+
|
|
84
101
|
|
|
85
102
|
@dataclass
|
|
86
103
|
class RealtimeModelSendSessionUpdate:
|