ai-pipeline-core 0.2.1__tar.gz → 0.2.2__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 (39) hide show
  1. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/PKG-INFO +1 -1
  2. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/__init__.py +1 -1
  3. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/llm/client.py +4 -4
  4. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/llm/model_options.py +13 -7
  5. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/llm/model_response.py +2 -1
  6. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/pyproject.toml +2 -2
  7. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/.gitignore +0 -0
  8. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/LICENSE +0 -0
  9. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/README.md +0 -0
  10. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/documents/__init__.py +0 -0
  11. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/documents/document.py +0 -0
  12. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/documents/document_list.py +0 -0
  13. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/documents/flow_document.py +0 -0
  14. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/documents/mime_type.py +0 -0
  15. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/documents/task_document.py +0 -0
  16. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/documents/temporary_document.py +0 -0
  17. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/documents/utils.py +0 -0
  18. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/exceptions.py +0 -0
  19. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/flow/__init__.py +0 -0
  20. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/flow/config.py +0 -0
  21. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/flow/options.py +0 -0
  22. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/llm/__init__.py +0 -0
  23. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/llm/ai_messages.py +0 -0
  24. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/llm/model_types.py +0 -0
  25. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/logging/__init__.py +0 -0
  26. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/logging/logging.yml +0 -0
  27. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/logging/logging_config.py +0 -0
  28. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/logging/logging_mixin.py +0 -0
  29. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/pipeline.py +0 -0
  30. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/prefect.py +0 -0
  31. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/prompt_manager.py +0 -0
  32. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/py.typed +0 -0
  33. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/settings.py +0 -0
  34. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/simple_runner/__init__.py +0 -0
  35. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/simple_runner/cli.py +0 -0
  36. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/simple_runner/simple_runner.py +0 -0
  37. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/storage/__init__.py +0 -0
  38. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/storage/storage.py +0 -0
  39. {ai_pipeline_core-0.2.1 → ai_pipeline_core-0.2.2}/ai_pipeline_core/tracing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ai-pipeline-core
3
- Version: 0.2.1
3
+ Version: 0.2.2
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
@@ -118,7 +118,7 @@ from .prompt_manager import PromptManager
118
118
  from .settings import Settings
119
119
  from .tracing import TraceInfo, TraceLevel, set_trace_cost, trace
120
120
 
121
- __version__ = "0.2.1"
121
+ __version__ = "0.2.2"
122
122
 
123
123
  __all__ = [
124
124
  # Config/Settings
@@ -37,7 +37,7 @@ def _process_messages(
37
37
  context: AIMessages,
38
38
  messages: AIMessages,
39
39
  system_prompt: str | None = None,
40
- cache_ttl: str | None = "120s",
40
+ cache_ttl: str | None = "5m",
41
41
  ) -> list[ChatCompletionMessageParam]:
42
42
  """Process and format messages for LLM API consumption.
43
43
 
@@ -245,7 +245,7 @@ async def generate(
245
245
  model: Model to use (e.g., "gpt-5", "gemini-2.5-pro", "grok-4").
246
246
  Accepts predefined models or any string for custom models.
247
247
  context: Static context to cache (documents, examples, instructions).
248
- Defaults to None (empty context). Cached for 120 seconds.
248
+ Defaults to None (empty context). Cached for 5 minutes by default.
249
249
  messages: Dynamic messages/queries. AIMessages or str ONLY.
250
250
  Do not pass Document or DocumentList directly.
251
251
  If string, converted to AIMessages internally.
@@ -338,13 +338,13 @@ async def generate(
338
338
  - Context caching saves ~50-90% tokens on repeated calls
339
339
  - First call: full token cost
340
340
  - Subsequent calls (within cache TTL): only messages tokens
341
- - Default cache TTL is 120s (production-optimized)
341
+ - Default cache TTL is 5m (production-optimized)
342
342
  - Default retry logic: 3 attempts with 10s delay (production-optimized)
343
343
 
344
344
  Caching:
345
345
  When enabled in your LiteLLM proxy and supported by the upstream provider,
346
346
  context messages may be cached to reduce token usage on repeated calls.
347
- Default TTL is 120s (optimized for production workloads). Configure caching
347
+ Default TTL is 5m (optimized for production workloads). Configure caching
348
348
  behavior centrally via your LiteLLM proxy settings, not per API call.
349
349
  Savings depend on provider and payload; treat this as an optimization, not a guarantee.
350
350
 
@@ -45,7 +45,7 @@ class ModelOptions(BaseModel):
45
45
 
46
46
  timeout: Maximum seconds to wait for response (default: 300).
47
47
 
48
- cache_ttl: Cache TTL for context messages (default: "120s").
48
+ cache_ttl: Cache TTL for context messages (default: "5m").
49
49
  String format like "60s", "5m", or None to disable caching.
50
50
  Applied to the last context message for efficient token reuse.
51
51
 
@@ -109,7 +109,7 @@ class ModelOptions(BaseModel):
109
109
  - search_context_size only works with search models
110
110
  - reasoning_effort only works with models that support explicit reasoning
111
111
  - response_format is set internally by generate_structured()
112
- - cache_ttl accepts formats like "120s", "5m", "1h" or None to disable caching
112
+ - cache_ttl accepts formats like "120s", "5m" (default), "1h" or None to disable caching
113
113
  """
114
114
 
115
115
  temperature: float | None = None
@@ -118,11 +118,13 @@ class ModelOptions(BaseModel):
118
118
  reasoning_effort: Literal["low", "medium", "high"] | None = None
119
119
  retries: int = 3
120
120
  retry_delay_seconds: int = 10
121
- timeout: int = 300
122
- cache_ttl: str | None = "120s"
121
+ timeout: int = 600
122
+ cache_ttl: str | None = "5m"
123
123
  service_tier: Literal["auto", "default", "flex", "scale", "priority"] | None = None
124
124
  max_completion_tokens: int | None = None
125
125
  response_format: type[BaseModel] | None = None
126
+ verbosity: Literal["low", "medium", "high"] | None = None
127
+ usage_tracking: bool = True
126
128
 
127
129
  def to_openai_completion_kwargs(self) -> dict[str, Any]:
128
130
  """Convert options to OpenAI API completion parameters.
@@ -163,9 +165,7 @@ class ModelOptions(BaseModel):
163
165
  """
164
166
  kwargs: dict[str, Any] = {
165
167
  "timeout": self.timeout,
166
- "extra_body": {
167
- "usage": {"include": True}, # For openrouter cost tracking
168
- },
168
+ "extra_body": {},
169
169
  }
170
170
 
171
171
  if self.temperature:
@@ -186,4 +186,10 @@ class ModelOptions(BaseModel):
186
186
  if self.service_tier:
187
187
  kwargs["service_tier"] = self.service_tier
188
188
 
189
+ if self.verbosity:
190
+ kwargs["verbosity"] = self.verbosity
191
+
192
+ if self.usage_tracking:
193
+ kwargs["extra_body"]["usage"] = {"include": True}
194
+
189
195
  return kwargs
@@ -110,7 +110,8 @@ class ModelResponse(ChatCompletion):
110
110
  >>> if "error" in response.content.lower():
111
111
  ... # Handle error case
112
112
  """
113
- return self.choices[0].message.content or ""
113
+ content = self.choices[0].message.content or ""
114
+ return content.split("</think>")[-1].strip()
114
115
 
115
116
  def set_model_options(self, options: dict[str, Any]) -> None:
116
117
  """Store the model configuration used for generation.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ai-pipeline-core"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "Core utilities for AI-powered processing pipelines using prefect"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}
@@ -177,7 +177,7 @@ reportIncompatibleVariableOverride = "error"
177
177
  reportMissingParameterType = "warning"
178
178
 
179
179
  [tool.bumpversion]
180
- current_version = "0.2.1"
180
+ current_version = "0.2.2"
181
181
  commit = true
182
182
  tag = true
183
183
  tag_name = "v{new_version}"