ai-pipeline-core 0.2.8__tar.gz → 0.3.0__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.
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/.gitignore +4 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/PKG-INFO +23 -20
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/README.md +22 -19
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/__init__.py +14 -4
- ai_pipeline_core-0.3.0/ai_pipeline_core/deployment/__init__.py +46 -0
- ai_pipeline_core-0.3.0/ai_pipeline_core/deployment/base.py +681 -0
- ai_pipeline_core-0.3.0/ai_pipeline_core/deployment/contract.py +84 -0
- ai_pipeline_core-0.3.0/ai_pipeline_core/deployment/helpers.py +98 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/flow_document.py +1 -1
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/task_document.py +1 -1
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/temporary_document.py +1 -1
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/flow/config.py +13 -2
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/flow/options.py +1 -1
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/llm/client.py +22 -23
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/llm/model_response.py +6 -3
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/llm/model_types.py +0 -1
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/pipeline.py +1 -1
- ai_pipeline_core-0.3.0/ai_pipeline_core/progress.py +127 -0
- ai_pipeline_core-0.3.0/ai_pipeline_core/prompt_builder/__init__.py +5 -0
- ai_pipeline_core-0.3.0/ai_pipeline_core/prompt_builder/documents_prompt.jinja2 +23 -0
- ai_pipeline_core-0.3.0/ai_pipeline_core/prompt_builder/global_cache.py +78 -0
- ai_pipeline_core-0.3.0/ai_pipeline_core/prompt_builder/new_core_documents_prompt.jinja2 +6 -0
- ai_pipeline_core-0.3.0/ai_pipeline_core/prompt_builder/prompt_builder.py +253 -0
- ai_pipeline_core-0.3.0/ai_pipeline_core/prompt_builder/system_prompt.jinja2 +41 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/tracing.py +1 -1
- ai_pipeline_core-0.3.0/ai_pipeline_core/utils/remote_deployment.py +119 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/pyproject.toml +7 -5
- ai_pipeline_core-0.2.8/ai_pipeline_core/simple_runner/__init__.py +0 -14
- ai_pipeline_core-0.2.8/ai_pipeline_core/simple_runner/cli.py +0 -254
- ai_pipeline_core-0.2.8/ai_pipeline_core/simple_runner/simple_runner.py +0 -247
- ai_pipeline_core-0.2.8/ai_pipeline_core/utils/remote_deployment.py +0 -269
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/LICENSE +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/__init__.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/document.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/document_list.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/mime_type.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/utils.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/exceptions.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/flow/__init__.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/llm/__init__.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/llm/ai_messages.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/llm/model_options.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/logging/__init__.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/logging/logging.yml +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/logging/logging_config.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/logging/logging_mixin.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/prefect.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/prompt_manager.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/py.typed +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/settings.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/storage/__init__.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/storage/storage.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/utils/__init__.py +0 -0
- {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/utils/deploy.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ai-pipeline-core
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Core utilities for AI-powered processing pipelines using prefect
|
|
5
5
|
Project-URL: Homepage, https://github.com/bbarwik/ai-pipeline-core
|
|
6
6
|
Project-URL: Repository, https://github.com/bbarwik/ai-pipeline-core
|
|
@@ -63,7 +63,7 @@ AI Pipeline Core is a production-ready framework that combines document processi
|
|
|
63
63
|
- **Structured Output**: Type-safe generation with Pydantic model validation
|
|
64
64
|
- **Workflow Orchestration**: Prefect-based flows and tasks with automatic retries
|
|
65
65
|
- **Observability**: Built-in distributed tracing via Laminar (LMNR) with cost tracking for debugging and monitoring
|
|
66
|
-
- **
|
|
66
|
+
- **Deployment**: Unified pipeline execution for local, CLI, and production environments
|
|
67
67
|
|
|
68
68
|
## Installation
|
|
69
69
|
|
|
@@ -177,7 +177,7 @@ doc = MyDocument.create(
|
|
|
177
177
|
# Parse back to original type
|
|
178
178
|
data = doc.parse(dict) # Returns {"key": "value"}
|
|
179
179
|
|
|
180
|
-
# Document provenance tracking
|
|
180
|
+
# Document provenance tracking
|
|
181
181
|
doc_with_sources = MyDocument.create(
|
|
182
182
|
name="derived.json",
|
|
183
183
|
content={"result": "processed"},
|
|
@@ -224,15 +224,15 @@ if doc.is_text:
|
|
|
224
224
|
# Parse structured data
|
|
225
225
|
data = doc.as_json() # or as_yaml(), as_pydantic_model()
|
|
226
226
|
|
|
227
|
-
# Convert between document types
|
|
227
|
+
# Convert between document types
|
|
228
228
|
task_doc = flow_doc.model_convert(TaskDocument) # Convert FlowDocument to TaskDocument
|
|
229
229
|
new_doc = doc.model_convert(OtherDocType, content={"new": "data"}) # With content update
|
|
230
230
|
|
|
231
|
-
# Enhanced filtering
|
|
231
|
+
# Enhanced filtering
|
|
232
232
|
filtered = documents.filter_by([Doc1, Doc2, Doc3]) # Multiple types
|
|
233
233
|
named = documents.filter_by(["file1.txt", "file2.txt"]) # Multiple names
|
|
234
234
|
|
|
235
|
-
# Immutable collections
|
|
235
|
+
# Immutable collections
|
|
236
236
|
frozen_docs = DocumentList(docs, frozen=True) # Immutable document list
|
|
237
237
|
frozen_msgs = AIMessages(messages, frozen=True) # Immutable message list
|
|
238
238
|
```
|
|
@@ -268,7 +268,7 @@ r2 = await llm.generate(
|
|
|
268
268
|
messages="Key points?" # Different query
|
|
269
269
|
)
|
|
270
270
|
|
|
271
|
-
# Custom cache TTL
|
|
271
|
+
# Custom cache TTL
|
|
272
272
|
response = await llm.generate(
|
|
273
273
|
model="gpt-5",
|
|
274
274
|
context=static_context,
|
|
@@ -317,12 +317,12 @@ from ai_pipeline_core import pipeline_flow, pipeline_task, set_trace_cost
|
|
|
317
317
|
@pipeline_task # Automatic retry, tracing, and monitoring
|
|
318
318
|
async def process_chunk(data: str) -> str:
|
|
319
319
|
result = await transform(data)
|
|
320
|
-
set_trace_cost(0.05) # Track costs
|
|
320
|
+
set_trace_cost(0.05) # Track costs
|
|
321
321
|
return result
|
|
322
322
|
|
|
323
323
|
@pipeline_flow(
|
|
324
324
|
config=MyFlowConfig,
|
|
325
|
-
trace_trim_documents=True # Trim large documents in traces
|
|
325
|
+
trace_trim_documents=True # Trim large documents in traces
|
|
326
326
|
)
|
|
327
327
|
async def main_flow(
|
|
328
328
|
project_name: str,
|
|
@@ -458,18 +458,21 @@ For AI assistants:
|
|
|
458
458
|
```
|
|
459
459
|
ai-pipeline-core/
|
|
460
460
|
├── ai_pipeline_core/
|
|
461
|
-
│ ├──
|
|
462
|
-
│ ├──
|
|
463
|
-
│ ├──
|
|
464
|
-
│ ├──
|
|
465
|
-
│ ├──
|
|
466
|
-
│ ├──
|
|
461
|
+
│ ├── deployment/ # Pipeline deployment and execution
|
|
462
|
+
│ ├── documents/ # Document abstraction system
|
|
463
|
+
│ ├── flow/ # Flow configuration and options
|
|
464
|
+
│ ├── llm/ # LLM client and response handling
|
|
465
|
+
│ ├── logging/ # Logging infrastructure
|
|
466
|
+
│ ├── prompt_builder/ # Document-aware prompt construction
|
|
467
|
+
│ ├── pipeline.py # Pipeline decorators
|
|
468
|
+
│ ├── progress.py # Intra-flow progress tracking
|
|
467
469
|
│ ├── prompt_manager.py # Jinja2 template management
|
|
468
|
-
│
|
|
469
|
-
|
|
470
|
-
├──
|
|
471
|
-
├──
|
|
472
|
-
|
|
470
|
+
│ ├── settings.py # Configuration management
|
|
471
|
+
│ └── tracing.py # Distributed tracing
|
|
472
|
+
├── tests/ # Comprehensive test suite
|
|
473
|
+
├── examples/ # Usage examples
|
|
474
|
+
├── API.md # Complete API reference
|
|
475
|
+
└── pyproject.toml # Project configuration
|
|
473
476
|
```
|
|
474
477
|
|
|
475
478
|
## Contributing
|
|
@@ -18,7 +18,7 @@ AI Pipeline Core is a production-ready framework that combines document processi
|
|
|
18
18
|
- **Structured Output**: Type-safe generation with Pydantic model validation
|
|
19
19
|
- **Workflow Orchestration**: Prefect-based flows and tasks with automatic retries
|
|
20
20
|
- **Observability**: Built-in distributed tracing via Laminar (LMNR) with cost tracking for debugging and monitoring
|
|
21
|
-
- **
|
|
21
|
+
- **Deployment**: Unified pipeline execution for local, CLI, and production environments
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
@@ -132,7 +132,7 @@ doc = MyDocument.create(
|
|
|
132
132
|
# Parse back to original type
|
|
133
133
|
data = doc.parse(dict) # Returns {"key": "value"}
|
|
134
134
|
|
|
135
|
-
# Document provenance tracking
|
|
135
|
+
# Document provenance tracking
|
|
136
136
|
doc_with_sources = MyDocument.create(
|
|
137
137
|
name="derived.json",
|
|
138
138
|
content={"result": "processed"},
|
|
@@ -179,15 +179,15 @@ if doc.is_text:
|
|
|
179
179
|
# Parse structured data
|
|
180
180
|
data = doc.as_json() # or as_yaml(), as_pydantic_model()
|
|
181
181
|
|
|
182
|
-
# Convert between document types
|
|
182
|
+
# Convert between document types
|
|
183
183
|
task_doc = flow_doc.model_convert(TaskDocument) # Convert FlowDocument to TaskDocument
|
|
184
184
|
new_doc = doc.model_convert(OtherDocType, content={"new": "data"}) # With content update
|
|
185
185
|
|
|
186
|
-
# Enhanced filtering
|
|
186
|
+
# Enhanced filtering
|
|
187
187
|
filtered = documents.filter_by([Doc1, Doc2, Doc3]) # Multiple types
|
|
188
188
|
named = documents.filter_by(["file1.txt", "file2.txt"]) # Multiple names
|
|
189
189
|
|
|
190
|
-
# Immutable collections
|
|
190
|
+
# Immutable collections
|
|
191
191
|
frozen_docs = DocumentList(docs, frozen=True) # Immutable document list
|
|
192
192
|
frozen_msgs = AIMessages(messages, frozen=True) # Immutable message list
|
|
193
193
|
```
|
|
@@ -223,7 +223,7 @@ r2 = await llm.generate(
|
|
|
223
223
|
messages="Key points?" # Different query
|
|
224
224
|
)
|
|
225
225
|
|
|
226
|
-
# Custom cache TTL
|
|
226
|
+
# Custom cache TTL
|
|
227
227
|
response = await llm.generate(
|
|
228
228
|
model="gpt-5",
|
|
229
229
|
context=static_context,
|
|
@@ -272,12 +272,12 @@ from ai_pipeline_core import pipeline_flow, pipeline_task, set_trace_cost
|
|
|
272
272
|
@pipeline_task # Automatic retry, tracing, and monitoring
|
|
273
273
|
async def process_chunk(data: str) -> str:
|
|
274
274
|
result = await transform(data)
|
|
275
|
-
set_trace_cost(0.05) # Track costs
|
|
275
|
+
set_trace_cost(0.05) # Track costs
|
|
276
276
|
return result
|
|
277
277
|
|
|
278
278
|
@pipeline_flow(
|
|
279
279
|
config=MyFlowConfig,
|
|
280
|
-
trace_trim_documents=True # Trim large documents in traces
|
|
280
|
+
trace_trim_documents=True # Trim large documents in traces
|
|
281
281
|
)
|
|
282
282
|
async def main_flow(
|
|
283
283
|
project_name: str,
|
|
@@ -413,18 +413,21 @@ For AI assistants:
|
|
|
413
413
|
```
|
|
414
414
|
ai-pipeline-core/
|
|
415
415
|
├── ai_pipeline_core/
|
|
416
|
-
│ ├──
|
|
417
|
-
│ ├──
|
|
418
|
-
│ ├──
|
|
419
|
-
│ ├──
|
|
420
|
-
│ ├──
|
|
421
|
-
│ ├──
|
|
416
|
+
│ ├── deployment/ # Pipeline deployment and execution
|
|
417
|
+
│ ├── documents/ # Document abstraction system
|
|
418
|
+
│ ├── flow/ # Flow configuration and options
|
|
419
|
+
│ ├── llm/ # LLM client and response handling
|
|
420
|
+
│ ├── logging/ # Logging infrastructure
|
|
421
|
+
│ ├── prompt_builder/ # Document-aware prompt construction
|
|
422
|
+
│ ├── pipeline.py # Pipeline decorators
|
|
423
|
+
│ ├── progress.py # Intra-flow progress tracking
|
|
422
424
|
│ ├── prompt_manager.py # Jinja2 template management
|
|
423
|
-
│
|
|
424
|
-
|
|
425
|
-
├──
|
|
426
|
-
├──
|
|
427
|
-
|
|
425
|
+
│ ├── settings.py # Configuration management
|
|
426
|
+
│ └── tracing.py # Distributed tracing
|
|
427
|
+
├── tests/ # Comprehensive test suite
|
|
428
|
+
├── examples/ # Usage examples
|
|
429
|
+
├── API.md # Complete API reference
|
|
430
|
+
└── pyproject.toml # Project configuration
|
|
428
431
|
```
|
|
429
432
|
|
|
430
433
|
## Contributing
|
|
@@ -82,7 +82,8 @@ Optional Environment Variables:
|
|
|
82
82
|
- LMNR_DEBUG: Set to "true" to enable debug-level traces
|
|
83
83
|
"""
|
|
84
84
|
|
|
85
|
-
from . import llm
|
|
85
|
+
from . import llm, progress
|
|
86
|
+
from .deployment import DeploymentContext, DeploymentResult, PipelineDeployment
|
|
86
87
|
from .documents import (
|
|
87
88
|
Document,
|
|
88
89
|
DocumentList,
|
|
@@ -114,11 +115,13 @@ from .logging import (
|
|
|
114
115
|
from .logging import get_pipeline_logger as get_logger
|
|
115
116
|
from .pipeline import pipeline_flow, pipeline_task
|
|
116
117
|
from .prefect import disable_run_logger, prefect_test_harness
|
|
118
|
+
from .prompt_builder import EnvironmentVariable, PromptBuilder
|
|
117
119
|
from .prompt_manager import PromptManager
|
|
118
120
|
from .settings import Settings
|
|
119
121
|
from .tracing import TraceInfo, TraceLevel, set_trace_cost, trace
|
|
122
|
+
from .utils.remote_deployment import remote_deployment
|
|
120
123
|
|
|
121
|
-
__version__ = "0.
|
|
124
|
+
__version__ = "0.3.0"
|
|
122
125
|
|
|
123
126
|
__all__ = [
|
|
124
127
|
# Config/Settings
|
|
@@ -148,6 +151,12 @@ __all__ = [
|
|
|
148
151
|
# Prefect decorators (clean, no tracing)
|
|
149
152
|
"prefect_test_harness",
|
|
150
153
|
"disable_run_logger",
|
|
154
|
+
# Deployment
|
|
155
|
+
"PipelineDeployment",
|
|
156
|
+
"DeploymentContext",
|
|
157
|
+
"DeploymentResult",
|
|
158
|
+
"remote_deployment",
|
|
159
|
+
"progress",
|
|
151
160
|
# LLM
|
|
152
161
|
"llm", # for backward compatibility
|
|
153
162
|
"generate",
|
|
@@ -163,8 +172,9 @@ __all__ = [
|
|
|
163
172
|
"TraceLevel",
|
|
164
173
|
"TraceInfo",
|
|
165
174
|
"set_trace_cost",
|
|
175
|
+
# Prompt Builder
|
|
176
|
+
"PromptBuilder",
|
|
177
|
+
"EnvironmentVariable",
|
|
166
178
|
# Utils
|
|
167
179
|
"PromptManager",
|
|
168
|
-
"generate",
|
|
169
|
-
"generate_structured",
|
|
170
180
|
]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Pipeline deployment utilities for unified, type-safe deployments.
|
|
2
|
+
|
|
3
|
+
@public
|
|
4
|
+
|
|
5
|
+
This module provides the PipelineDeployment base class and related types
|
|
6
|
+
for creating pipeline deployments that work seamlessly across local testing,
|
|
7
|
+
CLI execution, and production Prefect deployments.
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
>>> from ai_pipeline_core import PipelineDeployment, DeploymentContext, DeploymentResult
|
|
11
|
+
>>>
|
|
12
|
+
>>> class MyResult(DeploymentResult):
|
|
13
|
+
... report: str
|
|
14
|
+
>>>
|
|
15
|
+
>>> class MyPipeline(PipelineDeployment[MyOptions, MyResult]):
|
|
16
|
+
... flows = [step_01, step_02]
|
|
17
|
+
...
|
|
18
|
+
... @staticmethod
|
|
19
|
+
... def build_result(project_name, documents, options):
|
|
20
|
+
... return MyResult(success=True, report="Done")
|
|
21
|
+
>>>
|
|
22
|
+
>>> pipeline = MyPipeline()
|
|
23
|
+
>>> result = pipeline.run_local("test", documents, options)
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
from .base import DeploymentContext, DeploymentResult, PipelineDeployment
|
|
27
|
+
from .contract import (
|
|
28
|
+
CompletedRun,
|
|
29
|
+
DeploymentResultData,
|
|
30
|
+
FailedRun,
|
|
31
|
+
PendingRun,
|
|
32
|
+
ProgressRun,
|
|
33
|
+
RunResponse,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
__all__ = [
|
|
37
|
+
"CompletedRun",
|
|
38
|
+
"DeploymentContext",
|
|
39
|
+
"DeploymentResult",
|
|
40
|
+
"DeploymentResultData",
|
|
41
|
+
"FailedRun",
|
|
42
|
+
"PendingRun",
|
|
43
|
+
"PipelineDeployment",
|
|
44
|
+
"ProgressRun",
|
|
45
|
+
"RunResponse",
|
|
46
|
+
]
|