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.
Files changed (68) hide show
  1. openai_sdk_helpers/__init__.py +45 -41
  2. openai_sdk_helpers/agent/__init__.py +4 -6
  3. openai_sdk_helpers/agent/base.py +110 -191
  4. openai_sdk_helpers/agent/{config.py → configuration.py} +24 -32
  5. openai_sdk_helpers/agent/{coordination.py → coordinator.py} +22 -23
  6. openai_sdk_helpers/agent/runner.py +3 -45
  7. openai_sdk_helpers/agent/search/base.py +54 -76
  8. openai_sdk_helpers/agent/search/vector.py +92 -108
  9. openai_sdk_helpers/agent/search/web.py +104 -82
  10. openai_sdk_helpers/agent/summarizer.py +22 -28
  11. openai_sdk_helpers/agent/translator.py +22 -24
  12. openai_sdk_helpers/agent/{validation.py → validator.py} +19 -23
  13. openai_sdk_helpers/cli.py +8 -22
  14. openai_sdk_helpers/environment.py +8 -13
  15. openai_sdk_helpers/errors.py +9 -0
  16. openai_sdk_helpers/extract/__init__.py +23 -0
  17. openai_sdk_helpers/extract/extractor.py +157 -0
  18. openai_sdk_helpers/extract/generator.py +476 -0
  19. openai_sdk_helpers/prompt/extractor_config_agent_instructions.jinja +6 -0
  20. openai_sdk_helpers/prompt/extractor_config_generator.jinja +37 -0
  21. openai_sdk_helpers/prompt/extractor_config_generator_instructions.jinja +9 -0
  22. openai_sdk_helpers/prompt/extractor_prompt_optimizer_agent_instructions.jinja +4 -0
  23. openai_sdk_helpers/prompt/extractor_prompt_optimizer_request.jinja +11 -0
  24. openai_sdk_helpers/prompt/vector_planner.jinja +7 -0
  25. openai_sdk_helpers/prompt/vector_search.jinja +6 -0
  26. openai_sdk_helpers/prompt/vector_writer.jinja +7 -0
  27. openai_sdk_helpers/response/__init__.py +3 -7
  28. openai_sdk_helpers/response/base.py +89 -98
  29. openai_sdk_helpers/response/{config.py → configuration.py} +45 -20
  30. openai_sdk_helpers/response/files.py +2 -0
  31. openai_sdk_helpers/response/planner.py +1 -1
  32. openai_sdk_helpers/response/prompter.py +1 -1
  33. openai_sdk_helpers/response/runner.py +1 -48
  34. openai_sdk_helpers/response/tool_call.py +0 -141
  35. openai_sdk_helpers/response/vector_store.py +8 -5
  36. openai_sdk_helpers/streamlit_app/__init__.py +1 -1
  37. openai_sdk_helpers/streamlit_app/app.py +17 -18
  38. openai_sdk_helpers/streamlit_app/{config.py → configuration.py} +13 -13
  39. openai_sdk_helpers/structure/__init__.py +16 -0
  40. openai_sdk_helpers/structure/base.py +239 -278
  41. openai_sdk_helpers/structure/extraction.py +1228 -0
  42. openai_sdk_helpers/structure/plan/plan.py +0 -20
  43. openai_sdk_helpers/structure/plan/task.py +0 -33
  44. openai_sdk_helpers/structure/prompt.py +16 -0
  45. openai_sdk_helpers/structure/responses.py +2 -2
  46. openai_sdk_helpers/structure/web_search.py +0 -10
  47. openai_sdk_helpers/tools.py +346 -99
  48. openai_sdk_helpers/types.py +3 -3
  49. openai_sdk_helpers/utils/__init__.py +9 -6
  50. openai_sdk_helpers/utils/json/base_model.py +316 -33
  51. openai_sdk_helpers/utils/json/data_class.py +1 -1
  52. openai_sdk_helpers/utils/langextract.py +194 -0
  53. openai_sdk_helpers/utils/registry.py +19 -15
  54. openai_sdk_helpers/vector_storage/storage.py +1 -1
  55. {openai_sdk_helpers-0.4.2.dist-info → openai_sdk_helpers-0.5.0.dist-info}/METADATA +25 -11
  56. openai_sdk_helpers-0.5.0.dist-info/RECORD +95 -0
  57. openai_sdk_helpers/agent/prompt_utils.py +0 -15
  58. openai_sdk_helpers/context_manager.py +0 -241
  59. openai_sdk_helpers/deprecation.py +0 -167
  60. openai_sdk_helpers/retry.py +0 -175
  61. openai_sdk_helpers/streamlit_app/streamlit_web_search.py +0 -75
  62. openai_sdk_helpers/utils/deprecation.py +0 -167
  63. openai_sdk_helpers-0.4.2.dist-info/RECORD +0 -88
  64. /openai_sdk_helpers/{logging_config.py → logging.py} +0 -0
  65. /openai_sdk_helpers/{config.py → settings.py} +0 -0
  66. {openai_sdk_helpers-0.4.2.dist-info → openai_sdk_helpers-0.5.0.dist-info}/WHEEL +0 -0
  67. {openai_sdk_helpers-0.4.2.dist-info → openai_sdk_helpers-0.5.0.dist-info}/entry_points.txt +0 -0
  68. {openai_sdk_helpers-0.4.2.dist-info → openai_sdk_helpers-0.5.0.dist-info}/licenses/LICENSE +0 -0
@@ -2,15 +2,9 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from .environment import get_data_path, get_model
5
+ from .environment import get_data_path
6
6
  from .utils.async_utils import run_coroutine_thread_safe, run_coroutine_with_fallback
7
- from .context_manager import (
8
- AsyncManagedResource,
9
- ManagedResource,
10
- async_context,
11
- ensure_closed,
12
- ensure_closed_async,
13
- )
7
+
14
8
  from .errors import (
15
9
  OpenAISDKError,
16
10
  ConfigurationError,
@@ -22,8 +16,9 @@ from .errors import (
22
16
  InputValidationError,
23
17
  AsyncExecutionError,
24
18
  ResourceCleanupError,
19
+ ExtractionError,
25
20
  )
26
- from .retry import with_exponential_backoff
21
+
27
22
  from .utils.validation import (
28
23
  validate_choice,
29
24
  validate_dict_mapping,
@@ -46,12 +41,17 @@ from .structure import (
46
41
  ExtendedSummaryStructure,
47
42
  ValidationResultStructure,
48
43
  AgentBlueprint,
44
+ AnnotatedDocumentStructure,
45
+ AttributeStructure,
46
+ DocumentStructure,
47
+ ExampleDataStructure,
48
+ ExtractionStructure,
49
49
  create_plan,
50
50
  execute_task,
51
51
  execute_plan,
52
52
  )
53
53
  from .prompt import PromptRenderer
54
- from .config import OpenAISettings
54
+ from .settings import OpenAISettings
55
55
  from .files_api import FilesAPIManager, FilePurpose
56
56
  from .vector_storage import VectorStorage, VectorStorageFileInfo, VectorStorageFileStats
57
57
  from .agent import (
@@ -73,22 +73,17 @@ from .response import (
73
73
  ResponseConfiguration,
74
74
  ResponseRegistry,
75
75
  get_default_registry,
76
- parse_tool_arguments,
77
76
  attach_vector_store,
78
77
  )
79
78
  from .tools import (
80
- serialize_tool_result,
81
79
  tool_handler_factory,
82
80
  StructureType,
81
+ ToolHandler,
82
+ ToolHandlerRegistration,
83
83
  ToolSpec,
84
- build_tool_definitions,
85
- )
86
- from .config import build_openai_settings
87
- from .utils.deprecation import (
88
- deprecated,
89
- warn_deprecated,
90
- DeprecationHelper,
84
+ build_tool_definition_list,
91
85
  )
86
+ from .settings import build_openai_settings
92
87
  from .utils.output_validation import (
93
88
  ValidationResult,
94
89
  ValidationRule,
@@ -98,15 +93,21 @@ from .utils.output_validation import (
98
93
  OutputValidator,
99
94
  validate_output,
100
95
  )
101
- from .types import (
102
- SupportsOpenAIClient,
103
- OpenAIClient,
96
+ from .utils.langextract import LangExtractAdapter, build_langextract_adapter
97
+ from .extract import (
98
+ DocumentExtractor,
99
+ EXTRACTOR_CONFIG_AGENT_INSTRUCTIONS,
100
+ EXTRACTOR_CONFIG_GENERATOR,
101
+ PROMPT_OPTIMIZER_AGENT_INSTRUCTIONS,
102
+ generate_document_extractor_config,
103
+ generate_document_extractor_config_with_agent,
104
+ optimize_extractor_prompt,
105
+ optimize_extractor_prompt_with_agent,
104
106
  )
105
107
 
106
108
  __all__ = [
107
109
  # Environment utilities
108
110
  "get_data_path",
109
- "get_model",
110
111
  # Async utilities
111
112
  "run_coroutine_thread_safe",
112
113
  "run_coroutine_with_fallback",
@@ -121,14 +122,7 @@ __all__ = [
121
122
  "InputValidationError",
122
123
  "AsyncExecutionError",
123
124
  "ResourceCleanupError",
124
- # Retry utilities
125
- "with_exponential_backoff",
126
- # Context managers
127
- "ManagedResource",
128
- "AsyncManagedResource",
129
- "ensure_closed",
130
- "ensure_closed_async",
131
- "async_context",
125
+ "ExtractionError",
132
126
  # Validation
133
127
  "validate_non_empty_string",
134
128
  "validate_max_length",
@@ -166,6 +160,11 @@ __all__ = [
166
160
  "WebSearchStructure",
167
161
  "VectorSearchStructure",
168
162
  "ValidationResultStructure",
163
+ "AnnotatedDocumentStructure",
164
+ "AttributeStructure",
165
+ "DocumentStructure",
166
+ "ExampleDataStructure",
167
+ "ExtractionStructure",
169
168
  "ResponseBase",
170
169
  "ResponseMessage",
171
170
  "ResponseMessages",
@@ -173,24 +172,17 @@ __all__ = [
173
172
  "ResponseConfiguration",
174
173
  "ResponseRegistry",
175
174
  "get_default_registry",
176
- "parse_tool_arguments",
177
175
  "attach_vector_store",
178
- "serialize_tool_result",
179
176
  "tool_handler_factory",
180
177
  "StructureType",
178
+ "ToolHandler",
179
+ "ToolHandlerRegistration",
181
180
  "ToolSpec",
182
- "build_tool_definitions",
181
+ "build_tool_definition_list",
183
182
  "build_openai_settings",
184
183
  "create_plan",
185
184
  "execute_task",
186
185
  "execute_plan",
187
- # Type definitions
188
- "SupportsOpenAIClient",
189
- "OpenAIClient",
190
- # Deprecation utilities
191
- "deprecated",
192
- "warn_deprecated",
193
- "DeprecationHelper",
194
186
  # Output validation
195
187
  "ValidationResult",
196
188
  "ValidationRule",
@@ -199,4 +191,16 @@ __all__ = [
199
191
  "LengthValidator",
200
192
  "OutputValidator",
201
193
  "validate_output",
194
+ # LangExtract
195
+ "LangExtractAdapter",
196
+ "build_langextract_adapter",
197
+ # Extraction helpers
198
+ "DocumentExtractor",
199
+ "EXTRACTOR_CONFIG_AGENT_INSTRUCTIONS",
200
+ "EXTRACTOR_CONFIG_GENERATOR",
201
+ "PROMPT_OPTIMIZER_AGENT_INSTRUCTIONS",
202
+ "generate_document_extractor_config",
203
+ "generate_document_extractor_config_with_agent",
204
+ "optimize_extractor_prompt",
205
+ "optimize_extractor_prompt_with_agent",
202
206
  ]
@@ -1,16 +1,15 @@
1
1
  """Shared agent helpers built on the OpenAI Agents SDK."""
2
2
 
3
3
  from __future__ import annotations
4
-
5
4
  from .base import AgentBase
6
- from .config import AgentConfiguration, AgentRegistry, get_default_registry
5
+ from .configuration import AgentConfiguration, AgentRegistry, get_default_registry
7
6
  from ..structure.plan.enum import AgentEnum
8
- from .coordination import CoordinatorAgent
9
- from .runner import run_sync, run_async, run_streamed
7
+ from .coordinator import CoordinatorAgent
8
+ from .runner import run_sync, run_async
10
9
  from .search.base import SearchPlanner, SearchToolAgent, SearchWriter
11
10
  from .summarizer import SummarizerAgent
12
11
  from .translator import TranslatorAgent
13
- from .validation import ValidatorAgent
12
+ from .validator import ValidatorAgent
14
13
  from .utils import run_coroutine_agent_sync
15
14
  from .search.vector import VectorAgentSearch
16
15
  from .search.web import WebAgentSearch
@@ -24,7 +23,6 @@ __all__ = [
24
23
  "CoordinatorAgent",
25
24
  "run_sync",
26
25
  "run_async",
27
- "run_streamed",
28
26
  "run_coroutine_agent_sync",
29
27
  "SearchPlanner",
30
28
  "SearchToolAgent",