openai-sdk-helpers 0.0.8__py3-none-any.whl → 0.1.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 +90 -2
- openai_sdk_helpers/agent/__init__.py +8 -4
- openai_sdk_helpers/agent/base.py +80 -45
- openai_sdk_helpers/agent/config.py +6 -4
- openai_sdk_helpers/agent/{project_manager.py → coordination.py} +29 -45
- openai_sdk_helpers/agent/prompt_utils.py +7 -1
- openai_sdk_helpers/agent/runner.py +67 -141
- openai_sdk_helpers/agent/search/__init__.py +33 -0
- openai_sdk_helpers/agent/search/base.py +297 -0
- openai_sdk_helpers/agent/{vector_search.py → search/vector.py} +89 -157
- openai_sdk_helpers/agent/{web_search.py → search/web.py} +77 -156
- openai_sdk_helpers/agent/summarizer.py +29 -8
- openai_sdk_helpers/agent/translator.py +40 -13
- openai_sdk_helpers/agent/validation.py +32 -8
- openai_sdk_helpers/async_utils.py +132 -0
- openai_sdk_helpers/config.py +101 -65
- openai_sdk_helpers/context_manager.py +241 -0
- openai_sdk_helpers/enums/__init__.py +9 -1
- openai_sdk_helpers/enums/base.py +67 -8
- openai_sdk_helpers/environment.py +33 -6
- openai_sdk_helpers/errors.py +133 -0
- openai_sdk_helpers/logging_config.py +105 -0
- openai_sdk_helpers/prompt/__init__.py +10 -71
- openai_sdk_helpers/prompt/base.py +222 -0
- openai_sdk_helpers/response/__init__.py +38 -3
- openai_sdk_helpers/response/base.py +363 -210
- openai_sdk_helpers/response/config.py +318 -0
- openai_sdk_helpers/response/messages.py +56 -40
- openai_sdk_helpers/response/runner.py +77 -33
- openai_sdk_helpers/response/tool_call.py +62 -27
- openai_sdk_helpers/response/vector_store.py +27 -14
- openai_sdk_helpers/retry.py +175 -0
- openai_sdk_helpers/streamlit_app/__init__.py +19 -2
- openai_sdk_helpers/streamlit_app/app.py +114 -39
- openai_sdk_helpers/streamlit_app/config.py +502 -0
- openai_sdk_helpers/streamlit_app/streamlit_web_search.py +5 -6
- openai_sdk_helpers/structure/__init__.py +72 -3
- openai_sdk_helpers/structure/agent_blueprint.py +82 -19
- openai_sdk_helpers/structure/base.py +208 -93
- openai_sdk_helpers/structure/plan/__init__.py +29 -1
- openai_sdk_helpers/structure/plan/enum.py +41 -5
- openai_sdk_helpers/structure/plan/helpers.py +172 -0
- openai_sdk_helpers/structure/plan/plan.py +109 -49
- openai_sdk_helpers/structure/plan/task.py +38 -6
- openai_sdk_helpers/structure/plan/types.py +15 -0
- openai_sdk_helpers/structure/prompt.py +21 -2
- openai_sdk_helpers/structure/responses.py +52 -11
- openai_sdk_helpers/structure/summary.py +55 -7
- openai_sdk_helpers/structure/validation.py +34 -6
- openai_sdk_helpers/structure/vector_search.py +132 -18
- openai_sdk_helpers/structure/web_search.py +125 -13
- openai_sdk_helpers/tools.py +193 -0
- openai_sdk_helpers/types.py +57 -0
- openai_sdk_helpers/utils/__init__.py +34 -1
- openai_sdk_helpers/utils/core.py +296 -34
- openai_sdk_helpers/validation.py +302 -0
- openai_sdk_helpers/vector_storage/__init__.py +21 -1
- openai_sdk_helpers/vector_storage/cleanup.py +25 -13
- openai_sdk_helpers/vector_storage/storage.py +123 -64
- openai_sdk_helpers/vector_storage/types.py +20 -19
- openai_sdk_helpers-0.1.0.dist-info/METADATA +550 -0
- openai_sdk_helpers-0.1.0.dist-info/RECORD +69 -0
- openai_sdk_helpers/streamlit_app/configuration.py +0 -324
- openai_sdk_helpers-0.0.8.dist-info/METADATA +0 -194
- openai_sdk_helpers-0.0.8.dist-info/RECORD +0 -55
- {openai_sdk_helpers-0.0.8.dist-info → openai_sdk_helpers-0.1.0.dist-info}/WHEEL +0 -0
- {openai_sdk_helpers-0.0.8.dist-info → openai_sdk_helpers-0.1.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,23 +1,63 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Agent design and planning structures.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This module provides structures for capturing agent requirements and
|
|
4
|
+
converting them into executable plans with validation and deployment steps.
|
|
5
|
+
"""
|
|
4
6
|
|
|
5
|
-
from
|
|
7
|
+
from __future__ import annotations
|
|
6
8
|
|
|
7
|
-
from .plan.enum import AgentEnum
|
|
8
9
|
from .base import BaseStructure, spec_field
|
|
9
|
-
from .plan import
|
|
10
|
+
from .plan import PlanStructure, TaskStructure
|
|
11
|
+
from .plan.enum import AgentEnum
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
class AgentBlueprint(BaseStructure):
|
|
13
|
-
"""Capture
|
|
15
|
+
"""Capture requirements for creating a new agent.
|
|
16
|
+
|
|
17
|
+
Defines the complete specification for an agent including mission,
|
|
18
|
+
capabilities, constraints, tools, data sources, and deployment plans.
|
|
19
|
+
Can be converted into an executable plan structure.
|
|
20
|
+
|
|
21
|
+
Attributes
|
|
22
|
+
----------
|
|
23
|
+
name : str
|
|
24
|
+
Name of the agent to build.
|
|
25
|
+
mission : str
|
|
26
|
+
Primary goal or charter for the agent.
|
|
27
|
+
capabilities : list[str]
|
|
28
|
+
Core skills the agent must perform.
|
|
29
|
+
constraints : list[str]
|
|
30
|
+
Boundaries, policies, or limits the agent must honor.
|
|
31
|
+
required_tools : list[str]
|
|
32
|
+
External tools the agent must integrate.
|
|
33
|
+
data_sources : list[str]
|
|
34
|
+
Data inputs that inform the agent's work.
|
|
35
|
+
evaluation_plan : list[str]
|
|
36
|
+
Checks, tests, or metrics that validate the agent.
|
|
37
|
+
rollout_plan : list[str]
|
|
38
|
+
Deployment or launch steps for the agent.
|
|
39
|
+
guardrails : list[str]
|
|
40
|
+
Safety rules and governance requirements.
|
|
41
|
+
notes : str or None
|
|
42
|
+
Additional context that informs the build.
|
|
14
43
|
|
|
15
44
|
Methods
|
|
16
45
|
-------
|
|
17
46
|
summary()
|
|
18
47
|
Return a human-readable overview of the blueprint.
|
|
19
48
|
build_plan()
|
|
20
|
-
Convert the blueprint into an ordered
|
|
49
|
+
Convert the blueprint into an ordered PlanStructure.
|
|
50
|
+
|
|
51
|
+
Examples
|
|
52
|
+
--------
|
|
53
|
+
>>> blueprint = AgentBlueprint(
|
|
54
|
+
... name="ResearchCoordinator",
|
|
55
|
+
... mission="Coordinate research sprint",
|
|
56
|
+
... capabilities=["search", "summarize"],
|
|
57
|
+
... constraints=["max 10 queries per run"]
|
|
58
|
+
... )
|
|
59
|
+
>>> print(blueprint.summary())
|
|
60
|
+
>>> plan = blueprint.build_plan()
|
|
21
61
|
"""
|
|
22
62
|
|
|
23
63
|
name: str = spec_field(
|
|
@@ -32,53 +72,64 @@ class AgentBlueprint(BaseStructure):
|
|
|
32
72
|
description="Primary goal or charter for the agent.",
|
|
33
73
|
examples=["Coordinate a research sprint", "Score model outputs"],
|
|
34
74
|
)
|
|
35
|
-
capabilities:
|
|
75
|
+
capabilities: list[str] = spec_field(
|
|
36
76
|
"capabilities",
|
|
37
77
|
default_factory=list,
|
|
38
78
|
description="Core skills the agent must perform.",
|
|
39
79
|
)
|
|
40
|
-
constraints:
|
|
80
|
+
constraints: list[str] = spec_field(
|
|
41
81
|
"constraints",
|
|
42
82
|
default_factory=list,
|
|
43
83
|
description="Boundaries, policies, or limits the agent must honor.",
|
|
44
84
|
)
|
|
45
|
-
required_tools:
|
|
85
|
+
required_tools: list[str] = spec_field(
|
|
46
86
|
"required_tools",
|
|
47
87
|
default_factory=list,
|
|
48
88
|
description="External tools the agent must integrate.",
|
|
49
89
|
)
|
|
50
|
-
data_sources:
|
|
90
|
+
data_sources: list[str] = spec_field(
|
|
51
91
|
"data_sources",
|
|
52
92
|
default_factory=list,
|
|
53
93
|
description="Data inputs that inform the agent's work.",
|
|
54
94
|
)
|
|
55
|
-
evaluation_plan:
|
|
95
|
+
evaluation_plan: list[str] = spec_field(
|
|
56
96
|
"evaluation_plan",
|
|
57
97
|
default_factory=list,
|
|
58
98
|
description="Checks, tests, or metrics that validate the agent.",
|
|
59
99
|
)
|
|
60
|
-
rollout_plan:
|
|
100
|
+
rollout_plan: list[str] = spec_field(
|
|
61
101
|
"rollout_plan",
|
|
62
102
|
default_factory=list,
|
|
63
103
|
description="Deployment or launch steps for the agent.",
|
|
64
104
|
)
|
|
65
|
-
guardrails:
|
|
105
|
+
guardrails: list[str] = spec_field(
|
|
66
106
|
"guardrails",
|
|
67
107
|
default_factory=list,
|
|
68
108
|
description="Safety rules and governance requirements.",
|
|
69
109
|
)
|
|
70
|
-
notes:
|
|
110
|
+
notes: str | None = spec_field(
|
|
71
111
|
"notes",
|
|
72
112
|
description="Additional context that informs the build.",
|
|
73
113
|
)
|
|
74
114
|
|
|
75
115
|
def summary(self) -> str:
|
|
76
|
-
"""Return a
|
|
116
|
+
"""Return a human-readable overview of the blueprint.
|
|
117
|
+
|
|
118
|
+
Formats all blueprint fields into a multi-line summary highlighting
|
|
119
|
+
key requirements and specifications.
|
|
77
120
|
|
|
78
121
|
Returns
|
|
79
122
|
-------
|
|
80
123
|
str
|
|
81
|
-
|
|
124
|
+
Multi-line formatted description of blueprint fields.
|
|
125
|
+
|
|
126
|
+
Examples
|
|
127
|
+
--------
|
|
128
|
+
>>> print(blueprint.summary())
|
|
129
|
+
Agent name: ResearchCoordinator
|
|
130
|
+
Mission: Coordinate research sprint
|
|
131
|
+
Capabilities: search, summarize
|
|
132
|
+
...
|
|
82
133
|
"""
|
|
83
134
|
|
|
84
135
|
def _format(label: str, values: list[str]) -> str:
|
|
@@ -101,12 +152,24 @@ class AgentBlueprint(BaseStructure):
|
|
|
101
152
|
return "\n".join(lines)
|
|
102
153
|
|
|
103
154
|
def build_plan(self) -> PlanStructure:
|
|
104
|
-
"""Translate the blueprint into a structured
|
|
155
|
+
"""Translate the blueprint into a structured execution plan.
|
|
156
|
+
|
|
157
|
+
Converts the agent requirements into an ordered sequence of tasks
|
|
158
|
+
representing the complete build lifecycle: planning, design,
|
|
159
|
+
implementation, validation, evaluation, and deployment.
|
|
105
160
|
|
|
106
161
|
Returns
|
|
107
162
|
-------
|
|
108
163
|
PlanStructure
|
|
109
|
-
Ordered list of tasks
|
|
164
|
+
Ordered list of tasks with agent types and prompts.
|
|
165
|
+
|
|
166
|
+
Examples
|
|
167
|
+
--------
|
|
168
|
+
>>> plan = blueprint.build_plan()
|
|
169
|
+
>>> len(plan.tasks)
|
|
170
|
+
6
|
|
171
|
+
>>> plan.tasks[0].task_type
|
|
172
|
+
<AgentEnum.PLANNER: 'MetaPlanner'>
|
|
110
173
|
"""
|
|
111
174
|
tasks = [
|
|
112
175
|
TaskStructure(
|