ai-pipeline-core 0.1.2__tar.gz → 0.1.3__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.1.2 → ai_pipeline_core-0.1.3}/PKG-INFO +1 -1
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/documents/document.py +27 -6
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/llm/client.py +1 -1
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/pyproject.toml +2 -2
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/.gitignore +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/LICENSE +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/README.md +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/__init__.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/documents/__init__.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/documents/document_list.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/documents/flow_document.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/documents/mime_type.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/documents/task_document.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/documents/utils.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/exceptions.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/flow/__init__.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/flow/config.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/llm/__init__.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/llm/ai_messages.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/llm/model_options.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/llm/model_response.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/llm/model_types.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/logging/__init__.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/logging/logging.yml +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/logging/logging_config.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/logging/logging_mixin.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/prompt_manager.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/py.typed +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/settings.py +0 -0
- {ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/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.1.
|
|
3
|
+
Version: 0.1.3
|
|
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
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import base64
|
|
2
2
|
import hashlib
|
|
3
3
|
import json
|
|
4
|
+
import re
|
|
4
5
|
from abc import ABC, abstractmethod
|
|
5
6
|
from base64 import b32encode
|
|
6
7
|
from enum import StrEnum
|
|
@@ -26,6 +27,7 @@ class Document(BaseModel, ABC):
|
|
|
26
27
|
|
|
27
28
|
MAX_CONTENT_SIZE: ClassVar[int] = 10 * 1024 * 1024 # 10MB default
|
|
28
29
|
DESCRIPTION_EXTENSION: ClassVar[str] = ".description.md"
|
|
30
|
+
MARKDOWN_LIST_SEPARATOR: ClassVar[str] = "\n\n---\n\n"
|
|
29
31
|
|
|
30
32
|
def __init__(self, **data: Any) -> None:
|
|
31
33
|
"""Prevent direct instantiation of abstract Document class."""
|
|
@@ -199,15 +201,34 @@ class Document(BaseModel, ABC):
|
|
|
199
201
|
|
|
200
202
|
def as_yaml(self) -> Any:
|
|
201
203
|
"""Parse document as YAML"""
|
|
202
|
-
|
|
203
|
-
raise ValueError(f"Document is not text: {self.name}")
|
|
204
|
-
return YAML().load(self.content.decode("utf-8")) # type: ignore
|
|
204
|
+
return YAML().load(self.as_text())
|
|
205
205
|
|
|
206
206
|
def as_json(self) -> Any:
|
|
207
207
|
"""Parse document as JSON"""
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
return json.loads(self.as_text())
|
|
209
|
+
|
|
210
|
+
def as_markdown_list(self) -> list[str]:
|
|
211
|
+
"""Parse document as a markdown list"""
|
|
212
|
+
return self.as_text().split(self.MARKDOWN_LIST_SEPARATOR)
|
|
213
|
+
|
|
214
|
+
@classmethod
|
|
215
|
+
def create(cls, name: str, description: str | None, content: bytes | str) -> Self:
|
|
216
|
+
"""Create a document from a name, description, and content"""
|
|
217
|
+
if isinstance(content, str):
|
|
218
|
+
content = content.encode("utf-8")
|
|
219
|
+
return cls(name=name, description=description, content=content)
|
|
220
|
+
|
|
221
|
+
@classmethod
|
|
222
|
+
def create_as_markdown_list(cls, name: str, description: str | None, items: list[str]) -> Self:
|
|
223
|
+
"""Create a document from a name, description, and list of strings"""
|
|
224
|
+
# remove other list separators (lines that are only the separator + whitespace)
|
|
225
|
+
separator = Document.MARKDOWN_LIST_SEPARATOR.strip()
|
|
226
|
+
pattern = re.compile(rf"^[ \t]*{re.escape(separator)}[ \t]*(?:\r?\n|$)", flags=re.MULTILINE)
|
|
227
|
+
# Normalize CRLF/CR to LF before cleaning to ensure consistent behavior
|
|
228
|
+
normalized_items = [re.sub(r"\r\n?", "\n", item) for item in items]
|
|
229
|
+
cleaned_items = [pattern.sub("", item) for item in normalized_items]
|
|
230
|
+
content = Document.MARKDOWN_LIST_SEPARATOR.join(cleaned_items)
|
|
231
|
+
return cls.create(name, description, content)
|
|
211
232
|
|
|
212
233
|
def serialize_model(self) -> dict[str, Any]:
|
|
213
234
|
"""Serialize document to a dictionary with proper encoding."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ai-pipeline-core"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.3"
|
|
4
4
|
description = "Core utilities for AI-powered processing pipelines using prefect"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = {text = "MIT"}
|
|
@@ -140,7 +140,7 @@ reportIncompatibleVariableOverride = "error"
|
|
|
140
140
|
reportMissingParameterType = "warning"
|
|
141
141
|
|
|
142
142
|
[tool.bumpversion]
|
|
143
|
-
current_version = "0.1.
|
|
143
|
+
current_version = "0.1.3"
|
|
144
144
|
commit = true
|
|
145
145
|
tag = true
|
|
146
146
|
tag_name = "v{new_version}"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/documents/document_list.py
RENAMED
|
File without changes
|
{ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/documents/flow_document.py
RENAMED
|
File without changes
|
|
File without changes
|
{ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/documents/task_document.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ai_pipeline_core-0.1.2 → ai_pipeline_core-0.1.3}/ai_pipeline_core/logging/logging_config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|