openai-sdk-helpers 0.0.9__tar.gz → 0.1.1__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.0.9/README.md → openai_sdk_helpers-0.1.1/PKG-INFO +81 -0
- openai_sdk_helpers-0.0.9/PKG-INFO → openai_sdk_helpers-0.1.1/README.md +46 -25
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/pyproject.toml +22 -4
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/__init__.py +63 -5
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/base.py +5 -1
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/coordination.py +4 -5
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/runner.py +4 -1
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/search/base.py +1 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/search/vector.py +2 -0
- openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/cli.py +265 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/config.py +120 -31
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/context_manager.py +1 -1
- openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/deprecation.py +167 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/environment.py +3 -2
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/errors.py +0 -12
- openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/logging_config.py +34 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/prompt/base.py +56 -6
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/response/__init__.py +5 -2
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/response/base.py +84 -115
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/response/config.py +142 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/response/messages.py +1 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/response/tool_call.py +15 -4
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/retry.py +1 -1
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/streamlit_app/app.py +14 -3
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/streamlit_app/streamlit_web_search.py +15 -8
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/__init__.py +3 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/base.py +6 -6
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/plan/__init__.py +15 -1
- openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/structure/plan/helpers.py +173 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/plan/plan.py +13 -9
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/plan/task.py +7 -7
- openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/structure/plan/types.py +15 -0
- openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/tools.py +296 -0
- openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/utils/__init__.py +107 -0
- {openai_sdk_helpers-0.0.9/src/openai_sdk_helpers → openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/utils}/async_utils.py +5 -6
- openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/utils/coercion.py +138 -0
- openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/utils/deprecation.py +167 -0
- openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/utils/json_utils.py +98 -0
- openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/utils/output_validation.py +448 -0
- openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/utils/path_utils.py +46 -0
- {openai_sdk_helpers-0.0.9/src/openai_sdk_helpers → openai_sdk_helpers-0.1.1/src/openai_sdk_helpers/utils}/validation.py +7 -3
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/vector_storage/storage.py +9 -6
- openai_sdk_helpers-0.0.9/src/openai_sdk_helpers/logging_config.py +0 -105
- openai_sdk_helpers-0.0.9/src/openai_sdk_helpers/utils/__init__.py +0 -56
- openai_sdk_helpers-0.0.9/src/openai_sdk_helpers/utils/core.py +0 -468
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/.gitignore +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/LICENSE +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/__init__.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/config.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/prompt_utils.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/search/__init__.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/search/web.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/summarizer.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/translator.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/utils.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/validation.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/enums/__init__.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/enums/base.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/prompt/__init__.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/prompt/summarizer.jinja +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/prompt/translator.jinja +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/prompt/validator.jinja +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/py.typed +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/response/runner.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/response/vector_store.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/streamlit_app/__init__.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/streamlit_app/config.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/agent_blueprint.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/plan/enum.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/prompt.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/responses.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/summary.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/validation.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/vector_search.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/structure/web_search.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/types.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/vector_storage/__init__.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/vector_storage/cleanup.py +0 -0
- {openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/vector_storage/types.py +0 -0
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: openai-sdk-helpers
|
|
3
|
+
Version: 0.1.1
|
|
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
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Requires-Dist: jinja2
|
|
20
|
+
Requires-Dist: openai-agents<1.0.0,>=0.6.4
|
|
21
|
+
Requires-Dist: openai<3.0.0,>=2.14.0
|
|
22
|
+
Requires-Dist: pydantic<3,>=2.7
|
|
23
|
+
Requires-Dist: python-dotenv
|
|
24
|
+
Requires-Dist: streamlit
|
|
25
|
+
Requires-Dist: typing-extensions<5,>=4.15.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: black; extra == 'dev'
|
|
28
|
+
Requires-Dist: black[jupyter]; extra == 'dev'
|
|
29
|
+
Requires-Dist: pydocstyle; extra == 'dev'
|
|
30
|
+
Requires-Dist: pyright; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
1
36
|
<div align="center">
|
|
2
37
|
|
|
3
38
|
# openai-sdk-helpers
|
|
@@ -65,6 +100,26 @@ The `agent` module provides a higher-level abstraction for building agents, whil
|
|
|
65
100
|
- **Tool execution framework** with custom handlers and structured outputs
|
|
66
101
|
- **Session persistence** for saving and restoring conversation history
|
|
67
102
|
|
|
103
|
+
#### Infrastructure & Utilities
|
|
104
|
+
- **Centralized logger factory** for consistent application logging
|
|
105
|
+
- **Retry patterns** with exponential backoff and jitter
|
|
106
|
+
- **Output validation** framework with JSON schema, semantic, and length validators
|
|
107
|
+
- **CLI tool** for testing agents, validating templates, and inspecting registries
|
|
108
|
+
- **Deprecation utilities** for managing API changes
|
|
109
|
+
|
|
110
|
+
#### Shared Components
|
|
111
|
+
- **Typed structures** using Pydantic for prompts, responses, and search workflows
|
|
112
|
+
to ensure predictable inputs and outputs
|
|
113
|
+
- **OpenAI configuration management** with environment variable and `.env` file support
|
|
114
|
+
- **Vector storage abstraction** for seamless integration with OpenAI vector stores
|
|
115
|
+
- **Type-safe interfaces** with full type hints and `py.typed` marker for external projects
|
|
116
|
+
- **ValidatorAgent**: Check inputs and outputs against safety guardrails
|
|
117
|
+
|
|
118
|
+
#### Response Module (Built on `openai` SDK)
|
|
119
|
+
- **Response handling utilities** for direct API control with fine-grained message management
|
|
120
|
+
- **Tool execution framework** with custom handlers and structured outputs
|
|
121
|
+
- **Session persistence** for saving and restoring conversation history
|
|
122
|
+
|
|
68
123
|
#### Shared Components
|
|
69
124
|
- **Typed structures** using Pydantic for prompts, responses, and search workflows
|
|
70
125
|
to ensure predictable inputs and outputs
|
|
@@ -477,6 +532,31 @@ See `AGENTS.md` for detailed contributing guidelines and conventions.
|
|
|
477
532
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
478
533
|
for details.
|
|
479
534
|
|
|
535
|
+
## CLI Tool
|
|
536
|
+
|
|
537
|
+
The package includes a command-line tool for development and testing:
|
|
538
|
+
|
|
539
|
+
```bash
|
|
540
|
+
# List all registered response configurations
|
|
541
|
+
openai-helpers registry list
|
|
542
|
+
|
|
543
|
+
# Inspect a specific configuration
|
|
544
|
+
openai-helpers registry inspect my_config
|
|
545
|
+
|
|
546
|
+
# Validate Jinja2 templates
|
|
547
|
+
openai-helpers template validate ./templates
|
|
548
|
+
|
|
549
|
+
# Test an agent (coming soon)
|
|
550
|
+
openai-helpers agent test MyAgent --input "test input"
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
### CLI Commands
|
|
554
|
+
|
|
555
|
+
- **registry list** - Show all registered response configurations
|
|
556
|
+
- **registry inspect** - Display details of a configuration
|
|
557
|
+
- **template validate** - Check template syntax and structure
|
|
558
|
+
- **agent test** - Test agents locally with sample inputs
|
|
559
|
+
|
|
480
560
|
## Troubleshooting
|
|
481
561
|
|
|
482
562
|
### Common Issues
|
|
@@ -498,6 +578,7 @@ OPENAI_API_KEY=your-api-key-here
|
|
|
498
578
|
Vector search workflows require custom prompt templates. Either:
|
|
499
579
|
1. Create the required `.jinja` files in your `prompt_dir`
|
|
500
580
|
2. Omit the `prompt_dir` parameter to use built-in defaults (for text agents only)
|
|
581
|
+
3. Use the CLI to validate templates: `openai-helpers template validate ./templates`
|
|
501
582
|
|
|
502
583
|
**Import errors after installation**
|
|
503
584
|
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: openai-sdk-helpers
|
|
3
|
-
Version: 0.0.9
|
|
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: streamlit
|
|
15
|
-
Requires-Dist: typing-extensions<5,>=4.15.0
|
|
16
|
-
Provides-Extra: dev
|
|
17
|
-
Requires-Dist: black; extra == 'dev'
|
|
18
|
-
Requires-Dist: black[jupyter]; extra == 'dev'
|
|
19
|
-
Requires-Dist: pydocstyle; extra == 'dev'
|
|
20
|
-
Requires-Dist: pyright; extra == 'dev'
|
|
21
|
-
Requires-Dist: pytest; extra == 'dev'
|
|
22
|
-
Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
23
|
-
Requires-Dist: pytest-cov; extra == 'dev'
|
|
24
|
-
Description-Content-Type: text/markdown
|
|
25
|
-
|
|
26
1
|
<div align="center">
|
|
27
2
|
|
|
28
3
|
# openai-sdk-helpers
|
|
@@ -90,6 +65,26 @@ The `agent` module provides a higher-level abstraction for building agents, whil
|
|
|
90
65
|
- **Tool execution framework** with custom handlers and structured outputs
|
|
91
66
|
- **Session persistence** for saving and restoring conversation history
|
|
92
67
|
|
|
68
|
+
#### Infrastructure & Utilities
|
|
69
|
+
- **Centralized logger factory** for consistent application logging
|
|
70
|
+
- **Retry patterns** with exponential backoff and jitter
|
|
71
|
+
- **Output validation** framework with JSON schema, semantic, and length validators
|
|
72
|
+
- **CLI tool** for testing agents, validating templates, and inspecting registries
|
|
73
|
+
- **Deprecation utilities** for managing API changes
|
|
74
|
+
|
|
75
|
+
#### Shared Components
|
|
76
|
+
- **Typed structures** using Pydantic for prompts, responses, and search workflows
|
|
77
|
+
to ensure predictable inputs and outputs
|
|
78
|
+
- **OpenAI configuration management** with environment variable and `.env` file support
|
|
79
|
+
- **Vector storage abstraction** for seamless integration with OpenAI vector stores
|
|
80
|
+
- **Type-safe interfaces** with full type hints and `py.typed` marker for external projects
|
|
81
|
+
- **ValidatorAgent**: Check inputs and outputs against safety guardrails
|
|
82
|
+
|
|
83
|
+
#### Response Module (Built on `openai` SDK)
|
|
84
|
+
- **Response handling utilities** for direct API control with fine-grained message management
|
|
85
|
+
- **Tool execution framework** with custom handlers and structured outputs
|
|
86
|
+
- **Session persistence** for saving and restoring conversation history
|
|
87
|
+
|
|
93
88
|
#### Shared Components
|
|
94
89
|
- **Typed structures** using Pydantic for prompts, responses, and search workflows
|
|
95
90
|
to ensure predictable inputs and outputs
|
|
@@ -502,6 +497,31 @@ See `AGENTS.md` for detailed contributing guidelines and conventions.
|
|
|
502
497
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
503
498
|
for details.
|
|
504
499
|
|
|
500
|
+
## CLI Tool
|
|
501
|
+
|
|
502
|
+
The package includes a command-line tool for development and testing:
|
|
503
|
+
|
|
504
|
+
```bash
|
|
505
|
+
# List all registered response configurations
|
|
506
|
+
openai-helpers registry list
|
|
507
|
+
|
|
508
|
+
# Inspect a specific configuration
|
|
509
|
+
openai-helpers registry inspect my_config
|
|
510
|
+
|
|
511
|
+
# Validate Jinja2 templates
|
|
512
|
+
openai-helpers template validate ./templates
|
|
513
|
+
|
|
514
|
+
# Test an agent (coming soon)
|
|
515
|
+
openai-helpers agent test MyAgent --input "test input"
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### CLI Commands
|
|
519
|
+
|
|
520
|
+
- **registry list** - Show all registered response configurations
|
|
521
|
+
- **registry inspect** - Display details of a configuration
|
|
522
|
+
- **template validate** - Check template syntax and structure
|
|
523
|
+
- **agent test** - Test agents locally with sample inputs
|
|
524
|
+
|
|
505
525
|
## Troubleshooting
|
|
506
526
|
|
|
507
527
|
### Common Issues
|
|
@@ -523,6 +543,7 @@ OPENAI_API_KEY=your-api-key-here
|
|
|
523
543
|
Vector search workflows require custom prompt templates. Either:
|
|
524
544
|
1. Create the required `.jinja` files in your `prompt_dir`
|
|
525
545
|
2. Omit the `prompt_dir` parameter to use built-in defaults (for text agents only)
|
|
546
|
+
3. Use the CLI to validate templates: `openai-helpers template validate ./templates`
|
|
526
547
|
|
|
527
548
|
**Import errors after installation**
|
|
528
549
|
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "openai-sdk-helpers"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.1.1"
|
|
4
4
|
requires-python = ">=3.10"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
description = "Composable helpers for OpenAI SDK agents, prompts, and storage"
|
|
7
7
|
license = {text = "MIT"}
|
|
8
8
|
authors = [{name = "openai-sdk-helpers maintainers"}]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 4 - Beta",
|
|
11
|
+
"Intended Audience :: Developers",
|
|
12
|
+
"License :: OSI Approved :: MIT License",
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3.10",
|
|
15
|
+
"Programming Language :: Python :: 3.11",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
19
|
+
"Typing :: Typed",
|
|
20
|
+
]
|
|
9
21
|
dependencies = [
|
|
10
22
|
|
|
11
23
|
# Template rendering
|
|
@@ -21,9 +33,9 @@ dependencies = [
|
|
|
21
33
|
"python-dotenv",
|
|
22
34
|
|
|
23
35
|
|
|
24
|
-
# OpenAI functionality
|
|
25
|
-
"openai",
|
|
26
|
-
"openai-agents",
|
|
36
|
+
# OpenAI functionality (tested with openai==2.14.0, openai-agents==0.6.4)
|
|
37
|
+
"openai>=2.14.0,<3.0.0",
|
|
38
|
+
"openai-agents>=0.6.4,<1.0.0",
|
|
27
39
|
|
|
28
40
|
|
|
29
41
|
# Web UI
|
|
@@ -66,3 +78,9 @@ extraPaths = ["src"]
|
|
|
66
78
|
|
|
67
79
|
[tool.pydocstyle]
|
|
68
80
|
convention = "numpy"
|
|
81
|
+
|
|
82
|
+
[tool.pytest.ini_options]
|
|
83
|
+
asyncio_mode = "auto"
|
|
84
|
+
|
|
85
|
+
[project.scripts]
|
|
86
|
+
openai-helpers = "openai_sdk_helpers.cli:main"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from .async_utils import run_coroutine_thread_safe, run_coroutine_with_fallback
|
|
5
|
+
from .utils.async_utils import run_coroutine_thread_safe, run_coroutine_with_fallback
|
|
6
6
|
from .context_manager import (
|
|
7
7
|
AsyncManagedResource,
|
|
8
8
|
ManagedResource,
|
|
@@ -22,9 +22,8 @@ from .errors import (
|
|
|
22
22
|
AsyncExecutionError,
|
|
23
23
|
ResourceCleanupError,
|
|
24
24
|
)
|
|
25
|
-
from .logging_config import LoggerFactory
|
|
26
25
|
from .retry import with_exponential_backoff
|
|
27
|
-
from .validation import (
|
|
26
|
+
from .utils.validation import (
|
|
28
27
|
validate_choice,
|
|
29
28
|
validate_dict_mapping,
|
|
30
29
|
validate_list_items,
|
|
@@ -46,6 +45,9 @@ from .structure import (
|
|
|
46
45
|
ExtendedSummaryStructure,
|
|
47
46
|
ValidationResultStructure,
|
|
48
47
|
AgentBlueprint,
|
|
48
|
+
create_plan,
|
|
49
|
+
execute_task,
|
|
50
|
+
execute_plan,
|
|
49
51
|
)
|
|
50
52
|
from .prompt import PromptRenderer
|
|
51
53
|
from .config import OpenAISettings
|
|
@@ -66,8 +68,38 @@ from .response import (
|
|
|
66
68
|
ResponseMessage,
|
|
67
69
|
ResponseMessages,
|
|
68
70
|
ResponseToolCall,
|
|
71
|
+
ResponseConfiguration,
|
|
72
|
+
ResponseRegistry,
|
|
73
|
+
get_default_registry,
|
|
74
|
+
parse_tool_arguments,
|
|
69
75
|
attach_vector_store,
|
|
70
76
|
)
|
|
77
|
+
from .tools import (
|
|
78
|
+
serialize_tool_result,
|
|
79
|
+
tool_handler_factory,
|
|
80
|
+
StructureType,
|
|
81
|
+
ToolSpec,
|
|
82
|
+
build_tool_definitions,
|
|
83
|
+
)
|
|
84
|
+
from .config import build_openai_settings
|
|
85
|
+
from .utils.deprecation import (
|
|
86
|
+
deprecated,
|
|
87
|
+
warn_deprecated,
|
|
88
|
+
DeprecationHelper,
|
|
89
|
+
)
|
|
90
|
+
from .utils.output_validation import (
|
|
91
|
+
ValidationResult,
|
|
92
|
+
ValidationRule,
|
|
93
|
+
JSONSchemaValidator,
|
|
94
|
+
SemanticValidator,
|
|
95
|
+
LengthValidator,
|
|
96
|
+
OutputValidator,
|
|
97
|
+
validate_output,
|
|
98
|
+
)
|
|
99
|
+
from .types import (
|
|
100
|
+
SupportsOpenAIClient,
|
|
101
|
+
OpenAIClient,
|
|
102
|
+
)
|
|
71
103
|
|
|
72
104
|
__all__ = [
|
|
73
105
|
# Async utilities
|
|
@@ -84,8 +116,6 @@ __all__ = [
|
|
|
84
116
|
"InputValidationError",
|
|
85
117
|
"AsyncExecutionError",
|
|
86
118
|
"ResourceCleanupError",
|
|
87
|
-
# Logging
|
|
88
|
-
"LoggerFactory",
|
|
89
119
|
# Retry utilities
|
|
90
120
|
"with_exponential_backoff",
|
|
91
121
|
# Context managers
|
|
@@ -133,5 +163,33 @@ __all__ = [
|
|
|
133
163
|
"ResponseMessage",
|
|
134
164
|
"ResponseMessages",
|
|
135
165
|
"ResponseToolCall",
|
|
166
|
+
"ResponseConfiguration",
|
|
167
|
+
"ResponseRegistry",
|
|
168
|
+
"get_default_registry",
|
|
169
|
+
"parse_tool_arguments",
|
|
136
170
|
"attach_vector_store",
|
|
171
|
+
"serialize_tool_result",
|
|
172
|
+
"tool_handler_factory",
|
|
173
|
+
"StructureType",
|
|
174
|
+
"ToolSpec",
|
|
175
|
+
"build_tool_definitions",
|
|
176
|
+
"build_openai_settings",
|
|
177
|
+
"create_plan",
|
|
178
|
+
"execute_task",
|
|
179
|
+
"execute_plan",
|
|
180
|
+
# Type definitions
|
|
181
|
+
"SupportsOpenAIClient",
|
|
182
|
+
"OpenAIClient",
|
|
183
|
+
# Deprecation utilities
|
|
184
|
+
"deprecated",
|
|
185
|
+
"warn_deprecated",
|
|
186
|
+
"DeprecationHelper",
|
|
187
|
+
# Output validation
|
|
188
|
+
"ValidationResult",
|
|
189
|
+
"ValidationRule",
|
|
190
|
+
"JSONSchemaValidator",
|
|
191
|
+
"SemanticValidator",
|
|
192
|
+
"LengthValidator",
|
|
193
|
+
"OutputValidator",
|
|
194
|
+
"validate_output",
|
|
137
195
|
]
|
|
@@ -146,6 +146,7 @@ class AgentBase:
|
|
|
146
146
|
def from_config(
|
|
147
147
|
cls,
|
|
148
148
|
config: AgentConfigLike,
|
|
149
|
+
*,
|
|
149
150
|
run_context_wrapper: Optional[RunContextWrapper[Dict[str, Any]]] = None,
|
|
150
151
|
prompt_dir: Optional[Path] = None,
|
|
151
152
|
default_model: Optional[str] = None,
|
|
@@ -213,7 +214,7 @@ class AgentBase:
|
|
|
213
214
|
return self._template.render(context)
|
|
214
215
|
|
|
215
216
|
def get_prompt(
|
|
216
|
-
self, run_context_wrapper: RunContextWrapper[Dict[str, Any]], _: Agent
|
|
217
|
+
self, run_context_wrapper: RunContextWrapper[Dict[str, Any]], *, _: Agent
|
|
217
218
|
) -> str:
|
|
218
219
|
"""Render the agent prompt using the provided run context.
|
|
219
220
|
|
|
@@ -257,6 +258,7 @@ class AgentBase:
|
|
|
257
258
|
async def run_async(
|
|
258
259
|
self,
|
|
259
260
|
input: str,
|
|
261
|
+
*,
|
|
260
262
|
context: Optional[Dict[str, Any]] = None,
|
|
261
263
|
output_type: Optional[Any] = None,
|
|
262
264
|
) -> Any:
|
|
@@ -288,6 +290,7 @@ class AgentBase:
|
|
|
288
290
|
def run_sync(
|
|
289
291
|
self,
|
|
290
292
|
input: str,
|
|
293
|
+
*,
|
|
291
294
|
context: Optional[Dict[str, Any]] = None,
|
|
292
295
|
output_type: Optional[Any] = None,
|
|
293
296
|
) -> Any:
|
|
@@ -317,6 +320,7 @@ class AgentBase:
|
|
|
317
320
|
def run_streamed(
|
|
318
321
|
self,
|
|
319
322
|
input: str,
|
|
323
|
+
*,
|
|
320
324
|
context: Optional[Dict[str, Any]] = None,
|
|
321
325
|
output_type: Optional[Any] = None,
|
|
322
326
|
) -> RunResultStreaming:
|
{openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/coordination.py
RENAMED
|
@@ -12,8 +12,7 @@ from typing import Any, Callable, Dict, List, Optional
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
from ..structure import TaskStructure, PlanStructure, PromptStructure
|
|
15
|
-
from ..
|
|
16
|
-
from ..utils import JSONSerializable, log
|
|
15
|
+
from ..utils import JSONSerializable, ensure_directory, log
|
|
17
16
|
from .base import AgentBase
|
|
18
17
|
from .config import AgentConfig
|
|
19
18
|
from ..structure.plan.enum import AgentEnum
|
|
@@ -49,6 +48,7 @@ class CoordinatorAgent(AgentBase, JSONSerializable):
|
|
|
49
48
|
|
|
50
49
|
def __init__(
|
|
51
50
|
self,
|
|
51
|
+
*,
|
|
52
52
|
prompt_fn: PromptFn,
|
|
53
53
|
build_plan_fn: BuildPlanFn,
|
|
54
54
|
execute_plan_fn: ExecutePlanFn,
|
|
@@ -207,7 +207,7 @@ class CoordinatorAgent(AgentBase, JSONSerializable):
|
|
|
207
207
|
"""
|
|
208
208
|
if not self.start_date:
|
|
209
209
|
self.start_date = datetime.now(timezone.utc)
|
|
210
|
-
start_date_str = self.start_date.strftime(
|
|
210
|
+
start_date_str = self.start_date.strftime("%Y%m%d_%H%M%S")
|
|
211
211
|
return self._module_data_path / self._name / f"{start_date_str}.json"
|
|
212
212
|
|
|
213
213
|
def save(self) -> Path:
|
|
@@ -447,8 +447,7 @@ class CoordinatorAgent(AgentBase, JSONSerializable):
|
|
|
447
447
|
/ "coordinator_agent"
|
|
448
448
|
/ timestamp
|
|
449
449
|
)
|
|
450
|
-
self._run_directory
|
|
451
|
-
return self._run_directory
|
|
450
|
+
return ensure_directory(self._run_directory)
|
|
452
451
|
|
|
453
452
|
@staticmethod
|
|
454
453
|
def _task_label(task: TaskStructure) -> str:
|
{openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/runner.py
RENAMED
|
@@ -11,12 +11,13 @@ from typing import Any, Dict, Optional
|
|
|
11
11
|
|
|
12
12
|
from agents import Agent, RunResult, RunResultStreaming, Runner
|
|
13
13
|
|
|
14
|
-
from openai_sdk_helpers.async_utils import run_coroutine_with_fallback
|
|
14
|
+
from openai_sdk_helpers.utils.async_utils import run_coroutine_with_fallback
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
async def run_async(
|
|
18
18
|
agent: Agent,
|
|
19
19
|
input: str,
|
|
20
|
+
*,
|
|
20
21
|
context: Optional[Dict[str, Any]] = None,
|
|
21
22
|
output_type: Optional[Any] = None,
|
|
22
23
|
) -> Any:
|
|
@@ -57,6 +58,7 @@ async def run_async(
|
|
|
57
58
|
def run_sync(
|
|
58
59
|
agent: Agent,
|
|
59
60
|
input: str,
|
|
61
|
+
*,
|
|
60
62
|
context: Optional[Dict[str, Any]] = None,
|
|
61
63
|
output_type: Optional[Any] = None,
|
|
62
64
|
) -> Any:
|
|
@@ -103,6 +105,7 @@ def run_sync(
|
|
|
103
105
|
def run_streamed(
|
|
104
106
|
agent: Agent,
|
|
105
107
|
input: str,
|
|
108
|
+
*,
|
|
106
109
|
context: Optional[Dict[str, Any]] = None,
|
|
107
110
|
output_type: Optional[Any] = None,
|
|
108
111
|
) -> RunResultStreaming:
|
{openai_sdk_helpers-0.0.9 → openai_sdk_helpers-0.1.1}/src/openai_sdk_helpers/agent/search/vector.py
RENAMED
|
@@ -80,6 +80,7 @@ class VectorSearchTool(
|
|
|
80
80
|
|
|
81
81
|
def __init__(
|
|
82
82
|
self,
|
|
83
|
+
*,
|
|
83
84
|
prompt_dir: Optional[Path] = None,
|
|
84
85
|
default_model: Optional[str] = None,
|
|
85
86
|
store_name: Optional[str] = None,
|
|
@@ -256,6 +257,7 @@ class VectorSearch:
|
|
|
256
257
|
|
|
257
258
|
def __init__(
|
|
258
259
|
self,
|
|
260
|
+
*,
|
|
259
261
|
prompt_dir: Optional[Path] = None,
|
|
260
262
|
default_model: Optional[str] = None,
|
|
261
263
|
vector_store_name: Optional[str] = None,
|