openai-agents 0.0.1__py3-none-any.whl → 0.0.3__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.

Potentially problematic release.


This version of openai-agents might be problematic. Click here for more details.

Files changed (53) hide show
  1. agents/__init__.py +223 -0
  2. agents/_config.py +23 -0
  3. agents/_debug.py +17 -0
  4. agents/_run_impl.py +792 -0
  5. agents/_utils.py +61 -0
  6. agents/agent.py +159 -0
  7. agents/agent_output.py +144 -0
  8. agents/computer.py +107 -0
  9. agents/exceptions.py +63 -0
  10. agents/extensions/handoff_filters.py +67 -0
  11. agents/extensions/handoff_prompt.py +19 -0
  12. agents/function_schema.py +340 -0
  13. agents/guardrail.py +320 -0
  14. agents/handoffs.py +236 -0
  15. agents/items.py +246 -0
  16. agents/lifecycle.py +105 -0
  17. agents/logger.py +3 -0
  18. agents/model_settings.py +36 -0
  19. agents/models/__init__.py +0 -0
  20. agents/models/_openai_shared.py +34 -0
  21. agents/models/fake_id.py +5 -0
  22. agents/models/interface.py +107 -0
  23. agents/models/openai_chatcompletions.py +952 -0
  24. agents/models/openai_provider.py +65 -0
  25. agents/models/openai_responses.py +384 -0
  26. agents/result.py +220 -0
  27. agents/run.py +904 -0
  28. agents/run_context.py +26 -0
  29. agents/stream_events.py +58 -0
  30. agents/strict_schema.py +167 -0
  31. agents/tool.py +288 -0
  32. agents/tracing/__init__.py +97 -0
  33. agents/tracing/create.py +306 -0
  34. agents/tracing/logger.py +3 -0
  35. agents/tracing/processor_interface.py +69 -0
  36. agents/tracing/processors.py +261 -0
  37. agents/tracing/scope.py +45 -0
  38. agents/tracing/setup.py +211 -0
  39. agents/tracing/span_data.py +188 -0
  40. agents/tracing/spans.py +264 -0
  41. agents/tracing/traces.py +195 -0
  42. agents/tracing/util.py +17 -0
  43. agents/usage.py +22 -0
  44. agents/version.py +7 -0
  45. openai_agents-0.0.3.dist-info/METADATA +204 -0
  46. openai_agents-0.0.3.dist-info/RECORD +49 -0
  47. openai_agents-0.0.3.dist-info/licenses/LICENSE +21 -0
  48. openai-agents/example.py +0 -2
  49. openai_agents-0.0.1.dist-info/METADATA +0 -17
  50. openai_agents-0.0.1.dist-info/RECORD +0 -6
  51. openai_agents-0.0.1.dist-info/licenses/LICENSE +0 -20
  52. {openai-agents → agents/extensions}/__init__.py +0 -0
  53. {openai_agents-0.0.1.dist-info → openai_agents-0.0.3.dist-info}/WHEEL +0 -0
@@ -0,0 +1,107 @@
1
+ from __future__ import annotations
2
+
3
+ import abc
4
+ import enum
5
+ from collections.abc import AsyncIterator
6
+ from typing import TYPE_CHECKING
7
+
8
+ from ..agent_output import AgentOutputSchema
9
+ from ..handoffs import Handoff
10
+ from ..items import ModelResponse, TResponseInputItem, TResponseStreamEvent
11
+ from ..tool import Tool
12
+
13
+ if TYPE_CHECKING:
14
+ from ..model_settings import ModelSettings
15
+
16
+
17
+ class ModelTracing(enum.Enum):
18
+ DISABLED = 0
19
+ """Tracing is disabled entirely."""
20
+
21
+ ENABLED = 1
22
+ """Tracing is enabled, and all data is included."""
23
+
24
+ ENABLED_WITHOUT_DATA = 2
25
+ """Tracing is enabled, but inputs/outputs are not included."""
26
+
27
+ def is_disabled(self) -> bool:
28
+ return self == ModelTracing.DISABLED
29
+
30
+ def include_data(self) -> bool:
31
+ return self == ModelTracing.ENABLED
32
+
33
+
34
+ class Model(abc.ABC):
35
+ """The base interface for calling an LLM."""
36
+
37
+ @abc.abstractmethod
38
+ async def get_response(
39
+ self,
40
+ system_instructions: str | None,
41
+ input: str | list[TResponseInputItem],
42
+ model_settings: ModelSettings,
43
+ tools: list[Tool],
44
+ output_schema: AgentOutputSchema | None,
45
+ handoffs: list[Handoff],
46
+ tracing: ModelTracing,
47
+ ) -> ModelResponse:
48
+ """Get a response from the model.
49
+
50
+ Args:
51
+ system_instructions: The system instructions to use.
52
+ input: The input items to the model, in OpenAI Responses format.
53
+ model_settings: The model settings to use.
54
+ tools: The tools available to the model.
55
+ output_schema: The output schema to use.
56
+ handoffs: The handoffs available to the model.
57
+ tracing: Tracing configuration.
58
+
59
+ Returns:
60
+ The full model response.
61
+ """
62
+ pass
63
+
64
+ @abc.abstractmethod
65
+ def stream_response(
66
+ self,
67
+ system_instructions: str | None,
68
+ input: str | list[TResponseInputItem],
69
+ model_settings: ModelSettings,
70
+ tools: list[Tool],
71
+ output_schema: AgentOutputSchema | None,
72
+ handoffs: list[Handoff],
73
+ tracing: ModelTracing,
74
+ ) -> AsyncIterator[TResponseStreamEvent]:
75
+ """Stream a response from the model.
76
+
77
+ Args:
78
+ system_instructions: The system instructions to use.
79
+ input: The input items to the model, in OpenAI Responses format.
80
+ model_settings: The model settings to use.
81
+ tools: The tools available to the model.
82
+ output_schema: The output schema to use.
83
+ handoffs: The handoffs available to the model.
84
+ tracing: Tracing configuration.
85
+
86
+ Returns:
87
+ An iterator of response stream events, in OpenAI Responses format.
88
+ """
89
+ pass
90
+
91
+
92
+ class ModelProvider(abc.ABC):
93
+ """The base interface for a model provider.
94
+
95
+ Model provider is responsible for looking up Models by name.
96
+ """
97
+
98
+ @abc.abstractmethod
99
+ def get_model(self, model_name: str | None) -> Model:
100
+ """Get a model by name.
101
+
102
+ Args:
103
+ model_name: The name of the model to get.
104
+
105
+ Returns:
106
+ The model.
107
+ """