openai-agents 0.0.13__py3-none-any.whl → 0.0.14__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/result.py +7 -9
- agents/run.py +3 -0
- agents/voice/__init__.py +2 -0
- agents/voice/model.py +3 -4
- {openai_agents-0.0.13.dist-info → openai_agents-0.0.14.dist-info}/METADATA +2 -2
- {openai_agents-0.0.13.dist-info → openai_agents-0.0.14.dist-info}/RECORD +8 -8
- {openai_agents-0.0.13.dist-info → openai_agents-0.0.14.dist-info}/WHEEL +0 -0
- {openai_agents-0.0.13.dist-info → openai_agents-0.0.14.dist-info}/licenses/LICENSE +0 -0
agents/result.py
CHANGED
|
@@ -15,6 +15,7 @@ from .exceptions import InputGuardrailTripwireTriggered, MaxTurnsExceeded
|
|
|
15
15
|
from .guardrail import InputGuardrailResult, OutputGuardrailResult
|
|
16
16
|
from .items import ItemHelpers, ModelResponse, RunItem, TResponseInputItem
|
|
17
17
|
from .logger import logger
|
|
18
|
+
from .run_context import RunContextWrapper
|
|
18
19
|
from .stream_events import StreamEvent
|
|
19
20
|
from .tracing import Trace
|
|
20
21
|
from .util._pretty_print import pretty_print_result, pretty_print_run_result_streaming
|
|
@@ -50,6 +51,9 @@ class RunResultBase(abc.ABC):
|
|
|
50
51
|
output_guardrail_results: list[OutputGuardrailResult]
|
|
51
52
|
"""Guardrail results for the final output of the agent."""
|
|
52
53
|
|
|
54
|
+
context_wrapper: RunContextWrapper[Any]
|
|
55
|
+
"""The context wrapper for the agent run."""
|
|
56
|
+
|
|
53
57
|
@property
|
|
54
58
|
@abc.abstractmethod
|
|
55
59
|
def last_agent(self) -> Agent[Any]:
|
|
@@ -75,9 +79,7 @@ class RunResultBase(abc.ABC):
|
|
|
75
79
|
|
|
76
80
|
def to_input_list(self) -> list[TResponseInputItem]:
|
|
77
81
|
"""Creates a new input list, merging the original input with all the new items generated."""
|
|
78
|
-
original_items: list[TResponseInputItem] = ItemHelpers.input_to_new_input_list(
|
|
79
|
-
self.input
|
|
80
|
-
)
|
|
82
|
+
original_items: list[TResponseInputItem] = ItemHelpers.input_to_new_input_list(self.input)
|
|
81
83
|
new_items = [item.to_input_item() for item in self.new_items]
|
|
82
84
|
|
|
83
85
|
return original_items + new_items
|
|
@@ -206,17 +208,13 @@ class RunResultStreaming(RunResultBase):
|
|
|
206
208
|
|
|
207
209
|
def _check_errors(self):
|
|
208
210
|
if self.current_turn > self.max_turns:
|
|
209
|
-
self._stored_exception = MaxTurnsExceeded(
|
|
210
|
-
f"Max turns ({self.max_turns}) exceeded"
|
|
211
|
-
)
|
|
211
|
+
self._stored_exception = MaxTurnsExceeded(f"Max turns ({self.max_turns}) exceeded")
|
|
212
212
|
|
|
213
213
|
# Fetch all the completed guardrail results from the queue and raise if needed
|
|
214
214
|
while not self._input_guardrail_queue.empty():
|
|
215
215
|
guardrail_result = self._input_guardrail_queue.get_nowait()
|
|
216
216
|
if guardrail_result.output.tripwire_triggered:
|
|
217
|
-
self._stored_exception = InputGuardrailTripwireTriggered(
|
|
218
|
-
guardrail_result
|
|
219
|
-
)
|
|
217
|
+
self._stored_exception = InputGuardrailTripwireTriggered(guardrail_result)
|
|
220
218
|
|
|
221
219
|
# Check the tasks for any exceptions
|
|
222
220
|
if self._run_impl_task and self._run_impl_task.done():
|
agents/run.py
CHANGED
|
@@ -270,6 +270,7 @@ class Runner:
|
|
|
270
270
|
_last_agent=current_agent,
|
|
271
271
|
input_guardrail_results=input_guardrail_results,
|
|
272
272
|
output_guardrail_results=output_guardrail_results,
|
|
273
|
+
context_wrapper=context_wrapper,
|
|
273
274
|
)
|
|
274
275
|
elif isinstance(turn_result.next_step, NextStepHandoff):
|
|
275
276
|
current_agent = cast(Agent[TContext], turn_result.next_step.new_agent)
|
|
@@ -423,6 +424,7 @@ class Runner:
|
|
|
423
424
|
output_guardrail_results=[],
|
|
424
425
|
_current_agent_output_schema=output_schema,
|
|
425
426
|
trace=new_trace,
|
|
427
|
+
context_wrapper=context_wrapper,
|
|
426
428
|
)
|
|
427
429
|
|
|
428
430
|
# Kick off the actual agent loop in the background and return the streamed result object.
|
|
@@ -696,6 +698,7 @@ class Runner:
|
|
|
696
698
|
usage=usage,
|
|
697
699
|
response_id=event.response.id,
|
|
698
700
|
)
|
|
701
|
+
context_wrapper.usage.add(usage)
|
|
699
702
|
|
|
700
703
|
streamed_result._event_queue.put_nowait(RawResponsesStreamEvent(data=event))
|
|
701
704
|
|
agents/voice/__init__.py
CHANGED
|
@@ -7,6 +7,7 @@ from .model import (
|
|
|
7
7
|
STTModelSettings,
|
|
8
8
|
TTSModel,
|
|
9
9
|
TTSModelSettings,
|
|
10
|
+
TTSVoice,
|
|
10
11
|
VoiceModelProvider,
|
|
11
12
|
)
|
|
12
13
|
from .models.openai_model_provider import OpenAIVoiceModelProvider
|
|
@@ -30,6 +31,7 @@ __all__ = [
|
|
|
30
31
|
"STTModelSettings",
|
|
31
32
|
"TTSModel",
|
|
32
33
|
"TTSModelSettings",
|
|
34
|
+
"TTSVoice",
|
|
33
35
|
"VoiceModelProvider",
|
|
34
36
|
"StreamedAudioResult",
|
|
35
37
|
"SingleAgentVoiceWorkflow",
|
agents/voice/model.py
CHANGED
|
@@ -14,14 +14,13 @@ DEFAULT_TTS_INSTRUCTIONS = (
|
|
|
14
14
|
)
|
|
15
15
|
DEFAULT_TTS_BUFFER_SIZE = 120
|
|
16
16
|
|
|
17
|
+
TTSVoice = Literal["alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer"]
|
|
18
|
+
"""Exportable type for the TTSModelSettings voice enum"""
|
|
17
19
|
|
|
18
20
|
@dataclass
|
|
19
21
|
class TTSModelSettings:
|
|
20
22
|
"""Settings for a TTS model."""
|
|
21
|
-
|
|
22
|
-
voice: (
|
|
23
|
-
Literal["alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer"] | None
|
|
24
|
-
) = None
|
|
23
|
+
voice: TTSVoice | None = None
|
|
25
24
|
"""
|
|
26
25
|
The voice to use for the TTS model. If not provided, the default voice for the respective model
|
|
27
26
|
will be used.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openai-agents
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.14
|
|
4
4
|
Summary: OpenAI Agents SDK
|
|
5
5
|
Project-URL: Homepage, https://github.com/openai/openai-agents-python
|
|
6
6
|
Project-URL: Repository, https://github.com/openai/openai-agents-python
|
|
@@ -26,7 +26,7 @@ Requires-Dist: requests<3,>=2.0
|
|
|
26
26
|
Requires-Dist: types-requests<3,>=2.0
|
|
27
27
|
Requires-Dist: typing-extensions<5,>=4.12.2
|
|
28
28
|
Provides-Extra: litellm
|
|
29
|
-
Requires-Dist: litellm<2,>=1.
|
|
29
|
+
Requires-Dist: litellm<2,>=1.67.4.post1; extra == 'litellm'
|
|
30
30
|
Provides-Extra: viz
|
|
31
31
|
Requires-Dist: graphviz>=0.17; extra == 'viz'
|
|
32
32
|
Provides-Extra: voice
|
|
@@ -14,8 +14,8 @@ agents/lifecycle.py,sha256=wYFG6PLSKQ7bICKVbB8oGtdoJNINGq9obh2RSKlAkDE,2938
|
|
|
14
14
|
agents/logger.py,sha256=p_ef7vWKpBev5FFybPJjhrCCQizK08Yy1A2EDO1SNNg,60
|
|
15
15
|
agents/model_settings.py,sha256=7s9YjfHBVz1f1a-V3dd-8eMe-IAgfDXhQgChI27Kz00,3326
|
|
16
16
|
agents/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
17
|
-
agents/result.py,sha256=
|
|
18
|
-
agents/run.py,sha256=
|
|
17
|
+
agents/result.py,sha256=dhtOaLIoOp5PYC4qcsgoU5qg2yvdI_VKdCy6i2qth7k,9305
|
|
18
|
+
agents/run.py,sha256=kPxqU6KjFzkuVdH-UbKPUhJrvl70ChMnQbfI4UDD3fw,40276
|
|
19
19
|
agents/run_context.py,sha256=vuSUQM8O4CLensQY27-22fOqECnw7yvwL9U3WO8b_bk,851
|
|
20
20
|
agents/stream_events.py,sha256=ULgBEcL_H4vklZoxhpY2yomeoxVF0UiXvswsFsjFv4s,1547
|
|
21
21
|
agents/strict_schema.py,sha256=_KuEJkglmq-Fj3HSeYP4WqTvqrxbSKu6gezfz5Brhh0,5775
|
|
@@ -61,12 +61,12 @@ agents/util/_json.py,sha256=eKeQeMlQkBXRFeL3ilNZFmszGyfhtzZdW_GW_As6dcg,972
|
|
|
61
61
|
agents/util/_pretty_print.py,sha256=rRVp24UmTgzCm-W4ritWBOxxnPRinzFdrZlOhTi1KVQ,2227
|
|
62
62
|
agents/util/_transforms.py,sha256=CZe74NOHkHneyo4fHYfFWksCSTn-kXtEyejL9P0_xlA,270
|
|
63
63
|
agents/util/_types.py,sha256=8KxYfCw0gYSMWcQmacJoc3Q7Lc46LmT-AWvhF10KJ-E,160
|
|
64
|
-
agents/voice/__init__.py,sha256=
|
|
64
|
+
agents/voice/__init__.py,sha256=4VWBUjyoXC6dGFuk-oZQGg8T32bFxVwy371c-zDK-EU,1537
|
|
65
65
|
agents/voice/events.py,sha256=4aPAZC0__ocgmg_mcX4c1zv9Go-YdKIVItQ2kYgtye0,1216
|
|
66
66
|
agents/voice/exceptions.py,sha256=QcyfvaUTBe4gxbFP82oDSa_puzZ4Z4O4k01B8pAHnK0,233
|
|
67
67
|
agents/voice/imports.py,sha256=VaE5I8aJTP9Zl_0-y9dx1UcAP7KPRDMaikFK2jFnn8s,348
|
|
68
68
|
agents/voice/input.py,sha256=FSbdHMIdLVKX4vYcmf3WBJ5dAlh5zMDjCAuGfXOZTQs,2910
|
|
69
|
-
agents/voice/model.py,sha256=
|
|
69
|
+
agents/voice/model.py,sha256=haVPgL3xlzkUyMeVaDphB74TlcZpruagMsx6CQxpx5g,5954
|
|
70
70
|
agents/voice/pipeline.py,sha256=5LKTTDytQt4QlZzVKgbB9x3X2zA-TeR94FTi15vIUc0,6259
|
|
71
71
|
agents/voice/pipeline_config.py,sha256=_cynbnzxvQijxkGrMYHJzIV54F9bRvDsPV24qexVO8c,1759
|
|
72
72
|
agents/voice/result.py,sha256=Yx9JCMGCE9OfXacaBFfFLQJRwkNo5-h4Nqm9OPnemU4,11107
|
|
@@ -76,7 +76,7 @@ agents/voice/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
|
76
76
|
agents/voice/models/openai_model_provider.py,sha256=Khn0uT-VhsEbe7_OhBMGFQzXNwL80gcWZyTHl3CaBII,3587
|
|
77
77
|
agents/voice/models/openai_stt.py,sha256=rRsldkvkPhH4T0waX1dhccEqIwmPYh-teK_LRvBgiNI,16882
|
|
78
78
|
agents/voice/models/openai_tts.py,sha256=4KoLQuFDHKu5a1VTJlu9Nj3MHwMlrn9wfT_liJDJ2dw,1477
|
|
79
|
-
openai_agents-0.0.
|
|
80
|
-
openai_agents-0.0.
|
|
81
|
-
openai_agents-0.0.
|
|
82
|
-
openai_agents-0.0.
|
|
79
|
+
openai_agents-0.0.14.dist-info/METADATA,sha256=OPr5u89L0F1s4_2FnlB2yBGLKZzgJ9oZ15TXItVedp4,8163
|
|
80
|
+
openai_agents-0.0.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
81
|
+
openai_agents-0.0.14.dist-info/licenses/LICENSE,sha256=E994EspT7Krhy0qGiES7WYNzBHrh1YDk3r--8d1baRU,1063
|
|
82
|
+
openai_agents-0.0.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|