openai-sdk-helpers 0.4.1__tar.gz → 0.4.2__tar.gz
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-0.4.1 → openai_sdk_helpers-0.4.2}/PKG-INFO +1 -1
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/pyproject.toml +1 -1
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/__init__.py +6 -2
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/__init__.py +2 -2
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/base.py +152 -10
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/config.py +38 -63
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/search/__init__.py +4 -4
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/search/vector.py +41 -29
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/search/web.py +28 -24
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/environment.py +22 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/config.py +1 -1
- openai_sdk_helpers-0.4.2/src/openai_sdk_helpers/response/planner.py +12 -0
- openai_sdk_helpers-0.4.2/src/openai_sdk_helpers/response/prompter.py +12 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/streamlit_app/streamlit_web_search.py +1 -1
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/json/ref.py +3 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/.gitignore +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/LICENSE +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/README.md +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/coordination.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/prompt_utils.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/runner.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/search/base.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/summarizer.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/translator.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/utils.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/validation.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/cli.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/config.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/context_manager.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/deprecation.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/enums/__init__.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/enums/base.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/errors.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/files_api.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/logging_config.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/prompt/__init__.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/prompt/base.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/prompt/summarizer.jinja +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/prompt/translator.jinja +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/prompt/validator.jinja +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/py.typed +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/__init__.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/base.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/files.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/messages.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/runner.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/tool_call.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/vector_store.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/retry.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/streamlit_app/__init__.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/streamlit_app/app.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/streamlit_app/config.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/__init__.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/agent_blueprint.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/base.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/plan/__init__.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/plan/enum.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/plan/helpers.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/plan/plan.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/plan/task.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/plan/types.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/prompt.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/responses.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/summary.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/translation.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/validation.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/vector_search.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/web_search.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/tools.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/types.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/__init__.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/async_utils.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/coercion.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/deprecation.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/encoding.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/instructions.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/json/__init__.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/json/base_model.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/json/data_class.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/json/utils.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/output_validation.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/path_utils.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/registry.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/validation.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/vector_storage/__init__.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/vector_storage/cleanup.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/vector_storage/storage.py +0 -0
- {openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/vector_storage/types.py +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
from .environment import get_data_path, get_model
|
|
5
6
|
from .utils.async_utils import run_coroutine_thread_safe, run_coroutine_with_fallback
|
|
6
7
|
from .context_manager import (
|
|
7
8
|
AsyncManagedResource,
|
|
@@ -61,7 +62,7 @@ from .agent import (
|
|
|
61
62
|
SummarizerAgent,
|
|
62
63
|
TranslatorAgent,
|
|
63
64
|
ValidatorAgent,
|
|
64
|
-
|
|
65
|
+
VectorAgentSearch,
|
|
65
66
|
WebAgentSearch,
|
|
66
67
|
)
|
|
67
68
|
from .response import (
|
|
@@ -103,6 +104,9 @@ from .types import (
|
|
|
103
104
|
)
|
|
104
105
|
|
|
105
106
|
__all__ = [
|
|
107
|
+
# Environment utilities
|
|
108
|
+
"get_data_path",
|
|
109
|
+
"get_model",
|
|
106
110
|
# Async utilities
|
|
107
111
|
"run_coroutine_thread_safe",
|
|
108
112
|
"run_coroutine_with_fallback",
|
|
@@ -156,7 +160,7 @@ __all__ = [
|
|
|
156
160
|
"SummarizerAgent",
|
|
157
161
|
"TranslatorAgent",
|
|
158
162
|
"ValidatorAgent",
|
|
159
|
-
"
|
|
163
|
+
"VectorAgentSearch",
|
|
160
164
|
"WebAgentSearch",
|
|
161
165
|
"ExtendedSummaryStructure",
|
|
162
166
|
"WebSearchStructure",
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/__init__.py
RENAMED
|
@@ -12,7 +12,7 @@ from .summarizer import SummarizerAgent
|
|
|
12
12
|
from .translator import TranslatorAgent
|
|
13
13
|
from .validation import ValidatorAgent
|
|
14
14
|
from .utils import run_coroutine_agent_sync
|
|
15
|
-
from .search.vector import
|
|
15
|
+
from .search.vector import VectorAgentSearch
|
|
16
16
|
from .search.web import WebAgentSearch
|
|
17
17
|
|
|
18
18
|
__all__ = [
|
|
@@ -32,6 +32,6 @@ __all__ = [
|
|
|
32
32
|
"SummarizerAgent",
|
|
33
33
|
"TranslatorAgent",
|
|
34
34
|
"ValidatorAgent",
|
|
35
|
-
"
|
|
35
|
+
"VectorAgentSearch",
|
|
36
36
|
"WebAgentSearch",
|
|
37
37
|
]
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import json
|
|
5
6
|
from pathlib import Path
|
|
6
|
-
from typing import Any, Callable, Dict, Optional, Protocol, cast
|
|
7
|
+
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Protocol, cast
|
|
7
8
|
import uuid
|
|
8
9
|
|
|
9
10
|
from agents import (
|
|
@@ -21,14 +22,21 @@ from jinja2 import Template
|
|
|
21
22
|
|
|
22
23
|
from ..utils.json.data_class import DataclassJSONSerializable
|
|
23
24
|
from ..structure.base import StructureBase
|
|
25
|
+
from ..structure.prompt import PromptStructure
|
|
24
26
|
|
|
25
27
|
from ..utils import (
|
|
26
28
|
check_filepath,
|
|
27
29
|
log,
|
|
28
30
|
)
|
|
29
31
|
|
|
32
|
+
from ..tools import tool_handler_factory
|
|
33
|
+
|
|
30
34
|
from .runner import run_async, run_streamed, run_sync
|
|
31
35
|
|
|
36
|
+
if TYPE_CHECKING:
|
|
37
|
+
from ..config import OpenAISettings
|
|
38
|
+
from ..response.base import ResponseBase, ToolHandler
|
|
39
|
+
|
|
32
40
|
|
|
33
41
|
class AgentConfigurationProtocol(Protocol):
|
|
34
42
|
"""Protocol describing the configuration attributes for AgentBase."""
|
|
@@ -181,6 +189,10 @@ class AgentBase(DataclassJSONSerializable):
|
|
|
181
189
|
Return a streaming result for the agent execution.
|
|
182
190
|
as_tool()
|
|
183
191
|
Return the agent as a callable tool.
|
|
192
|
+
as_response_tool()
|
|
193
|
+
Return response tool handler and definition for Responses API use.
|
|
194
|
+
build_response(openai_settings, data_path=None, tool_handlers=None, system_vector_store=None)
|
|
195
|
+
Build a ResponseBase instance based on this agent.
|
|
184
196
|
close()
|
|
185
197
|
Clean up agent resources (can be overridden by subclasses).
|
|
186
198
|
"""
|
|
@@ -575,26 +587,156 @@ class AgentBase(DataclassJSONSerializable):
|
|
|
575
587
|
)
|
|
576
588
|
return tool_obj
|
|
577
589
|
|
|
578
|
-
def as_response_tool(
|
|
579
|
-
|
|
590
|
+
def as_response_tool(
|
|
591
|
+
self,
|
|
592
|
+
*,
|
|
593
|
+
tool_name: str | None = None,
|
|
594
|
+
tool_description: str | None = None,
|
|
595
|
+
) -> tuple[dict[str, Callable[..., Any]], dict[str, Any]]:
|
|
596
|
+
"""Return response tool handler and definition for Responses API use.
|
|
597
|
+
|
|
598
|
+
The returned handler serializes tool output as JSON using
|
|
599
|
+
``tool_handler_factory`` so downstream response flows can rely on a
|
|
600
|
+
consistent payload format.
|
|
601
|
+
|
|
602
|
+
Parameters
|
|
603
|
+
----------
|
|
604
|
+
tool_name : str or None, default=None
|
|
605
|
+
Optional override for the tool name. When None, uses the agent name.
|
|
606
|
+
tool_description : str or None, default=None
|
|
607
|
+
Optional override for the tool description. When None, uses the
|
|
608
|
+
agent description.
|
|
580
609
|
|
|
581
610
|
Returns
|
|
582
611
|
-------
|
|
583
|
-
|
|
584
|
-
Tool
|
|
612
|
+
tuple[dict[str, Callable[..., Any]], dict[str, Any]]
|
|
613
|
+
Tool handler mapping and tool definition for Responses API usage.
|
|
614
|
+
|
|
615
|
+
Examples
|
|
616
|
+
--------
|
|
617
|
+
>>> tool_handler, tool_definition = agent.as_response_tool()
|
|
618
|
+
>>> response = ResponseBase(
|
|
619
|
+
... name="agent_tool",
|
|
620
|
+
... instructions="Use the agent tool when needed.",
|
|
621
|
+
... tools=[tool_definition],
|
|
622
|
+
... output_structure=None,
|
|
623
|
+
... tool_handlers=tool_handler,
|
|
624
|
+
... openai_settings=settings,
|
|
625
|
+
... )
|
|
626
|
+
>>> response.run_sync("Invoke the agent tool") # doctest: +SKIP
|
|
585
627
|
"""
|
|
586
|
-
|
|
628
|
+
|
|
629
|
+
def _run_agent(**kwargs: Any) -> Any:
|
|
630
|
+
prompt = kwargs.get("prompt")
|
|
631
|
+
if prompt is None:
|
|
632
|
+
if len(kwargs) == 1:
|
|
633
|
+
prompt = next(iter(kwargs.values()))
|
|
634
|
+
else:
|
|
635
|
+
prompt = json.dumps(kwargs)
|
|
636
|
+
return self.run_sync(str(prompt))
|
|
637
|
+
|
|
638
|
+
name = tool_name or self.name
|
|
639
|
+
description = tool_description or self.description
|
|
640
|
+
input_model = self._input_structure or PromptStructure
|
|
641
|
+
tool_handler = {name: tool_handler_factory(_run_agent, input_model=input_model)}
|
|
587
642
|
tool_definition = {
|
|
588
643
|
"type": "function",
|
|
589
|
-
"name":
|
|
590
|
-
"description":
|
|
644
|
+
"name": name,
|
|
645
|
+
"description": description,
|
|
591
646
|
"strict": True,
|
|
592
647
|
"additionalProperties": False,
|
|
648
|
+
"parameters": self._build_response_parameters(),
|
|
593
649
|
}
|
|
594
|
-
if self.output_structure:
|
|
595
|
-
tool_definition["parameters"] = self.output_structure.get_schema()
|
|
596
650
|
return tool_handler, tool_definition
|
|
597
651
|
|
|
652
|
+
def build_response(
|
|
653
|
+
self,
|
|
654
|
+
*,
|
|
655
|
+
openai_settings: OpenAISettings,
|
|
656
|
+
data_path: Path | str | None = None,
|
|
657
|
+
tool_handlers: dict[str, ToolHandler] | None = None,
|
|
658
|
+
system_vector_store: list[str] | None = None,
|
|
659
|
+
) -> ResponseBase[StructureBase]:
|
|
660
|
+
"""Build a ResponseBase instance from this agent configuration.
|
|
661
|
+
|
|
662
|
+
Parameters
|
|
663
|
+
----------
|
|
664
|
+
openai_settings : OpenAISettings
|
|
665
|
+
Authentication and model settings applied to the generated response.
|
|
666
|
+
data_path : Path, str, or None, default None
|
|
667
|
+
Optional path for storing response artifacts. When None, the
|
|
668
|
+
response uses the default data directory.
|
|
669
|
+
tool_handlers : dict[str, ToolHandler] or None, default None
|
|
670
|
+
Optional mapping of tool names to handler callables.
|
|
671
|
+
system_vector_store : list[str] or None, default None
|
|
672
|
+
Optional list of vector store names to attach as system context.
|
|
673
|
+
|
|
674
|
+
Returns
|
|
675
|
+
-------
|
|
676
|
+
ResponseBase[StructureBase]
|
|
677
|
+
ResponseBase instance configured with this agent's settings.
|
|
678
|
+
|
|
679
|
+
Examples
|
|
680
|
+
--------
|
|
681
|
+
>>> from openai_sdk_helpers import OpenAISettings
|
|
682
|
+
>>> response = agent.build_response(openai_settings=OpenAISettings.from_env())
|
|
683
|
+
"""
|
|
684
|
+
from ..response.base import ResponseBase, ToolHandler
|
|
685
|
+
from ..config import OpenAISettings
|
|
686
|
+
|
|
687
|
+
if not isinstance(openai_settings, OpenAISettings):
|
|
688
|
+
raise TypeError("openai_settings must be an OpenAISettings instance")
|
|
689
|
+
|
|
690
|
+
tools = self._normalize_response_tools(self.tools)
|
|
691
|
+
|
|
692
|
+
return ResponseBase(
|
|
693
|
+
name=self.name,
|
|
694
|
+
instructions=self.instructions_text,
|
|
695
|
+
tools=tools,
|
|
696
|
+
output_structure=self.output_structure,
|
|
697
|
+
system_vector_store=system_vector_store,
|
|
698
|
+
data_path=data_path,
|
|
699
|
+
tool_handlers=tool_handlers,
|
|
700
|
+
openai_settings=openai_settings,
|
|
701
|
+
)
|
|
702
|
+
|
|
703
|
+
def _build_response_parameters(self) -> dict[str, Any]:
|
|
704
|
+
"""Build the Responses API parameter schema for this agent tool.
|
|
705
|
+
|
|
706
|
+
Returns
|
|
707
|
+
-------
|
|
708
|
+
dict[str, Any]
|
|
709
|
+
JSON schema describing tool input parameters.
|
|
710
|
+
"""
|
|
711
|
+
if self._input_structure is not None:
|
|
712
|
+
return self._input_structure.get_schema()
|
|
713
|
+
return {
|
|
714
|
+
"type": "object",
|
|
715
|
+
"properties": {
|
|
716
|
+
"prompt": {"type": "string", "description": "Prompt text to run."}
|
|
717
|
+
},
|
|
718
|
+
"required": ["prompt"],
|
|
719
|
+
"additionalProperties": False,
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
@staticmethod
|
|
723
|
+
def _normalize_response_tools(tools: Optional[list]) -> Optional[list]:
|
|
724
|
+
"""Normalize tool definitions for the Responses API."""
|
|
725
|
+
if not tools:
|
|
726
|
+
return tools
|
|
727
|
+
|
|
728
|
+
normalized: list[Any] = []
|
|
729
|
+
for tool in tools:
|
|
730
|
+
if hasattr(tool, "to_dict") and callable(tool.to_dict):
|
|
731
|
+
normalized.append(tool.to_dict())
|
|
732
|
+
elif hasattr(tool, "to_openai_tool") and callable(tool.to_openai_tool):
|
|
733
|
+
normalized.append(tool.to_openai_tool())
|
|
734
|
+
elif hasattr(tool, "schema"):
|
|
735
|
+
normalized.append(tool.schema)
|
|
736
|
+
else:
|
|
737
|
+
normalized.append(tool)
|
|
738
|
+
return normalized
|
|
739
|
+
|
|
598
740
|
def __enter__(self) -> AgentBase:
|
|
599
741
|
"""Enter the context manager for resource management.
|
|
600
742
|
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/config.py
RENAMED
|
@@ -187,9 +187,8 @@ class AgentConfiguration(DataclassJSONSerializable):
|
|
|
187
187
|
input_guardrails: Optional[list[InputGuardrail]] = None
|
|
188
188
|
output_guardrails: Optional[list[OutputGuardrail]] = None
|
|
189
189
|
session: Optional[Session] = None
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
)
|
|
190
|
+
add_output_instructions: bool = False
|
|
191
|
+
add_web_search_tool: bool = False
|
|
193
192
|
|
|
194
193
|
def __post_init__(self) -> None:
|
|
195
194
|
"""Validate configuration invariants after initialization.
|
|
@@ -258,11 +257,16 @@ class AgentConfiguration(DataclassJSONSerializable):
|
|
|
258
257
|
str
|
|
259
258
|
Plain-text instructions, loading template files when necessary.
|
|
260
259
|
"""
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
260
|
+
resolved_instructions: str = resolve_instructions_from_path(self.instructions)
|
|
261
|
+
output_instructions = ""
|
|
262
|
+
if self.output_structure is not None and self.add_output_instructions:
|
|
263
|
+
output_instructions = self.output_structure.get_prompt(
|
|
264
|
+
add_enum_values=False
|
|
265
|
+
)
|
|
266
|
+
if output_instructions:
|
|
267
|
+
return f"{resolved_instructions}\n{output_instructions}"
|
|
268
|
+
|
|
269
|
+
return resolved_instructions
|
|
266
270
|
|
|
267
271
|
def _resolve_instructions(self) -> str:
|
|
268
272
|
"""Resolve instructions from string or file path."""
|
|
@@ -361,66 +365,37 @@ class AgentConfiguration(DataclassJSONSerializable):
|
|
|
361
365
|
|
|
362
366
|
return replace(self, **changes)
|
|
363
367
|
|
|
364
|
-
def
|
|
365
|
-
"""
|
|
366
|
-
|
|
367
|
-
Returns
|
|
368
|
-
-------
|
|
369
|
-
dict[str, Any]
|
|
370
|
-
Serialized configuration data without cached fields.
|
|
371
|
-
"""
|
|
372
|
-
data = DataclassJSONSerializable.to_json(self)
|
|
373
|
-
data.pop("_instructions_cache", None)
|
|
374
|
-
return data
|
|
375
|
-
|
|
376
|
-
@classmethod
|
|
377
|
-
def from_json(cls, data: dict[str, Any]) -> AgentConfiguration:
|
|
378
|
-
"""Create an AgentConfiguration from JSON data.
|
|
368
|
+
def to_response_config(self) -> Any:
|
|
369
|
+
"""Convert this AgentConfiguration to a ResponseConfiguration.
|
|
379
370
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
paths back to Path objects for proper file loading.
|
|
383
|
-
|
|
384
|
-
Parameters
|
|
385
|
-
----------
|
|
386
|
-
data : dict[str, Any]
|
|
387
|
-
Dictionary containing the configuration data.
|
|
371
|
+
This is a convenience method for creating a ResponseConfiguration
|
|
372
|
+
instance using the relevant fields from this agent configuration.
|
|
388
373
|
|
|
389
374
|
Returns
|
|
390
375
|
-------
|
|
391
|
-
|
|
392
|
-
New configuration instance.
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
376
|
+
ResponseConfiguration
|
|
377
|
+
New response configuration instance.
|
|
378
|
+
|
|
379
|
+
Examples
|
|
380
|
+
--------
|
|
381
|
+
>>> agent_config = AgentConfiguration(
|
|
382
|
+
... name="responder",
|
|
383
|
+
... model="gpt-4o-mini",
|
|
384
|
+
... instructions="Respond to user queries"
|
|
385
|
+
... )
|
|
386
|
+
>>> response_config = agent_config.to_response_config()
|
|
387
|
+
>>> response_config.name
|
|
388
|
+
'responder'
|
|
400
389
|
"""
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
# Check if it looks like a file path and the file exists
|
|
411
|
-
# This preserves the intended behavior for file-based instructions
|
|
412
|
-
try:
|
|
413
|
-
potential_path = Path(instructions_value)
|
|
414
|
-
# Only convert to Path if it's an existing file
|
|
415
|
-
# This way, plain text instructions stay as strings
|
|
416
|
-
if potential_path.exists() and potential_path.is_file():
|
|
417
|
-
data["instructions"] = potential_path
|
|
418
|
-
except (OSError, ValueError):
|
|
419
|
-
# If path parsing fails, keep it as a string (likely plain text)
|
|
420
|
-
pass
|
|
421
|
-
|
|
422
|
-
# Use the parent class method for the rest
|
|
423
|
-
return super(AgentConfiguration, cls).from_json(data)
|
|
390
|
+
from ..response.config import ResponseConfiguration
|
|
391
|
+
|
|
392
|
+
return ResponseConfiguration(
|
|
393
|
+
name=self.name,
|
|
394
|
+
instructions=self.instructions,
|
|
395
|
+
input_structure=self.input_structure,
|
|
396
|
+
output_structure=self.output_structure,
|
|
397
|
+
tools=self.tools,
|
|
398
|
+
)
|
|
424
399
|
|
|
425
400
|
|
|
426
401
|
# Global default registry instance
|
|
@@ -10,10 +10,10 @@ from .web import (
|
|
|
10
10
|
)
|
|
11
11
|
from .vector import (
|
|
12
12
|
MAX_CONCURRENT_SEARCHES as VECTOR_MAX_CONCURRENT_SEARCHES,
|
|
13
|
-
|
|
13
|
+
VectorAgentPlanner,
|
|
14
14
|
VectorSearchTool,
|
|
15
15
|
VectorSearchWriter,
|
|
16
|
-
|
|
16
|
+
VectorAgentSearch,
|
|
17
17
|
)
|
|
18
18
|
|
|
19
19
|
__all__ = [
|
|
@@ -26,8 +26,8 @@ __all__ = [
|
|
|
26
26
|
"WebAgentWriter",
|
|
27
27
|
"WebAgentSearch",
|
|
28
28
|
"VECTOR_MAX_CONCURRENT_SEARCHES",
|
|
29
|
-
"
|
|
29
|
+
"VectorAgentPlanner",
|
|
30
30
|
"VectorSearchTool",
|
|
31
31
|
"VectorSearchWriter",
|
|
32
|
-
"
|
|
32
|
+
"VectorAgentSearch",
|
|
33
33
|
]
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/search/vector.py
RENAMED
|
@@ -7,6 +7,7 @@ from typing import Any, Callable, Dict, List, Optional
|
|
|
7
7
|
|
|
8
8
|
from agents import custom_span, gen_trace_id, trace
|
|
9
9
|
|
|
10
|
+
from ...structure.prompt import PromptStructure
|
|
10
11
|
from ...structure.vector_search import (
|
|
11
12
|
VectorSearchItemStructure,
|
|
12
13
|
VectorSearchItemResultStructure,
|
|
@@ -15,6 +16,7 @@ from ...structure.vector_search import (
|
|
|
15
16
|
VectorSearchPlanStructure,
|
|
16
17
|
VectorSearchReportStructure,
|
|
17
18
|
)
|
|
19
|
+
from ...tools import tool_handler_factory
|
|
18
20
|
from ...vector_storage import VectorStorage
|
|
19
21
|
from ..config import AgentConfiguration
|
|
20
22
|
from ..utils import run_coroutine_agent_sync
|
|
@@ -23,7 +25,7 @@ from .base import SearchPlanner, SearchToolAgent, SearchWriter
|
|
|
23
25
|
MAX_CONCURRENT_SEARCHES = 10
|
|
24
26
|
|
|
25
27
|
|
|
26
|
-
class
|
|
28
|
+
class VectorAgentPlanner(SearchPlanner[VectorSearchPlanStructure]):
|
|
27
29
|
"""Plan vector searches to satisfy a user query.
|
|
28
30
|
|
|
29
31
|
Parameters
|
|
@@ -241,7 +243,7 @@ class VectorSearchWriter(SearchWriter[VectorSearchReportStructure]):
|
|
|
241
243
|
)
|
|
242
244
|
|
|
243
245
|
|
|
244
|
-
class
|
|
246
|
+
class VectorAgentSearch:
|
|
245
247
|
"""Manage the complete vector search workflow.
|
|
246
248
|
|
|
247
249
|
This high-level agent orchestrates a multi-step research process that plans
|
|
@@ -292,6 +294,8 @@ class VectorSearch:
|
|
|
292
294
|
Execute the research workflow asynchronously.
|
|
293
295
|
run_agent_sync(search_query)
|
|
294
296
|
Execute the research workflow synchronously.
|
|
297
|
+
as_response_tool(vector_store_name, tool_name, tool_description)
|
|
298
|
+
Build a Responses API tool definition and handler.
|
|
295
299
|
run_vector_agent(search_query)
|
|
296
300
|
Convenience asynchronous entry point for the workflow.
|
|
297
301
|
run_vector_agent_sync(search_query)
|
|
@@ -306,9 +310,9 @@ class VectorSearch:
|
|
|
306
310
|
def __init__(
|
|
307
311
|
self,
|
|
308
312
|
*,
|
|
313
|
+
vector_store_name: str,
|
|
309
314
|
prompt_dir: Optional[Path] = None,
|
|
310
315
|
default_model: Optional[str] = None,
|
|
311
|
-
vector_store_name: Optional[str] = None,
|
|
312
316
|
max_concurrent_searches: int = MAX_CONCURRENT_SEARCHES,
|
|
313
317
|
vector_storage: Optional[VectorStorage] = None,
|
|
314
318
|
vector_storage_factory: Optional[Callable[[str], VectorStorage]] = None,
|
|
@@ -336,7 +340,7 @@ class VectorSearch:
|
|
|
336
340
|
"""
|
|
337
341
|
trace_id = gen_trace_id()
|
|
338
342
|
with trace("VectorSearch trace", trace_id=trace_id):
|
|
339
|
-
planner =
|
|
343
|
+
planner = VectorAgentPlanner(
|
|
340
344
|
prompt_dir=self._prompt_dir, default_model=self._default_model
|
|
341
345
|
)
|
|
342
346
|
tool = VectorSearchTool(
|
|
@@ -383,45 +387,53 @@ class VectorSearch:
|
|
|
383
387
|
"""
|
|
384
388
|
return run_coroutine_agent_sync(self.run_agent(search_query))
|
|
385
389
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
390
|
+
def as_response_tool(
|
|
391
|
+
self,
|
|
392
|
+
*,
|
|
393
|
+
tool_name: str = "vector_search",
|
|
394
|
+
tool_description: str = "Run the vector search workflow.",
|
|
395
|
+
) -> tuple[dict[str, Callable[..., Any]], dict[str, Any]]:
|
|
396
|
+
"""Return a Responses API tool handler and definition.
|
|
389
397
|
|
|
390
398
|
Parameters
|
|
391
399
|
----------
|
|
392
|
-
|
|
393
|
-
|
|
400
|
+
vector_store_name : str
|
|
401
|
+
Name of the vector store to use for the response tool.
|
|
402
|
+
tool_name : str, default="vector_search"
|
|
403
|
+
Name to use for the response tool.
|
|
404
|
+
tool_description : str, default="Run the vector search workflow."
|
|
405
|
+
Description for the response tool.
|
|
394
406
|
|
|
395
407
|
Returns
|
|
396
408
|
-------
|
|
397
|
-
|
|
398
|
-
|
|
409
|
+
tuple[dict[str, Callable[..., Any]], dict[str, Any]]
|
|
410
|
+
Tool handler mapping and tool definition for Responses API usage.
|
|
399
411
|
"""
|
|
400
|
-
|
|
412
|
+
search = VectorAgentSearch(
|
|
413
|
+
prompt_dir=self._prompt_dir,
|
|
414
|
+
default_model=self._default_model,
|
|
415
|
+
vector_store_name=self._vector_store_name,
|
|
416
|
+
max_concurrent_searches=self._max_concurrent_searches,
|
|
417
|
+
vector_storage=self._vector_storage,
|
|
418
|
+
vector_storage_factory=self._vector_storage_factory,
|
|
419
|
+
)
|
|
401
420
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
"""Run :meth:`run_vector_agent` synchronously for ``search_query``.
|
|
421
|
+
def _run_search(prompt: str) -> VectorSearchStructure:
|
|
422
|
+
return run_coroutine_agent_sync(search.run_agent(search_query=prompt))
|
|
405
423
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
Returns
|
|
412
|
-
-------
|
|
413
|
-
VectorSearchStructure
|
|
414
|
-
Completed research output.
|
|
415
|
-
"""
|
|
416
|
-
return run_coroutine_agent_sync(
|
|
417
|
-
VectorSearch.run_vector_agent(search_query=search_query)
|
|
424
|
+
tool_handler = {
|
|
425
|
+
tool_name: tool_handler_factory(_run_search, input_model=PromptStructure)
|
|
426
|
+
}
|
|
427
|
+
tool_definition = PromptStructure.response_tool_definition(
|
|
428
|
+
tool_name, tool_description=tool_description
|
|
418
429
|
)
|
|
430
|
+
return tool_handler, tool_definition
|
|
419
431
|
|
|
420
432
|
|
|
421
433
|
__all__ = [
|
|
422
434
|
"MAX_CONCURRENT_SEARCHES",
|
|
423
|
-
"
|
|
435
|
+
"VectorAgentPlanner",
|
|
424
436
|
"VectorSearchTool",
|
|
425
437
|
"VectorSearchWriter",
|
|
426
|
-
"
|
|
438
|
+
"VectorAgentSearch",
|
|
427
439
|
]
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/search/web.py
RENAMED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Any, Dict, List, Optional, Union
|
|
6
|
+
from typing import Any, Callable, Dict, List, Optional, Union
|
|
7
7
|
|
|
8
8
|
from agents import custom_span, gen_trace_id, trace
|
|
9
9
|
from agents.model_settings import ModelSettings
|
|
10
10
|
from agents.tool import WebSearchTool
|
|
11
11
|
|
|
12
|
+
from ...structure.prompt import PromptStructure
|
|
12
13
|
from ...structure.web_search import (
|
|
13
14
|
WebSearchItemStructure,
|
|
14
15
|
WebSearchItemResultStructure,
|
|
@@ -16,6 +17,7 @@ from ...structure.web_search import (
|
|
|
16
17
|
WebSearchPlanStructure,
|
|
17
18
|
WebSearchReportStructure,
|
|
18
19
|
)
|
|
20
|
+
from ...tools import tool_handler_factory
|
|
19
21
|
from ..config import AgentConfiguration
|
|
20
22
|
from ..utils import run_coroutine_agent_sync
|
|
21
23
|
from .base import SearchPlanner, SearchToolAgent, SearchWriter
|
|
@@ -242,6 +244,8 @@ class WebAgentSearch:
|
|
|
242
244
|
Execute the research workflow asynchronously.
|
|
243
245
|
run_agent_sync(search_query)
|
|
244
246
|
Execute the research workflow synchronously.
|
|
247
|
+
as_response_tool(tool_name, tool_description)
|
|
248
|
+
Build a Responses API tool definition and handler.
|
|
245
249
|
run_web_agent_async(search_query)
|
|
246
250
|
Convenience asynchronous entry point for the workflow.
|
|
247
251
|
run_web_agent_sync(search_query)
|
|
@@ -301,7 +305,7 @@ class WebAgentSearch:
|
|
|
301
305
|
)
|
|
302
306
|
|
|
303
307
|
def run_agent_sync(self, search_query: str) -> WebSearchStructure:
|
|
304
|
-
"""
|
|
308
|
+
"""Execute the entire research workflow for ``search_query`` synchronously.
|
|
305
309
|
|
|
306
310
|
Parameters
|
|
307
311
|
----------
|
|
@@ -312,41 +316,41 @@ class WebAgentSearch:
|
|
|
312
316
|
-------
|
|
313
317
|
WebSearchStructure
|
|
314
318
|
Completed research output.
|
|
319
|
+
|
|
315
320
|
"""
|
|
316
321
|
return run_coroutine_agent_sync(self.run_agent_async(search_query))
|
|
317
322
|
|
|
318
|
-
|
|
319
|
-
|
|
323
|
+
def as_response_tool(
|
|
324
|
+
self,
|
|
325
|
+
*,
|
|
326
|
+
tool_name: str = "web_search",
|
|
327
|
+
tool_description: str = "Run the web search workflow.",
|
|
328
|
+
) -> tuple[dict[str, Callable[..., Any]], dict[str, Any]]:
|
|
329
|
+
"""Return a Responses API tool handler and definition.
|
|
320
330
|
|
|
321
331
|
Parameters
|
|
322
332
|
----------
|
|
323
|
-
|
|
324
|
-
|
|
333
|
+
tool_name : str, default="web_search"
|
|
334
|
+
Name to use for the response tool.
|
|
335
|
+
tool_description : str, default="Run the web search workflow."
|
|
336
|
+
Description for the response tool.
|
|
325
337
|
|
|
326
338
|
Returns
|
|
327
339
|
-------
|
|
328
|
-
|
|
329
|
-
|
|
340
|
+
tuple[dict[str, Callable[..., Any]], dict[str, Any]]
|
|
341
|
+
Tool handler mapping and tool definition for Responses API usage.
|
|
330
342
|
"""
|
|
331
|
-
return await self.run_agent_async(search_query=search_query)
|
|
332
343
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
"""Run :meth:`run_web_agent_async` synchronously for ``search_query``.
|
|
344
|
+
def _run_search(prompt: str) -> WebSearchStructure:
|
|
345
|
+
return run_coroutine_agent_sync(self.run_agent_async(search_query=prompt))
|
|
336
346
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
Returns
|
|
343
|
-
-------
|
|
344
|
-
WebSearchStructure
|
|
345
|
-
Completed research output.
|
|
346
|
-
"""
|
|
347
|
-
return run_coroutine_agent_sync(
|
|
348
|
-
WebAgentSearch().run_web_agent_async(search_query=search_query)
|
|
347
|
+
tool_handler = {
|
|
348
|
+
tool_name: tool_handler_factory(_run_search, input_model=PromptStructure)
|
|
349
|
+
}
|
|
350
|
+
tool_definition = PromptStructure.response_tool_definition(
|
|
351
|
+
tool_name, tool_description=tool_description
|
|
349
352
|
)
|
|
353
|
+
return tool_handler, tool_definition
|
|
350
354
|
|
|
351
355
|
|
|
352
356
|
__all__ = [
|
|
@@ -18,10 +18,15 @@ get_data_path(name)
|
|
|
18
18
|
|
|
19
19
|
from __future__ import annotations
|
|
20
20
|
|
|
21
|
+
import os
|
|
22
|
+
import os
|
|
21
23
|
from pathlib import Path
|
|
24
|
+
from dotenv import load_dotenv
|
|
25
|
+
|
|
22
26
|
|
|
23
27
|
from openai_sdk_helpers.utils import ensure_directory
|
|
24
28
|
|
|
29
|
+
load_dotenv()
|
|
25
30
|
DATETIME_FMT = "%Y%m%d_%H%M%S"
|
|
26
31
|
DEFAULT_MODEL = "gpt-4o-mini"
|
|
27
32
|
|
|
@@ -54,3 +59,20 @@ def get_data_path(name: str) -> Path:
|
|
|
54
59
|
base = Path(__file__).parent.parent.parent / "data"
|
|
55
60
|
path = base / name
|
|
56
61
|
return ensure_directory(path)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def get_model() -> str:
|
|
65
|
+
"""Return the default model identifier.
|
|
66
|
+
|
|
67
|
+
Returns
|
|
68
|
+
-------
|
|
69
|
+
str
|
|
70
|
+
Default OpenAI model identifier.
|
|
71
|
+
|
|
72
|
+
Examples
|
|
73
|
+
--------
|
|
74
|
+
>>> from openai_sdk_helpers.environment import _get_default_model
|
|
75
|
+
>>> _get_default_model()
|
|
76
|
+
'gpt-4o-mini'
|
|
77
|
+
"""
|
|
78
|
+
return os.getenv("DEFAULT_MODEL", DEFAULT_MODEL)
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/config.py
RENAMED
|
@@ -135,7 +135,7 @@ class ResponseConfiguration(DataclassJSONSerializable, Generic[TIn, TOut]):
|
|
|
135
135
|
input_structure: Optional[Type[TIn]]
|
|
136
136
|
output_structure: Optional[Type[TOut]]
|
|
137
137
|
system_vector_store: Optional[list[str]] = None
|
|
138
|
-
add_output_instructions: bool =
|
|
138
|
+
add_output_instructions: bool = False
|
|
139
139
|
add_web_search_tool: bool = False
|
|
140
140
|
|
|
141
141
|
def __post_init__(self) -> None:
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Planner response configuration."""
|
|
2
|
+
|
|
3
|
+
from ..structure.plan.plan import PlanStructure
|
|
4
|
+
from .config import ResponseConfiguration
|
|
5
|
+
|
|
6
|
+
PLANNER = ResponseConfiguration(
|
|
7
|
+
name="planner",
|
|
8
|
+
instructions="Generates structured prompts based on user input.",
|
|
9
|
+
tools=None,
|
|
10
|
+
input_structure=None,
|
|
11
|
+
output_structure=PlanStructure,
|
|
12
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Prompter response configuration."""
|
|
2
|
+
|
|
3
|
+
from .config import ResponseConfiguration
|
|
4
|
+
from ..structure.prompt import PromptStructure
|
|
5
|
+
|
|
6
|
+
PROMPTER = ResponseConfiguration(
|
|
7
|
+
name="prompter",
|
|
8
|
+
instructions="Generates structured prompts based on user input.",
|
|
9
|
+
tools=None,
|
|
10
|
+
input_structure=None,
|
|
11
|
+
output_structure=PromptStructure,
|
|
12
|
+
)
|
|
@@ -46,7 +46,7 @@ class StreamlitWebSearch(ResponseBase[WebSearchStructure]):
|
|
|
46
46
|
async def perform_search(tool) -> str:
|
|
47
47
|
"""Perform a web search and return structured results."""
|
|
48
48
|
structured_data = PromptStructure.from_tool_arguments(tool.arguments)
|
|
49
|
-
web_result = await WebAgentSearch(default_model=DEFAULT_MODEL).
|
|
49
|
+
web_result = await WebAgentSearch(default_model=DEFAULT_MODEL).run_agent_async(
|
|
50
50
|
structured_data.prompt
|
|
51
51
|
)
|
|
52
52
|
payload = coerce_jsonable(web_result)
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/json/ref.py
RENAMED
|
@@ -32,6 +32,7 @@ def get_module_qualname(obj: Any) -> tuple[str, str] | None:
|
|
|
32
32
|
... pass
|
|
33
33
|
>>> get_module_qualname(MyClass)
|
|
34
34
|
('__main__', 'MyClass')
|
|
35
|
+
|
|
35
36
|
"""
|
|
36
37
|
module = getattr(obj, "__module__", None)
|
|
37
38
|
qualname = getattr(obj, "__qualname__", None)
|
|
@@ -59,6 +60,7 @@ def encode_module_qualname(obj: Any) -> dict[str, Any] | None:
|
|
|
59
60
|
... pass
|
|
60
61
|
>>> encode_module_qualname(MyClass)
|
|
61
62
|
{'module': '__main__', 'qualname': 'MyClass'}
|
|
63
|
+
|
|
62
64
|
"""
|
|
63
65
|
result = get_module_qualname(obj)
|
|
64
66
|
if result is None:
|
|
@@ -85,6 +87,7 @@ def decode_module_qualname(ref: dict[str, Any]) -> Any | None:
|
|
|
85
87
|
>>> ref = {'module': 'pathlib', 'qualname': 'Path'}
|
|
86
88
|
>>> decode_module_qualname(ref)
|
|
87
89
|
<class 'pathlib.Path'>
|
|
90
|
+
|
|
88
91
|
"""
|
|
89
92
|
if not isinstance(ref, dict):
|
|
90
93
|
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/coordination.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/prompt_utils.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/runner.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/search/base.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/summarizer.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/translator.py
RENAMED
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/agent/validation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/context_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/enums/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/logging_config.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/prompt/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/prompt/summarizer.jinja
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/prompt/translator.jinja
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/prompt/validator.jinja
RENAMED
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/__init__.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/base.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/files.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/messages.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/runner.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/response/tool_call.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/streamlit_app/app.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/streamlit_app/config.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/base.py
RENAMED
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/plan/enum.py
RENAMED
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/plan/plan.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/plan/task.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/plan/types.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/prompt.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/responses.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/summary.py
RENAMED
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/validation.py
RENAMED
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/structure/web_search.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/__init__.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/async_utils.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/coercion.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/deprecation.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/encoding.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/instructions.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/json/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/json/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/path_utils.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/registry.py
RENAMED
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/utils/validation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openai_sdk_helpers-0.4.1 → openai_sdk_helpers-0.4.2}/src/openai_sdk_helpers/vector_storage/types.py
RENAMED
|
File without changes
|