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.
Files changed (54) hide show
  1. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/.gitignore +4 -0
  2. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/PKG-INFO +23 -20
  3. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/README.md +22 -19
  4. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/__init__.py +14 -4
  5. ai_pipeline_core-0.3.0/ai_pipeline_core/deployment/__init__.py +46 -0
  6. ai_pipeline_core-0.3.0/ai_pipeline_core/deployment/base.py +681 -0
  7. ai_pipeline_core-0.3.0/ai_pipeline_core/deployment/contract.py +84 -0
  8. ai_pipeline_core-0.3.0/ai_pipeline_core/deployment/helpers.py +98 -0
  9. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/flow_document.py +1 -1
  10. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/task_document.py +1 -1
  11. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/temporary_document.py +1 -1
  12. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/flow/config.py +13 -2
  13. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/flow/options.py +1 -1
  14. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/llm/client.py +22 -23
  15. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/llm/model_response.py +6 -3
  16. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/llm/model_types.py +0 -1
  17. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/pipeline.py +1 -1
  18. ai_pipeline_core-0.3.0/ai_pipeline_core/progress.py +127 -0
  19. ai_pipeline_core-0.3.0/ai_pipeline_core/prompt_builder/__init__.py +5 -0
  20. ai_pipeline_core-0.3.0/ai_pipeline_core/prompt_builder/documents_prompt.jinja2 +23 -0
  21. ai_pipeline_core-0.3.0/ai_pipeline_core/prompt_builder/global_cache.py +78 -0
  22. ai_pipeline_core-0.3.0/ai_pipeline_core/prompt_builder/new_core_documents_prompt.jinja2 +6 -0
  23. ai_pipeline_core-0.3.0/ai_pipeline_core/prompt_builder/prompt_builder.py +253 -0
  24. ai_pipeline_core-0.3.0/ai_pipeline_core/prompt_builder/system_prompt.jinja2 +41 -0
  25. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/tracing.py +1 -1
  26. ai_pipeline_core-0.3.0/ai_pipeline_core/utils/remote_deployment.py +119 -0
  27. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/pyproject.toml +7 -5
  28. ai_pipeline_core-0.2.8/ai_pipeline_core/simple_runner/__init__.py +0 -14
  29. ai_pipeline_core-0.2.8/ai_pipeline_core/simple_runner/cli.py +0 -254
  30. ai_pipeline_core-0.2.8/ai_pipeline_core/simple_runner/simple_runner.py +0 -247
  31. ai_pipeline_core-0.2.8/ai_pipeline_core/utils/remote_deployment.py +0 -269
  32. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/LICENSE +0 -0
  33. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/__init__.py +0 -0
  34. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/document.py +0 -0
  35. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/document_list.py +0 -0
  36. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/mime_type.py +0 -0
  37. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/documents/utils.py +0 -0
  38. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/exceptions.py +0 -0
  39. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/flow/__init__.py +0 -0
  40. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/llm/__init__.py +0 -0
  41. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/llm/ai_messages.py +0 -0
  42. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/llm/model_options.py +0 -0
  43. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/logging/__init__.py +0 -0
  44. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/logging/logging.yml +0 -0
  45. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/logging/logging_config.py +0 -0
  46. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/logging/logging_mixin.py +0 -0
  47. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/prefect.py +0 -0
  48. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/prompt_manager.py +0 -0
  49. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/py.typed +0 -0
  50. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/settings.py +0 -0
  51. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/storage/__init__.py +0 -0
  52. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/storage/storage.py +0 -0
  53. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/utils/__init__.py +0 -0
  54. {ai_pipeline_core-0.2.8 → ai_pipeline_core-0.3.0}/ai_pipeline_core/utils/deploy.py +0 -0
@@ -66,6 +66,10 @@ instance/
66
66
  # Scrapy stuff:
67
67
  .scrapy
68
68
 
69
+ # claude and cursor
70
+ .claude
71
+ .cursor
72
+
69
73
  # Sphinx documentation
70
74
  docs/_build/
71
75
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ai-pipeline-core
3
- Version: 0.2.8
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
- - **Local Development**: Simple runner for testing pipelines without infrastructure
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 (new in v0.1.14)
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 (new in v0.2.1)
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 (new in v0.1.14)
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 (new in v0.2.1)
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 (new in v0.1.14)
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 (new in v0.1.14)
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 (new in v0.2.1)
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
- │ ├── documents/ # Document abstraction system
462
- │ ├── flow/ # Flow configuration and options
463
- │ ├── llm/ # LLM client and response handling
464
- │ ├── logging/ # Logging infrastructure
465
- │ ├── tracing.py # Distributed tracing
466
- │ ├── pipeline.py # Pipeline decorators
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
- └── settings.py # Configuration management
469
- ├── tests/ # Comprehensive test suite
470
- ├── examples/ # Usage examples
471
- ├── API.md # Complete API reference
472
- └── pyproject.toml # Project configuration
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
- - **Local Development**: Simple runner for testing pipelines without infrastructure
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 (new in v0.1.14)
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 (new in v0.2.1)
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 (new in v0.1.14)
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 (new in v0.2.1)
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 (new in v0.1.14)
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 (new in v0.1.14)
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 (new in v0.2.1)
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
- │ ├── documents/ # Document abstraction system
417
- │ ├── flow/ # Flow configuration and options
418
- │ ├── llm/ # LLM client and response handling
419
- │ ├── logging/ # Logging infrastructure
420
- │ ├── tracing.py # Distributed tracing
421
- │ ├── pipeline.py # Pipeline decorators
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
- └── settings.py # Configuration management
424
- ├── tests/ # Comprehensive test suite
425
- ├── examples/ # Usage examples
426
- ├── API.md # Complete API reference
427
- └── pyproject.toml # Project configuration
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.2.8"
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
+ ]