openai-sdk-helpers 0.0.7__py3-none-any.whl → 0.0.9__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.
Files changed (63) hide show
  1. openai_sdk_helpers/__init__.py +85 -10
  2. openai_sdk_helpers/agent/__init__.py +8 -4
  3. openai_sdk_helpers/agent/base.py +81 -46
  4. openai_sdk_helpers/agent/config.py +6 -4
  5. openai_sdk_helpers/agent/{project_manager.py → coordination.py} +29 -45
  6. openai_sdk_helpers/agent/prompt_utils.py +7 -1
  7. openai_sdk_helpers/agent/runner.py +67 -141
  8. openai_sdk_helpers/agent/search/__init__.py +33 -0
  9. openai_sdk_helpers/agent/search/base.py +297 -0
  10. openai_sdk_helpers/agent/{vector_search.py → search/vector.py} +89 -157
  11. openai_sdk_helpers/agent/{web_search.py → search/web.py} +82 -162
  12. openai_sdk_helpers/agent/summarizer.py +29 -8
  13. openai_sdk_helpers/agent/translator.py +40 -13
  14. openai_sdk_helpers/agent/validation.py +32 -8
  15. openai_sdk_helpers/async_utils.py +132 -0
  16. openai_sdk_helpers/config.py +74 -36
  17. openai_sdk_helpers/context_manager.py +241 -0
  18. openai_sdk_helpers/enums/__init__.py +9 -1
  19. openai_sdk_helpers/enums/base.py +67 -8
  20. openai_sdk_helpers/environment.py +33 -6
  21. openai_sdk_helpers/errors.py +133 -0
  22. openai_sdk_helpers/logging_config.py +105 -0
  23. openai_sdk_helpers/prompt/__init__.py +10 -71
  24. openai_sdk_helpers/prompt/base.py +172 -0
  25. openai_sdk_helpers/response/__init__.py +37 -5
  26. openai_sdk_helpers/response/base.py +427 -189
  27. openai_sdk_helpers/response/config.py +176 -0
  28. openai_sdk_helpers/response/messages.py +104 -40
  29. openai_sdk_helpers/response/runner.py +79 -35
  30. openai_sdk_helpers/response/tool_call.py +75 -12
  31. openai_sdk_helpers/response/vector_store.py +29 -16
  32. openai_sdk_helpers/retry.py +175 -0
  33. openai_sdk_helpers/streamlit_app/__init__.py +30 -0
  34. openai_sdk_helpers/streamlit_app/app.py +345 -0
  35. openai_sdk_helpers/streamlit_app/config.py +502 -0
  36. openai_sdk_helpers/streamlit_app/streamlit_web_search.py +68 -0
  37. openai_sdk_helpers/structure/__init__.py +69 -3
  38. openai_sdk_helpers/structure/agent_blueprint.py +82 -19
  39. openai_sdk_helpers/structure/base.py +245 -91
  40. openai_sdk_helpers/structure/plan/__init__.py +15 -1
  41. openai_sdk_helpers/structure/plan/enum.py +41 -5
  42. openai_sdk_helpers/structure/plan/plan.py +101 -45
  43. openai_sdk_helpers/structure/plan/task.py +38 -6
  44. openai_sdk_helpers/structure/prompt.py +21 -2
  45. openai_sdk_helpers/structure/responses.py +52 -11
  46. openai_sdk_helpers/structure/summary.py +55 -7
  47. openai_sdk_helpers/structure/validation.py +34 -6
  48. openai_sdk_helpers/structure/vector_search.py +132 -18
  49. openai_sdk_helpers/structure/web_search.py +128 -12
  50. openai_sdk_helpers/types.py +57 -0
  51. openai_sdk_helpers/utils/__init__.py +32 -1
  52. openai_sdk_helpers/utils/core.py +200 -32
  53. openai_sdk_helpers/validation.py +302 -0
  54. openai_sdk_helpers/vector_storage/__init__.py +21 -1
  55. openai_sdk_helpers/vector_storage/cleanup.py +25 -13
  56. openai_sdk_helpers/vector_storage/storage.py +124 -66
  57. openai_sdk_helpers/vector_storage/types.py +20 -19
  58. openai_sdk_helpers-0.0.9.dist-info/METADATA +550 -0
  59. openai_sdk_helpers-0.0.9.dist-info/RECORD +66 -0
  60. openai_sdk_helpers-0.0.7.dist-info/METADATA +0 -193
  61. openai_sdk_helpers-0.0.7.dist-info/RECORD +0 -51
  62. {openai_sdk_helpers-0.0.7.dist-info → openai_sdk_helpers-0.0.9.dist-info}/WHEEL +0 -0
  63. {openai_sdk_helpers-0.0.7.dist-info → openai_sdk_helpers-0.0.9.dist-info}/licenses/LICENSE +0 -0
@@ -1,193 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: openai-sdk-helpers
3
- Version: 0.0.7
4
- Summary: Composable helpers for OpenAI SDK agents, prompts, and storage
5
- Author: openai-sdk-helpers maintainers
6
- License: MIT
7
- License-File: LICENSE
8
- Requires-Python: >=3.10
9
- Requires-Dist: jinja2
10
- Requires-Dist: openai
11
- Requires-Dist: openai-agents
12
- Requires-Dist: pydantic<3,>=2.7
13
- Requires-Dist: python-dotenv
14
- Requires-Dist: typing-extensions<5,>=4.15.0
15
- Description-Content-Type: text/markdown
16
-
17
- <div align="center">
18
-
19
- # openai-sdk-helpers
20
-
21
- Shared primitives for composing OpenAI agent workflows: structures, response
22
- handling, prompt rendering, and reusable agent factories.
23
-
24
- </div>
25
-
26
- ## Overview
27
-
28
- `openai-sdk-helpers` packages the common building blocks required to assemble agent-driven
29
- applications. The library intentionally focuses on reusable primitives—data
30
- structures, configuration helpers, and orchestration utilities—while leaving
31
- application-specific prompts and tools to the consuming project.
32
-
33
- ### Features
34
-
35
- - **Agent wrappers** for OpenAI Agents SDK with synchronous and asynchronous
36
- entry points.
37
- - **Prompt rendering** powered by Jinja for dynamic agent instructions.
38
- - **Typed structures** for prompts, responses, and search workflows to ensure
39
- predictable inputs and outputs.
40
- - **Vector and web search flows** that coordinate planning, execution, and
41
- reporting.
42
- - **Reusable text agents** for summarization and translation tasks.
43
-
44
- ## Installation
45
-
46
- Install the package directly from PyPI to reuse it across projects:
47
-
48
- ```bash
49
- pip install openai-sdk-helpers
50
- ```
51
-
52
- Type information ships with the published wheel via `py.typed`, so external
53
- projects can rely on the bundled annotations without adding custom stubs.
54
-
55
- For local development, install with editable sources and the optional dev
56
- dependencies:
57
-
58
- ```bash
59
- pip install -e .
60
- pip install -e . --group dev
61
- ```
62
-
63
- ## Quickstart
64
-
65
- Create a basic vector search workflow by wiring your own prompt templates and
66
- preferred model configuration:
67
-
68
- ```python
69
- from pathlib import Path
70
-
71
- from openai_sdk_helpers.agent.vector_search import VectorSearch
72
-
73
-
74
- prompts = Path("./prompts")
75
- vector_search = VectorSearch(prompt_dir=prompts, default_model="gpt-4o-mini")
76
-
77
- report = vector_search.run_agent_sync("Explain quantum entanglement for beginners")
78
- print(report.report)
79
- ```
80
-
81
- ### Text utilities
82
-
83
- Use the built-in text helpers when you need lightweight single-step agents.
84
-
85
- ```python
86
- from openai_sdk_helpers.agent import (
87
- SummarizerAgent,
88
- TranslatorAgent,
89
- ValidatorAgent,
90
- )
91
-
92
-
93
- summarizer = SummarizerAgent(default_model="gpt-4o-mini")
94
- translator = TranslatorAgent(default_model="gpt-4o-mini")
95
- validator = ValidatorAgent(default_model="gpt-4o-mini")
96
-
97
- summary = summarizer.run_sync("Long-form content to condense")
98
- translation = translator.run_sync("Bonjour", target_language="English")
99
- guardrails = validator.run_sync(
100
- "Share meeting notes with names removed", agent_output=summary.text
101
- )
102
- ```
103
-
104
- Prompt templates are optional for the built-in text helpers. They already ship
105
- with defaults under `src/openai_sdk_helpers/prompt`, so you do **not** need to
106
- create placeholder files when installing from PyPI. Only pass a `prompt_dir`
107
- when you have real replacements you want to load.
108
-
109
- The vector search workflow expects real prompts for each agent (for example,
110
- `vector_planner.jinja`, `vector_search.jinja`, and `vector_writer.jinja`). If
111
- you point `prompt_dir` at a folder that does not contain those files, agent
112
- construction fails with a `FileNotFoundError`. Skip `prompt_dir` entirely unless
113
- you have working templates ready.
114
-
115
- ### Centralized OpenAI configuration
116
-
117
- `openai-sdk-helpers` ships with a lightweight `OpenAISettings` helper so projects can share
118
- consistent authentication, routing, and model defaults when using the OpenAI
119
- SDK:
120
-
121
- ```python
122
- from openai_sdk_helpers import OpenAISettings
123
-
124
-
125
- # Load from environment variables or a local .env file
126
- settings = OpenAISettings.from_env()
127
- client = settings.create_client()
128
-
129
- # Reuse the default model across agents
130
- vector_search = VectorSearch(
131
- prompt_dir=prompts, default_model=settings.default_model or "gpt-4o-mini"
132
- )
133
- ```
134
-
135
- The helper reads `OPENAI_API_KEY`, `OPENAI_ORG_ID`, `OPENAI_PROJECT_ID`,
136
- `OPENAI_BASE_URL`, `OPENAI_MODEL`, `OPENAI_TIMEOUT`, and `OPENAI_MAX_RETRIES` by
137
- default but supports overrides for custom deployments. Pass uncommon OpenAI
138
- client keyword arguments (such as `default_headers`, `http_client`, or
139
- `base_url` proxies) through `extra_client_kwargs` when instantiating
140
- `OpenAISettings`.
141
-
142
- ## Development
143
-
144
- The repository is configured for a lightweight Python development workflow.
145
- Before opening a pull request, format and validate your changes locally:
146
-
147
- ```bash
148
- # Style and formatting
149
- pydocstyle src
150
- black --check .
151
-
152
- # Static type checking
153
- pyright src
154
-
155
- # Unit tests with coverage
156
- pytest -q --cov=src --cov-report=term-missing --cov-fail-under=70
157
- ```
158
-
159
- ## Project Structure
160
-
161
- - `src/openai_sdk_helpers/agent`: Agent factories, orchestration helpers, and search
162
- workflows.
163
- - `src/openai_sdk_helpers/prompt`: Prompt rendering utilities backed by Jinja.
164
- - `src/openai_sdk_helpers/response`: Response parsing and transformation helpers.
165
- - `src/openai_sdk_helpers/structure`: Typed data structures shared across workflows.
166
- - `src/openai_sdk_helpers/vector_storage`: Minimal vector store abstraction.
167
- - `tests/`: Unit tests covering core modules and structures.
168
-
169
- ## Key modules
170
-
171
- The package centers around a handful of cohesive building blocks:
172
-
173
- - `openai_sdk_helpers.agent.project_manager.ProjectManager` coordinates prompt
174
- creation, plan building, task execution, and summarization while persisting
175
- intermediate artifacts to disk.
176
- - `openai_sdk_helpers.agent.vector_search.VectorSearch` bundles the planners,
177
- executors, and summarizers required to run a multi-turn vector search flow
178
- from a single entry point.
179
- - `openai_sdk_helpers.agent.summarizer.SummarizerAgent`,
180
- `agent.translator.TranslatorAgent`, and `agent.validator.ValidatorAgent`
181
- expose streamlined text-processing utilities that reuse shared prompt
182
- templates.
183
- - `openai_sdk_helpers.response` contains the response runners and helpers used
184
- to normalize outputs from agents, including streaming responses.
185
- - `openai_sdk_helpers.utils` holds JSON serialization helpers, logging
186
- utilities, and common validation helpers used across modules.
187
-
188
- ## Contributing
189
-
190
- Contributions are welcome! Please accompany functional changes with relevant
191
- tests and ensure all quality gates pass. Follow the NumPy-style docstring
192
- conventions outlined in `AGENTS.md` to keep the codebase consistent.
193
-
@@ -1,51 +0,0 @@
1
- openai_sdk_helpers/__init__.py,sha256=aqesJ3gPruETXtksvQga-iNJYBQZG6TY2YGK7iNOY6g,1324
2
- openai_sdk_helpers/config.py,sha256=OH--g7Xp4ftucA2C4o6FCX0M9Z15KMRpkY0lpn0mmOI,6455
3
- openai_sdk_helpers/environment.py,sha256=t_AFP6OXjRBoIQVZdgjqZzcUWB-FDeYn4KzKn5FgrnY,693
4
- openai_sdk_helpers/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- openai_sdk_helpers/agent/__init__.py,sha256=1sRtu_TbnKR7EstzZjoi2OUOk0xJOTn4xbo5ZeoPIhk,825
6
- openai_sdk_helpers/agent/base.py,sha256=JHJnI7nW6e6l_FrEVoyHjFd_agE5CAM_E8rUPMrlZsk,10053
7
- openai_sdk_helpers/agent/config.py,sha256=IZDF83f_QT-1-3GdTVrn9cQCoaaH4KNcrO-ocfc-LwY,1925
8
- openai_sdk_helpers/agent/project_manager.py,sha256=uYCZyAG8_Snxef4mv5ax-nI_XVvRPUh43I0pY_AdiiU,16249
9
- openai_sdk_helpers/agent/prompt_utils.py,sha256=8uCm08YuJ94rKgBuIkio2O4EpbwDmTXNfgeddbih8JA,228
10
- openai_sdk_helpers/agent/runner.py,sha256=-hd_k4h2mmKDpocIIQWQs_5Y9wvq7cLTopmNMwwz3Jc,5375
11
- openai_sdk_helpers/agent/summarizer.py,sha256=lijBOL7vE7pm4ShquB-j6zJKLmw0X94KAY0zDC6RkD4,2444
12
- openai_sdk_helpers/agent/translator.py,sha256=Cj3eJ2IakX2UqSeDotgqpbmM89FekpYt3GglM8Qxglw,4229
13
- openai_sdk_helpers/agent/utils.py,sha256=DTD5foCqGYfXf13F2bZMYIQROl7SbDSy5GDPGi0Zl-0,1089
14
- openai_sdk_helpers/agent/validation.py,sha256=omKfbClYdPQxxn9WKlw33s42AkudeFw54DmgGSe2UhQ,3216
15
- openai_sdk_helpers/agent/vector_search.py,sha256=pf_kIFl_TK4ZXvTcZzNqXxZuyq4QfF4ncDluAp4nj0c,15529
16
- openai_sdk_helpers/agent/web_search.py,sha256=VCsMN75XlwrifqOVMSDYxkrLJ2oJl-yInMdMtx6Puqo,12147
17
- openai_sdk_helpers/enums/__init__.py,sha256=HhzM9YVDqPijpnKzA-qnzbX62104FrGDcnN-cEYMD_w,149
18
- openai_sdk_helpers/enums/base.py,sha256=dBrzbIA3Ft2Jy-1PhMImEQeDwH0FXIMGHdg68DsG7WE,697
19
- openai_sdk_helpers/prompt/__init__.py,sha256=Pio9s99ej0ior5gKr8m-hSUgqkBOgFdNu1xofvjPEf8,2275
20
- openai_sdk_helpers/prompt/summarizer.jinja,sha256=jliSetWDISbql1EkWi1RB8-L_BXUg8JMkRRsPRHuzbY,309
21
- openai_sdk_helpers/prompt/translator.jinja,sha256=SZhW8ipEzM-9IA4wyS_r2wIMTAclWrilmk1s46njoL0,291
22
- openai_sdk_helpers/prompt/validator.jinja,sha256=6t8q_IdxFd3mVBGX6SFKNOert1Wo3YpTOji2SNEbbtE,547
23
- openai_sdk_helpers/response/__init__.py,sha256=LOCBPGe--iKHHCU1WVcljXV5tLFFRdv1dTJZeip7gc8,505
24
- openai_sdk_helpers/response/base.py,sha256=vOibHp9xQiC4Nu-kNJ8GutRCwBPAtShgybf9_T_lHWk,19593
25
- openai_sdk_helpers/response/messages.py,sha256=Ot432B9qbbvinGG0aO6mWYeeEUSVqmLiNlvulKbUlZQ,6487
26
- openai_sdk_helpers/response/runner.py,sha256=OD-lNgpuhBULKS9-fyYAicKONdx_Tk48qGOzVBmG00s,2536
27
- openai_sdk_helpers/response/tool_call.py,sha256=kYUfkjmkLbEJun_QByMuAvYjdixwoRAjHNy2Sk_riXA,1937
28
- openai_sdk_helpers/response/vector_store.py,sha256=wCPPppzCQ-PYSS4T2QHqDUHcPMYNlQFeV-Pu33KBRy8,2418
29
- openai_sdk_helpers/structure/__init__.py,sha256=GBD48p3M9wnOPmEO9t9t5XuiMQedmDBClKmjDLEjcUo,1129
30
- openai_sdk_helpers/structure/agent_blueprint.py,sha256=opL-dER3a_f_JWC3Jx9ovRdbC4XZe9X20-o1YUq9sgw,7569
31
- openai_sdk_helpers/structure/base.py,sha256=FJvB-HedXG02VJEEgymMd2adcJCwugdGHidj4ne7phU,22975
32
- openai_sdk_helpers/structure/prompt.py,sha256=Yovho9WA1AZP1FhKBieBpVThrUn62g4k40mxNrBoY9s,582
33
- openai_sdk_helpers/structure/responses.py,sha256=KivhRltUlrK8ey9Tk9rDNceHb7uC2gNE38iQJXFOxug,3507
34
- openai_sdk_helpers/structure/summary.py,sha256=zYRKuBjZHz0GvLRofvJdfD9u101xKgVhFc5CZIlscUE,1682
35
- openai_sdk_helpers/structure/validation.py,sha256=IdlPb3I1PdCah7kciE8iDRZy_ltk5GSXQyRJUufz7K0,1405
36
- openai_sdk_helpers/structure/vector_search.py,sha256=M3TQwxOg9mJmZcLgx7UhZkclnbdcH2K_N-XxUU9Eoxo,2457
37
- openai_sdk_helpers/structure/web_search.py,sha256=XGJS5S-a0t62k7y8r65JzCEdIQh_5dr10EPT-k134Ys,1371
38
- openai_sdk_helpers/structure/plan/__init__.py,sha256=OVTGp0MAb8RLjE7TZk5zoXjXIih7zzfwPYIyO7CCwVM,261
39
- openai_sdk_helpers/structure/plan/enum.py,sha256=EYGdUckSUSOXQCTIbD8RhSQNylgVTVvOnb7za6fv6_A,1772
40
- openai_sdk_helpers/structure/plan/plan.py,sha256=33qBu-yzFEpYHVsvGiGMsdZphYpOD7eT5AjNQzt5cmo,7480
41
- openai_sdk_helpers/structure/plan/task.py,sha256=Qn-GXV0VuOYA-EHXSC6tQlcXObKMeV3-TQhgeepl2L8,3481
42
- openai_sdk_helpers/utils/__init__.py,sha256=JRmAwQz2qE0bNhshAq5HAlXjYMyE5OqLl-vOKcD6MZY,463
43
- openai_sdk_helpers/utils/core.py,sha256=mKCkGE1cC06ZcOip70eiA8rJ4jaRmnGm4zJfwDPLkQM,8161
44
- openai_sdk_helpers/vector_storage/__init__.py,sha256=BjUueFnxmF4T6YOCra2nqa8rEAzsihEYWavkYB7S_lM,384
45
- openai_sdk_helpers/vector_storage/cleanup.py,sha256=6e_A9MAOKhJl_9EbRgGiB0NrrN79IwN0mMnHrwp4gd8,2964
46
- openai_sdk_helpers/vector_storage/storage.py,sha256=-Yk9RwzG6ABkhH1p3Y-6tv5sGu2MdxHvwkxEtB9N9_c,19295
47
- openai_sdk_helpers/vector_storage/types.py,sha256=9u5oBxKTDf_ljvbWhp1dWVW1zrlVwLd4OpikygvlKJI,1298
48
- openai_sdk_helpers-0.0.7.dist-info/METADATA,sha256=zYMBq4ke7ex0StA0Q4ddjD4GAsx9cI8oEWTXpZOV1SY,6557
49
- openai_sdk_helpers-0.0.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
50
- openai_sdk_helpers-0.0.7.dist-info/licenses/LICENSE,sha256=CUhc1NrE50bs45tcXF7OcTQBKEvkUuLqeOHgrWQ5jaA,1067
51
- openai_sdk_helpers-0.0.7.dist-info/RECORD,,