openai-sdk-helpers 0.5.2__py3-none-any.whl → 0.6.1__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.
- openai_sdk_helpers/agent/__init__.py +2 -0
- openai_sdk_helpers/agent/base.py +13 -5
- openai_sdk_helpers/agent/classifier.py +848 -0
- openai_sdk_helpers/prompt/classifier.jinja +31 -0
- openai_sdk_helpers/response/base.py +26 -7
- openai_sdk_helpers/settings.py +65 -0
- openai_sdk_helpers/structure/__init__.py +12 -0
- openai_sdk_helpers/structure/base.py +79 -55
- openai_sdk_helpers/structure/classification.py +453 -0
- openai_sdk_helpers/structure/plan/enum.py +4 -0
- {openai_sdk_helpers-0.5.2.dist-info → openai_sdk_helpers-0.6.1.dist-info}/METADATA +12 -1
- {openai_sdk_helpers-0.5.2.dist-info → openai_sdk_helpers-0.6.1.dist-info}/RECORD +15 -12
- {openai_sdk_helpers-0.5.2.dist-info → openai_sdk_helpers-0.6.1.dist-info}/WHEEL +0 -0
- {openai_sdk_helpers-0.5.2.dist-info → openai_sdk_helpers-0.6.1.dist-info}/entry_points.txt +0 -0
- {openai_sdk_helpers-0.5.2.dist-info → openai_sdk_helpers-0.6.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -7,6 +7,7 @@ from ..structure.plan.enum import AgentEnum
|
|
|
7
7
|
from .coordinator import CoordinatorAgent
|
|
8
8
|
from .runner import run_sync, run_async
|
|
9
9
|
from .search.base import SearchPlanner, SearchToolAgent, SearchWriter
|
|
10
|
+
from .classifier import TaxonomyClassifierAgent
|
|
10
11
|
from .summarizer import SummarizerAgent
|
|
11
12
|
from .translator import TranslatorAgent
|
|
12
13
|
from .validator import ValidatorAgent
|
|
@@ -27,6 +28,7 @@ __all__ = [
|
|
|
27
28
|
"SearchPlanner",
|
|
28
29
|
"SearchToolAgent",
|
|
29
30
|
"SearchWriter",
|
|
31
|
+
"TaxonomyClassifierAgent",
|
|
30
32
|
"SummarizerAgent",
|
|
31
33
|
"TranslatorAgent",
|
|
32
34
|
"ValidatorAgent",
|
openai_sdk_helpers/agent/base.py
CHANGED
|
@@ -429,9 +429,16 @@ class AgentBase(DataclassJSONSerializable):
|
|
|
429
429
|
"""
|
|
430
430
|
return self._session
|
|
431
431
|
|
|
432
|
-
def get_agent(
|
|
432
|
+
def get_agent(
|
|
433
|
+
self, output_structure: Optional[type[StructureBase]] = None
|
|
434
|
+
) -> Agent:
|
|
433
435
|
"""Construct and return the configured :class:`agents.Agent` instance.
|
|
434
436
|
|
|
437
|
+
Parameters
|
|
438
|
+
----------
|
|
439
|
+
output_structure : type[StructureBase] or None, default=None
|
|
440
|
+
Optional override for the agent output schema.
|
|
441
|
+
|
|
435
442
|
Returns
|
|
436
443
|
-------
|
|
437
444
|
Agent
|
|
@@ -442,8 +449,9 @@ class AgentBase(DataclassJSONSerializable):
|
|
|
442
449
|
"instructions": self._configuration.instructions_text or ".",
|
|
443
450
|
"model": self._model,
|
|
444
451
|
}
|
|
445
|
-
|
|
446
|
-
|
|
452
|
+
output_type = output_structure or self._configuration.output_structure
|
|
453
|
+
if output_type is not None:
|
|
454
|
+
agent_config["output_type"] = output_type
|
|
447
455
|
if self._configuration.tools:
|
|
448
456
|
agent_config["tools"] = self._configuration.tools
|
|
449
457
|
if self._model_settings:
|
|
@@ -490,7 +498,7 @@ class AgentBase(DataclassJSONSerializable):
|
|
|
490
498
|
session_to_use = session if session is not None else self._session
|
|
491
499
|
try:
|
|
492
500
|
return await run_async(
|
|
493
|
-
agent=self.get_agent(),
|
|
501
|
+
agent=self.get_agent(output_structure=output_structure),
|
|
494
502
|
input=input,
|
|
495
503
|
context=context,
|
|
496
504
|
output_structure=output_structure,
|
|
@@ -545,7 +553,7 @@ class AgentBase(DataclassJSONSerializable):
|
|
|
545
553
|
session_to_use = session if session is not None else self._session
|
|
546
554
|
try:
|
|
547
555
|
return run_sync(
|
|
548
|
-
agent=self.get_agent(),
|
|
556
|
+
agent=self.get_agent(output_structure=output_structure),
|
|
549
557
|
input=input,
|
|
550
558
|
context=context,
|
|
551
559
|
output_structure=output_structure,
|