openai-sdk-helpers 0.4.2__py3-none-any.whl → 0.5.0__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/__init__.py +45 -41
- openai_sdk_helpers/agent/__init__.py +4 -6
- openai_sdk_helpers/agent/base.py +110 -191
- openai_sdk_helpers/agent/{config.py → configuration.py} +24 -32
- openai_sdk_helpers/agent/{coordination.py → coordinator.py} +22 -23
- openai_sdk_helpers/agent/runner.py +3 -45
- openai_sdk_helpers/agent/search/base.py +54 -76
- openai_sdk_helpers/agent/search/vector.py +92 -108
- openai_sdk_helpers/agent/search/web.py +104 -82
- openai_sdk_helpers/agent/summarizer.py +22 -28
- openai_sdk_helpers/agent/translator.py +22 -24
- openai_sdk_helpers/agent/{validation.py → validator.py} +19 -23
- openai_sdk_helpers/cli.py +8 -22
- openai_sdk_helpers/environment.py +8 -13
- openai_sdk_helpers/errors.py +9 -0
- openai_sdk_helpers/extract/__init__.py +23 -0
- openai_sdk_helpers/extract/extractor.py +157 -0
- openai_sdk_helpers/extract/generator.py +476 -0
- openai_sdk_helpers/prompt/extractor_config_agent_instructions.jinja +6 -0
- openai_sdk_helpers/prompt/extractor_config_generator.jinja +37 -0
- openai_sdk_helpers/prompt/extractor_config_generator_instructions.jinja +9 -0
- openai_sdk_helpers/prompt/extractor_prompt_optimizer_agent_instructions.jinja +4 -0
- openai_sdk_helpers/prompt/extractor_prompt_optimizer_request.jinja +11 -0
- openai_sdk_helpers/prompt/vector_planner.jinja +7 -0
- openai_sdk_helpers/prompt/vector_search.jinja +6 -0
- openai_sdk_helpers/prompt/vector_writer.jinja +7 -0
- openai_sdk_helpers/response/__init__.py +3 -7
- openai_sdk_helpers/response/base.py +89 -98
- openai_sdk_helpers/response/{config.py → configuration.py} +45 -20
- openai_sdk_helpers/response/files.py +2 -0
- openai_sdk_helpers/response/planner.py +1 -1
- openai_sdk_helpers/response/prompter.py +1 -1
- openai_sdk_helpers/response/runner.py +1 -48
- openai_sdk_helpers/response/tool_call.py +0 -141
- openai_sdk_helpers/response/vector_store.py +8 -5
- openai_sdk_helpers/streamlit_app/__init__.py +1 -1
- openai_sdk_helpers/streamlit_app/app.py +17 -18
- openai_sdk_helpers/streamlit_app/{config.py → configuration.py} +13 -13
- openai_sdk_helpers/structure/__init__.py +16 -0
- openai_sdk_helpers/structure/base.py +239 -278
- openai_sdk_helpers/structure/extraction.py +1228 -0
- openai_sdk_helpers/structure/plan/plan.py +0 -20
- openai_sdk_helpers/structure/plan/task.py +0 -33
- openai_sdk_helpers/structure/prompt.py +16 -0
- openai_sdk_helpers/structure/responses.py +2 -2
- openai_sdk_helpers/structure/web_search.py +0 -10
- openai_sdk_helpers/tools.py +346 -99
- openai_sdk_helpers/types.py +3 -3
- openai_sdk_helpers/utils/__init__.py +9 -6
- openai_sdk_helpers/utils/json/base_model.py +316 -33
- openai_sdk_helpers/utils/json/data_class.py +1 -1
- openai_sdk_helpers/utils/langextract.py +194 -0
- openai_sdk_helpers/utils/registry.py +19 -15
- openai_sdk_helpers/vector_storage/storage.py +1 -1
- {openai_sdk_helpers-0.4.2.dist-info → openai_sdk_helpers-0.5.0.dist-info}/METADATA +25 -11
- openai_sdk_helpers-0.5.0.dist-info/RECORD +95 -0
- openai_sdk_helpers/agent/prompt_utils.py +0 -15
- openai_sdk_helpers/context_manager.py +0 -241
- openai_sdk_helpers/deprecation.py +0 -167
- openai_sdk_helpers/retry.py +0 -175
- openai_sdk_helpers/streamlit_app/streamlit_web_search.py +0 -75
- openai_sdk_helpers/utils/deprecation.py +0 -167
- openai_sdk_helpers-0.4.2.dist-info/RECORD +0 -88
- /openai_sdk_helpers/{logging_config.py → logging.py} +0 -0
- /openai_sdk_helpers/{config.py → settings.py} +0 -0
- {openai_sdk_helpers-0.4.2.dist-info → openai_sdk_helpers-0.5.0.dist-info}/WHEEL +0 -0
- {openai_sdk_helpers-0.4.2.dist-info → openai_sdk_helpers-0.5.0.dist-info}/entry_points.txt +0 -0
- {openai_sdk_helpers-0.4.2.dist-info → openai_sdk_helpers-0.5.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -57,26 +57,6 @@ class PlanStructure(StructureBase):
|
|
|
57
57
|
description="Ordered list of agent tasks to execute.",
|
|
58
58
|
)
|
|
59
59
|
|
|
60
|
-
def print(self) -> str:
|
|
61
|
-
"""Return a human-readable representation of the plan.
|
|
62
|
-
|
|
63
|
-
Returns
|
|
64
|
-
-------
|
|
65
|
-
str
|
|
66
|
-
Concatenated description of each task with task numbers.
|
|
67
|
-
|
|
68
|
-
Examples
|
|
69
|
-
--------
|
|
70
|
-
>>> plan = PlanStructure()
|
|
71
|
-
>>> plan.print()
|
|
72
|
-
'No tasks defined.'
|
|
73
|
-
"""
|
|
74
|
-
if not self.tasks:
|
|
75
|
-
return "No tasks defined."
|
|
76
|
-
return "\n\n".join(
|
|
77
|
-
[f"Task {idx + 1}:\n{task.print()}" for idx, task in enumerate(self.tasks)]
|
|
78
|
-
)
|
|
79
|
-
|
|
80
60
|
def __len__(self) -> int:
|
|
81
61
|
"""Return the number of tasks in the plan.
|
|
82
62
|
|
|
@@ -117,38 +117,5 @@ class TaskStructure(StructureBase):
|
|
|
117
117
|
return value
|
|
118
118
|
return AgentEnum(value)
|
|
119
119
|
|
|
120
|
-
def print(self) -> str:
|
|
121
|
-
"""Return a human-readable representation of the task.
|
|
122
|
-
|
|
123
|
-
Parameters
|
|
124
|
-
----------
|
|
125
|
-
None
|
|
126
|
-
|
|
127
|
-
Returns
|
|
128
|
-
-------
|
|
129
|
-
str
|
|
130
|
-
Multi-line description of the task metadata.
|
|
131
|
-
|
|
132
|
-
Raises
|
|
133
|
-
------
|
|
134
|
-
None
|
|
135
|
-
|
|
136
|
-
Examples
|
|
137
|
-
--------
|
|
138
|
-
>>> TaskStructure(prompt="Test").print()
|
|
139
|
-
'Task type: ...' # doctest: +SKIP
|
|
140
|
-
"""
|
|
141
|
-
return "\n".join(
|
|
142
|
-
[
|
|
143
|
-
StructureBase.format_output("Task type", value=self.task_type),
|
|
144
|
-
StructureBase.format_output("Prompt", value=self.prompt),
|
|
145
|
-
StructureBase.format_output("Context", value=self.context),
|
|
146
|
-
StructureBase.format_output("Status", value=self.status),
|
|
147
|
-
StructureBase.format_output("Start date", value=self.start_date),
|
|
148
|
-
StructureBase.format_output("End date", value=self.end_date),
|
|
149
|
-
StructureBase.format_output("Results", value=self.results),
|
|
150
|
-
]
|
|
151
|
-
)
|
|
152
|
-
|
|
153
120
|
|
|
154
121
|
__all__ = ["TaskStructure"]
|
|
@@ -41,3 +41,19 @@ class PromptStructure(StructureBase):
|
|
|
41
41
|
"Generate a summary of the latest news in AI.",
|
|
42
42
|
],
|
|
43
43
|
)
|
|
44
|
+
|
|
45
|
+
@staticmethod
|
|
46
|
+
def from_str(prompt_str: str) -> PromptStructure:
|
|
47
|
+
"""Create a PromptStructure instance from a simple string.
|
|
48
|
+
|
|
49
|
+
Parameters
|
|
50
|
+
----------
|
|
51
|
+
prompt_str : str
|
|
52
|
+
The prompt text to use for the OpenAI API request.
|
|
53
|
+
|
|
54
|
+
Returns
|
|
55
|
+
-------
|
|
56
|
+
PromptStructure
|
|
57
|
+
An instance of PromptStructure with the provided prompt text.
|
|
58
|
+
"""
|
|
59
|
+
return PromptStructure(prompt=prompt_str)
|
|
@@ -92,7 +92,7 @@ def assistant_format(structure: type[StructureBase]) -> dict:
|
|
|
92
92
|
def response_tool_definition(
|
|
93
93
|
structure: type[StructureBase],
|
|
94
94
|
tool_name: str,
|
|
95
|
-
tool_description: str,
|
|
95
|
+
tool_description: str | None,
|
|
96
96
|
) -> dict:
|
|
97
97
|
"""Build a tool definition for OpenAI chat completions.
|
|
98
98
|
|
|
@@ -105,7 +105,7 @@ def response_tool_definition(
|
|
|
105
105
|
Structure class that defines the tool schema.
|
|
106
106
|
tool_name : str
|
|
107
107
|
Name of the function tool.
|
|
108
|
-
tool_description : str
|
|
108
|
+
tool_description : str | None
|
|
109
109
|
Description of what the function tool does.
|
|
110
110
|
|
|
111
111
|
Returns
|
|
@@ -150,13 +150,3 @@ class WebSearchStructure(StructureBase):
|
|
|
150
150
|
"web_search_results"
|
|
151
151
|
)
|
|
152
152
|
web_search_report: WebSearchReportStructure = spec_field("web_search_report")
|
|
153
|
-
|
|
154
|
-
def print(self) -> str:
|
|
155
|
-
"""Return the markdown report.
|
|
156
|
-
|
|
157
|
-
Returns
|
|
158
|
-
-------
|
|
159
|
-
str
|
|
160
|
-
Markdown-formatted report from web search results.
|
|
161
|
-
"""
|
|
162
|
-
return self.web_search_report.markdown_report
|