openai-sdk-helpers 0.0.5__py3-none-any.whl → 0.0.7__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 +62 -0
- openai_sdk_helpers/agent/__init__.py +31 -0
- openai_sdk_helpers/agent/base.py +330 -0
- openai_sdk_helpers/agent/config.py +66 -0
- openai_sdk_helpers/agent/project_manager.py +511 -0
- openai_sdk_helpers/agent/prompt_utils.py +9 -0
- openai_sdk_helpers/agent/runner.py +215 -0
- openai_sdk_helpers/agent/summarizer.py +85 -0
- openai_sdk_helpers/agent/translator.py +139 -0
- openai_sdk_helpers/agent/utils.py +47 -0
- openai_sdk_helpers/agent/validation.py +97 -0
- openai_sdk_helpers/agent/vector_search.py +462 -0
- openai_sdk_helpers/agent/web_search.py +404 -0
- openai_sdk_helpers/config.py +199 -0
- openai_sdk_helpers/enums/__init__.py +7 -0
- openai_sdk_helpers/enums/base.py +29 -0
- openai_sdk_helpers/environment.py +27 -0
- openai_sdk_helpers/prompt/__init__.py +77 -0
- openai_sdk_helpers/py.typed +0 -0
- openai_sdk_helpers/response/__init__.py +20 -0
- openai_sdk_helpers/response/base.py +505 -0
- openai_sdk_helpers/response/messages.py +211 -0
- openai_sdk_helpers/response/runner.py +104 -0
- openai_sdk_helpers/response/tool_call.py +70 -0
- openai_sdk_helpers/response/vector_store.py +84 -0
- openai_sdk_helpers/structure/__init__.py +43 -0
- openai_sdk_helpers/structure/agent_blueprint.py +224 -0
- openai_sdk_helpers/structure/base.py +713 -0
- openai_sdk_helpers/structure/plan/__init__.py +13 -0
- openai_sdk_helpers/structure/plan/enum.py +64 -0
- openai_sdk_helpers/structure/plan/plan.py +253 -0
- openai_sdk_helpers/structure/plan/task.py +122 -0
- openai_sdk_helpers/structure/prompt.py +24 -0
- openai_sdk_helpers/structure/responses.py +132 -0
- openai_sdk_helpers/structure/summary.py +65 -0
- openai_sdk_helpers/structure/validation.py +47 -0
- openai_sdk_helpers/structure/vector_search.py +86 -0
- openai_sdk_helpers/structure/web_search.py +46 -0
- openai_sdk_helpers/utils/__init__.py +25 -0
- openai_sdk_helpers/utils/core.py +300 -0
- openai_sdk_helpers/vector_storage/__init__.py +15 -0
- openai_sdk_helpers/vector_storage/cleanup.py +91 -0
- openai_sdk_helpers/vector_storage/storage.py +564 -0
- openai_sdk_helpers/vector_storage/types.py +58 -0
- {openai_sdk_helpers-0.0.5.dist-info → openai_sdk_helpers-0.0.7.dist-info}/METADATA +6 -3
- openai_sdk_helpers-0.0.7.dist-info/RECORD +51 -0
- openai_sdk_helpers-0.0.5.dist-info/RECORD +0 -7
- {openai_sdk_helpers-0.0.5.dist-info → openai_sdk_helpers-0.0.7.dist-info}/WHEEL +0 -0
- {openai_sdk_helpers-0.0.5.dist-info → openai_sdk_helpers-0.0.7.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"""Structures for designing and planning new agents."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import List, Optional
|
|
6
|
+
|
|
7
|
+
from .plan.enum import AgentEnum
|
|
8
|
+
from .base import BaseStructure, spec_field
|
|
9
|
+
from .plan import TaskStructure, PlanStructure
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AgentBlueprint(BaseStructure):
|
|
13
|
+
"""Capture the core requirements for creating a new agent.
|
|
14
|
+
|
|
15
|
+
Methods
|
|
16
|
+
-------
|
|
17
|
+
summary()
|
|
18
|
+
Return a human-readable overview of the blueprint.
|
|
19
|
+
build_plan()
|
|
20
|
+
Convert the blueprint into an ordered ``PlanStructure``.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
name: str = spec_field(
|
|
24
|
+
"name",
|
|
25
|
+
allow_null=False,
|
|
26
|
+
description="Name of the agent to build.",
|
|
27
|
+
examples=["ResearchCoordinator", "EvaluationRouter"],
|
|
28
|
+
)
|
|
29
|
+
mission: str = spec_field(
|
|
30
|
+
"mission",
|
|
31
|
+
allow_null=False,
|
|
32
|
+
description="Primary goal or charter for the agent.",
|
|
33
|
+
examples=["Coordinate a research sprint", "Score model outputs"],
|
|
34
|
+
)
|
|
35
|
+
capabilities: List[str] = spec_field(
|
|
36
|
+
"capabilities",
|
|
37
|
+
default_factory=list,
|
|
38
|
+
description="Core skills the agent must perform.",
|
|
39
|
+
)
|
|
40
|
+
constraints: List[str] = spec_field(
|
|
41
|
+
"constraints",
|
|
42
|
+
default_factory=list,
|
|
43
|
+
description="Boundaries, policies, or limits the agent must honor.",
|
|
44
|
+
)
|
|
45
|
+
required_tools: List[str] = spec_field(
|
|
46
|
+
"required_tools",
|
|
47
|
+
default_factory=list,
|
|
48
|
+
description="External tools the agent must integrate.",
|
|
49
|
+
)
|
|
50
|
+
data_sources: List[str] = spec_field(
|
|
51
|
+
"data_sources",
|
|
52
|
+
default_factory=list,
|
|
53
|
+
description="Data inputs that inform the agent's work.",
|
|
54
|
+
)
|
|
55
|
+
evaluation_plan: List[str] = spec_field(
|
|
56
|
+
"evaluation_plan",
|
|
57
|
+
default_factory=list,
|
|
58
|
+
description="Checks, tests, or metrics that validate the agent.",
|
|
59
|
+
)
|
|
60
|
+
rollout_plan: List[str] = spec_field(
|
|
61
|
+
"rollout_plan",
|
|
62
|
+
default_factory=list,
|
|
63
|
+
description="Deployment or launch steps for the agent.",
|
|
64
|
+
)
|
|
65
|
+
guardrails: List[str] = spec_field(
|
|
66
|
+
"guardrails",
|
|
67
|
+
default_factory=list,
|
|
68
|
+
description="Safety rules and governance requirements.",
|
|
69
|
+
)
|
|
70
|
+
notes: Optional[str] = spec_field(
|
|
71
|
+
"notes",
|
|
72
|
+
description="Additional context that informs the build.",
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
def summary(self) -> str:
|
|
76
|
+
"""Return a multi-line summary highlighting key requirements.
|
|
77
|
+
|
|
78
|
+
Returns
|
|
79
|
+
-------
|
|
80
|
+
str
|
|
81
|
+
Human-readable description of the blueprint fields.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
def _format(label: str, values: list[str]) -> str:
|
|
85
|
+
return f"{label}: " + (", ".join(values) if values else "None")
|
|
86
|
+
|
|
87
|
+
lines = [
|
|
88
|
+
f"Agent name: {self.name}",
|
|
89
|
+
f"Mission: {self.mission}",
|
|
90
|
+
_format("Capabilities", self.capabilities),
|
|
91
|
+
_format("Constraints", self.constraints),
|
|
92
|
+
_format("Required tools", self.required_tools),
|
|
93
|
+
_format("Data sources", self.data_sources),
|
|
94
|
+
_format("Guardrails", self.guardrails),
|
|
95
|
+
_format("Evaluation", self.evaluation_plan),
|
|
96
|
+
_format("Rollout", self.rollout_plan),
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
if self.notes:
|
|
100
|
+
lines.append(f"Notes: {self.notes}")
|
|
101
|
+
return "\n".join(lines)
|
|
102
|
+
|
|
103
|
+
def build_plan(self) -> PlanStructure:
|
|
104
|
+
"""Translate the blueprint into a structured plan of execution steps.
|
|
105
|
+
|
|
106
|
+
Returns
|
|
107
|
+
-------
|
|
108
|
+
PlanStructure
|
|
109
|
+
Ordered list of tasks representing the build lifecycle.
|
|
110
|
+
"""
|
|
111
|
+
tasks = [
|
|
112
|
+
TaskStructure(
|
|
113
|
+
task_type=AgentEnum.PLANNER,
|
|
114
|
+
prompt=self._scope_prompt(),
|
|
115
|
+
context=self.constraints,
|
|
116
|
+
),
|
|
117
|
+
TaskStructure(
|
|
118
|
+
task_type=AgentEnum.DESIGNER,
|
|
119
|
+
prompt=self._design_prompt(),
|
|
120
|
+
context=self.required_tools + self.data_sources,
|
|
121
|
+
),
|
|
122
|
+
TaskStructure(
|
|
123
|
+
task_type=AgentEnum.BUILDER,
|
|
124
|
+
prompt=self._synthesis_prompt(),
|
|
125
|
+
context=self.capabilities,
|
|
126
|
+
),
|
|
127
|
+
TaskStructure(
|
|
128
|
+
task_type=AgentEnum.VALIDATOR,
|
|
129
|
+
prompt=self._validation_prompt(),
|
|
130
|
+
context=self.guardrails,
|
|
131
|
+
),
|
|
132
|
+
TaskStructure(
|
|
133
|
+
task_type=AgentEnum.EVALUATOR,
|
|
134
|
+
prompt=self._evaluation_prompt(),
|
|
135
|
+
context=self.evaluation_plan,
|
|
136
|
+
),
|
|
137
|
+
TaskStructure(
|
|
138
|
+
task_type=AgentEnum.RELEASE_MANAGER,
|
|
139
|
+
prompt=self._deployment_prompt(),
|
|
140
|
+
context=self.rollout_plan,
|
|
141
|
+
),
|
|
142
|
+
]
|
|
143
|
+
plan = PlanStructure(tasks=tasks)
|
|
144
|
+
return plan
|
|
145
|
+
|
|
146
|
+
def _scope_prompt(self) -> str:
|
|
147
|
+
"""Return a scoping prompt based on mission, constraints, and guardrails."""
|
|
148
|
+
return "\n".join(
|
|
149
|
+
[
|
|
150
|
+
f"Mission: {self.mission}",
|
|
151
|
+
self._bullet_block("Guardrails", self.guardrails),
|
|
152
|
+
self._bullet_block("Constraints", self.constraints),
|
|
153
|
+
]
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
def _design_prompt(self) -> str:
|
|
157
|
+
"""Return a design prompt covering tools, data, and capabilities."""
|
|
158
|
+
return "\n".join(
|
|
159
|
+
[
|
|
160
|
+
self._bullet_block("Capabilities", self.capabilities),
|
|
161
|
+
self._bullet_block("Required tools", self.required_tools),
|
|
162
|
+
self._bullet_block("Data sources", self.data_sources),
|
|
163
|
+
]
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
def _synthesis_prompt(self) -> str:
|
|
167
|
+
"""Return a build prompt focused on interfaces and prompts."""
|
|
168
|
+
return "\n".join(
|
|
169
|
+
[
|
|
170
|
+
"Design system and developer prompts that cover:",
|
|
171
|
+
self._bullet_block("Mission", [self.mission]),
|
|
172
|
+
self._bullet_block(
|
|
173
|
+
"Capabilities to implement",
|
|
174
|
+
self.capabilities or ["Draft standard handlers"],
|
|
175
|
+
),
|
|
176
|
+
]
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
def _validation_prompt(self) -> str:
|
|
180
|
+
"""Return a prompt instructing validation of guardrails and behaviors."""
|
|
181
|
+
return "\n".join(
|
|
182
|
+
[
|
|
183
|
+
"Create automated validation for:",
|
|
184
|
+
self._bullet_block("Guardrails", self.guardrails),
|
|
185
|
+
self._bullet_block("Constraints", self.constraints),
|
|
186
|
+
]
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
def _evaluation_prompt(self) -> str:
|
|
190
|
+
"""Return an evaluation prompt emphasizing tests and metrics."""
|
|
191
|
+
return "\n".join(
|
|
192
|
+
[
|
|
193
|
+
"Run evaluation and red-team scenarios using:",
|
|
194
|
+
self._bullet_block("Evaluation plan", self.evaluation_plan),
|
|
195
|
+
self._bullet_block("Capabilities", self.capabilities),
|
|
196
|
+
]
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
def _deployment_prompt(self) -> str:
|
|
200
|
+
"""Return a deployment prompt capturing rollout and monitoring."""
|
|
201
|
+
return "\n".join(
|
|
202
|
+
[
|
|
203
|
+
self._bullet_block("Rollout steps", self.rollout_plan),
|
|
204
|
+
self._bullet_block(
|
|
205
|
+
"Launch checklist",
|
|
206
|
+
[
|
|
207
|
+
"Observability hooks enabled",
|
|
208
|
+
"Runbook prepared",
|
|
209
|
+
"Rollback and kill switches validated",
|
|
210
|
+
],
|
|
211
|
+
),
|
|
212
|
+
]
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
@staticmethod
|
|
216
|
+
def _bullet_block(label: str, items: list[str]) -> str:
|
|
217
|
+
"""Return a labeled bullet block for use in prompts."""
|
|
218
|
+
if not items:
|
|
219
|
+
return f"{label}: None"
|
|
220
|
+
bullets = "\n".join(f"- {item}" for item in items)
|
|
221
|
+
return f"{label}:\n{bullets}"
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
__all__ = ["AgentBlueprint"]
|