Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

dev to release/v0.13.2 (#393)

Thomas Hebrard973ae698d33e
diff --git a/.cursor/rules/run_pipelex.mdc b/.cursor/rules/run_pipelex.mdc
index eebaa223c..838783897 100644
--- a/.cursor/rules/run_pipelex.mdc
+++ b/.cursor/rules/run_pipelex.mdc
@@ -55,7 +55,7 @@ async def extract_gantt(image_url: str) -> GanttChart:
# Run the pipe
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -94,7 +94,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
# If you assign a string, by default it will be considered as a TextContent.
pipe_output = await execute_pipeline(
pipe_code="master_advisory_orchestrator",
- input_memory={
+ inputs={
"user_input": problem_description,
},
)
@@ -104,7 +104,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
# the system knows what content it corresponds to:
pipe_output = await execute_pipeline(
pipe_code="power_extractor_dpe",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
@@ -113,7 +113,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
# Because ImageContent is a native concept, we can use it directly as a value:
pipe_output = await execute_pipeline(
pipe_code="fashion_variation_pipeline",
- input_memory={
+ inputs={
"fashion_photo": ImageContent(url=image_url),
},
)
@@ -123,7 +123,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
# so we must provide it using a dict with the concept and the content:
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -135,7 +135,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
pipe_output = await execute_pipeline(
pipe_code="retrieve_then_answer",
dynamic_output_concept_code="contracts.Fees",
- input_memory={
+ inputs={
"text": load_text_from_path(path=text_path),
"question": {
"concept": "answer.Question",
diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
index b467128ac..06a223540 100644
--- a/.github/copilot-instructions.md
+++ b/.github/copilot-instructions.md
@@ -899,7 +899,7 @@ async def extract_gantt(image_url: str) -> GanttChart:
# Run the pipe
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -938,7 +938,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## If you assign a string, by default it will be considered as a TextContent.
pipe_output = await execute_pipeline(
pipe_code="master_advisory_orchestrator",
- input_memory={
+ inputs={
"user_input": problem_description,
},
)
@@ -948,7 +948,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## the system knows what content it corresponds to:
pipe_output = await execute_pipeline(
pipe_code="power_extractor_dpe",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
@@ -957,7 +957,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## Because ImageContent is a native concept, we can use it directly as a value:
pipe_output = await execute_pipeline(
pipe_code="fashion_variation_pipeline",
- input_memory={
+ inputs={
"fashion_photo": ImageContent(url=image_url),
},
)
@@ -967,7 +967,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## so we must provide it using a dict with the concept and the content:
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -979,7 +979,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
pipe_output = await execute_pipeline(
pipe_code="retrieve_then_answer",
dynamic_output_concept_code="contracts.Fees",
- input_memory={
+ inputs={
"text": load_text_from_path(path=text_path),
"question": {
"concept": "answer.Question",
diff --git a/.pipelex/inference/backends/azure_openai.toml b/.pipelex/inference/backends/azure_openai.toml
index 26e01b4e1..5943007c4 100644
--- a/.pipelex/inference/backends/azure_openai.toml
+++ b/.pipelex/inference/backends/azure_openai.toml
@@ -96,3 +96,8 @@ inputs = ["text", "images"]
outputs = ["text", "structured"]
costs = { input = 1.25, output = 10.0 }
+[gpt-5]
+model_id = "gpt-5-2025-08-07"
+inputs = ["text", "images"]
+outputs = ["text", "structured"]
+costs = { input = 1.25, output = 10.0 }
diff --git a/.pipelex/inference/backends/pipelex_inference.toml b/.pipelex/inference/backends/pipelex_inference.toml
index d22b08cea..0f5b09cf1 100644
--- a/.pipelex/inference/backends/pipelex_inference.toml
+++ b/.pipelex/inference/backends/pipelex_inference.toml
@@ -75,6 +75,12 @@ inputs = ["text", "images"]
outputs = ["text"]
costs = { input = 1.25, output = 10.00 }
+[gpt-5]
+model_id = "pipelex/gpt-5"
+inputs = ["text", "images"]
+outputs = ["text", "structured"]
+costs = { input = 1.25, output = 10.0 }
+
# --- Claude LLMs --------------------------------------------------------------
["claude-4-sonnet"]
model_id = "pipelex/claude-4-sonnet"
diff --git a/.pipelex/inference/deck/base_deck.toml b/.pipelex/inference/deck/base_deck.toml
index 7cfc55299..7a52ca603 100644
--- a/.pipelex/inference/deck/base_deck.toml
+++ b/.pipelex/inference/deck/base_deck.toml
@@ -66,7 +66,7 @@ llm_cheap = { model = "base-gemini", temperature = 0.1 }
# Generation skills
llm_for_factual_writing = { model = "base-gpt", temperature = 0.1 }
-llm_for_creative_writing = { model = "claude-4.5-sonnet", temperature = 0.9 }
+llm_for_creative_writing = { model = "base-gpt", temperature = 0.9 }
llm_to_write_questions = { model = "gpt-4o-mini", temperature = 0.3 }
# Reasoning skills
diff --git a/.pipelex/pipelex.toml b/.pipelex/pipelex.toml
index e246c84bb..5dc8a89b1 100644
--- a/.pipelex/pipelex.toml
+++ b/.pipelex/pipelex.toml
@@ -1,3 +1,45 @@
+####################################################################################################
+# Pipelex Configuration File
+####################################################################################################
+#
+# This configuration file is copied to your project's .pipelex/ directory when you run:
+# pipelex init config
+#
+# Purpose:
+# - This file allows you to override Pipelex's default settings for your specific project
+# - Feel free to modify any settings below to suit your needs
+# - You can add any configuration sections that exist in the main pipelex.toml
+#
+# Finding Available Settings:
+# - See the full default configuration in: pipelex/pipelex.toml (in the Pipelex package)
+# - See the configuration structure classes in: pipelex/config.py and pipelex/cogt/config_cogt.py
+#
+# Common Customizations:
+# - Logging levels and behavior
+# - Excluded directories for scanning
+# - LLM prompt dumping for debugging
+# - Feature flags for tracking and reporting
+# - Observer and reporting output directories
+#
+####################################################################################################
+
+[pipelex.scan_config]
+excluded_dirs = [
+ ".venv",
+ "venv",
+ "env",
+ ".env",
+ "virtualenv",
+ ".virtualenv",
+ ".git",
+ "__pycache__",
+ ".pytest_cache",
+ ".mypy_cache",
+ ".ruff_cache",
+ "node_modules",
+ "results",
+]
+
[pipelex.log_config]
default_log_level = "INFO"
@@ -5,10 +47,12 @@ default_log_level = "INFO"
pipelex = "INFO"
[cogt.llm_config]
+# Uncomment any of these to enable dumping the inputs or outputs of text-genration with an LLM
# is_dump_text_prompts_enabled = true
# is_dump_response_text_enabled = true
[cogt.llm_config.instructor_config]
+# Uncomment any of these to enable dumping the kwargs, response or errors of the instructor
# is_dump_kwargs_enabled = true
# is_dump_response_enabled = true
# is_dump_error_enabled = true
@@ -18,6 +62,13 @@ observer_dir = "results/observer"
[pipelex.feature_config]
# WIP/Experimental feature flags
-# is_pipeline_tracking_enabled = true
-# is_activity_tracking_enabled = true
+is_pipeline_tracking_enabled = false
is_reporting_enabled = true
+
+[pipelex.reporting_config]
+is_log_costs_to_console = false
+is_generate_cost_report_file_enabled = true
+cost_report_dir_path = "reports"
+cost_report_base_name = "cost_report"
+cost_report_extension = "csv"
+cost_report_unit_scale = 1.0
diff --git a/.pipelex/telemetry.toml b/.pipelex/telemetry.toml
new file mode 100644
index 000000000..327955340
--- /dev/null
+++ b/.pipelex/telemetry.toml
@@ -0,0 +1,9 @@
+telemetry_mode = "anonymous" # Values: "off" | "anonymous" | "identified"
+host = "https://eu.i.posthog.com"
+project_api_key = "phc_HPJnNKpIXh0SxNDYyTAyUtnq9KxNNZJWQszynsWVx4Y"
+respect_dnt = true
+redact = ["prompt", "system_prompt", "response", "file_path", "url"]
+geoip_enabled = true
+dry_mode_enabled = false
+verbose_enabled = false
+user_id = ""
diff --git a/.windsurfrules.md b/.windsurfrules.md
index b467128ac..06a223540 100644
--- a/.windsurfrules.md
+++ b/.windsurfrules.md
@@ -899,7 +899,7 @@ async def extract_gantt(image_url: str) -> GanttChart:
# Run the pipe
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -938,7 +938,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## If you assign a string, by default it will be considered as a TextContent.
pipe_output = await execute_pipeline(
pipe_code="master_advisory_orchestrator",
- input_memory={
+ inputs={
"user_input": problem_description,
},
)
@@ -948,7 +948,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## the system knows what content it corresponds to:
pipe_output = await execute_pipeline(
pipe_code="power_extractor_dpe",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
@@ -957,7 +957,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## Because ImageContent is a native concept, we can use it directly as a value:
pipe_output = await execute_pipeline(
pipe_code="fashion_variation_pipeline",
- input_memory={
+ inputs={
"fashion_photo": ImageContent(url=image_url),
},
)
@@ -967,7 +967,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## so we must provide it using a dict with the concept and the content:
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -979,7 +979,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
pipe_output = await execute_pipeline(
pipe_code="retrieve_then_answer",
dynamic_output_concept_code="contracts.Fees",
- input_memory={
+ inputs={
"text": load_text_from_path(path=text_path),
"question": {
"concept": "answer.Question",
diff --git a/AGENTS.md b/AGENTS.md
index b467128ac..06a223540 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -899,7 +899,7 @@ async def extract_gantt(image_url: str) -> GanttChart:
# Run the pipe
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -938,7 +938,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## If you assign a string, by default it will be considered as a TextContent.
pipe_output = await execute_pipeline(
pipe_code="master_advisory_orchestrator",
- input_memory={
+ inputs={
"user_input": problem_description,
},
)
@@ -948,7 +948,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## the system knows what content it corresponds to:
pipe_output = await execute_pipeline(
pipe_code="power_extractor_dpe",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
@@ -957,7 +957,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## Because ImageContent is a native concept, we can use it directly as a value:
pipe_output = await execute_pipeline(
pipe_code="fashion_variation_pipeline",
- input_memory={
+ inputs={
"fashion_photo": ImageContent(url=image_url),
},
)
@@ -967,7 +967,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## so we must provide it using a dict with the concept and the content:
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -979,7 +979,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
pipe_output = await execute_pipeline(
pipe_code="retrieve_then_answer",
dynamic_output_concept_code="contracts.Fees",
- input_memory={
+ inputs={
"text": load_text_from_path(path=text_path),
"question": {
"concept": "answer.Question",
diff --git a/BLACKBOX_RULES.md b/BLACKBOX_RULES.md
index b467128ac..06a223540 100644
--- a/BLACKBOX_RULES.md
+++ b/BLACKBOX_RULES.md
@@ -899,7 +899,7 @@ async def extract_gantt(image_url: str) -> GanttChart:
# Run the pipe
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -938,7 +938,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## If you assign a string, by default it will be considered as a TextContent.
pipe_output = await execute_pipeline(
pipe_code="master_advisory_orchestrator",
- input_memory={
+ inputs={
"user_input": problem_description,
},
)
@@ -948,7 +948,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## the system knows what content it corresponds to:
pipe_output = await execute_pipeline(
pipe_code="power_extractor_dpe",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
@@ -957,7 +957,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## Because ImageContent is a native concept, we can use it directly as a value:
pipe_output = await execute_pipeline(
pipe_code="fashion_variation_pipeline",
- input_memory={
+ inputs={
"fashion_photo": ImageContent(url=image_url),
},
)
@@ -967,7 +967,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## so we must provide it using a dict with the concept and the content:
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -979,7 +979,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
pipe_output = await execute_pipeline(
pipe_code="retrieve_then_answer",
dynamic_output_concept_code="contracts.Fees",
- input_memory={
+ inputs={
"text": load_text_from_path(path=text_path),
"question": {
"concept": "answer.Question",
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 53b1d2018..20ac69e50 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
# Changelog
+## [v0.13.2] - 2025-10-25
+
+### Added
+
+- Added the `n8n` documentation page for the [n8n-nodes-pipelex](https://github.com/Pipelex/n8n-nodes-pipelex) package.
+- Added optional telemetry system with first-run interactive prompt offering three modes: off (no data collected), anonymous (usage data without identification), and identified (usage data with user identification). Automatically respects `DO_NOT_TRACK` environment variable and redacts sensitive data (prompts, responses, file paths, URLs). Configuration stored in `.pipelex/telemetry.toml`.
+- Added telemetry documentation: user-friendly setup guide and comprehensive configuration reference.
+
+### Changed
+
+- Updated the `PipelexClient` and changed the route of the API calls to `v1/pipeline/execute` and `v1/pipeline/start`.
+- Changed the parameter `input_memory` to `inputs` in the documentaton.
+
## [v0.13.1] - 2025-10-22
### Changed
diff --git a/CLAUDE.md b/CLAUDE.md
index b467128ac..06a223540 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -899,7 +899,7 @@ async def extract_gantt(image_url: str) -> GanttChart:
# Run the pipe
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -938,7 +938,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## If you assign a string, by default it will be considered as a TextContent.
pipe_output = await execute_pipeline(
pipe_code="master_advisory_orchestrator",
- input_memory={
+ inputs={
"user_input": problem_description,
},
)
@@ -948,7 +948,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## the system knows what content it corresponds to:
pipe_output = await execute_pipeline(
pipe_code="power_extractor_dpe",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
@@ -957,7 +957,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## Because ImageContent is a native concept, we can use it directly as a value:
pipe_output = await execute_pipeline(
pipe_code="fashion_variation_pipeline",
- input_memory={
+ inputs={
"fashion_photo": ImageContent(url=image_url),
},
)
@@ -967,7 +967,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
## so we must provide it using a dict with the concept and the content:
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -979,7 +979,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
pipe_output = await execute_pipeline(
pipe_code="retrieve_then_answer",
dynamic_output_concept_code="contracts.Fees",
- input_memory={
+ inputs={
"text": load_text_from_path(path=text_path),
"question": {
"concept": "answer.Question",
diff --git a/PLAN.md b/PLAN.md
deleted file mode 100644
index 900544b65..000000000
--- a/PLAN.md
+++ /dev/null
@@ -1,292 +0,0 @@
-# Goal
-
-Add a `kit` command group that:
-
-1. Exports each `pipelex.kit/agents/*.md` to **Cursor** as `.cursor/rules/*.mdc` (adds YAML front-matter from `index.toml`).
-2. Builds a **merged single-file rules block** from ordered fragments (with `demote=1`) and inserts/updates it in targets (`AGENTS.md`, `CLAUDE.md`, etc.) using **marker spans**.
- All parsing/merging via **markdown-parser-py**; config via **TOML → dict** (`toml_utils`) → **Pydantic v2** models.
-
----
-
-# Package layout (as agreed)
-
-```
-pipelex/kit/
- __init__.py
- index.toml
- agents/
- pytest_standards.md
- python_standards.md
- run_pipelines.md
- write_pipelex.md
- configs/
- ... (as provided)
- migrations/
- ... (optional)
-```
-
----
-
-# Pydantic v2 models (dict → object via `model_validate`)
-
-```python
-# pipelex/kit/index_models.py
-from pydantic import BaseModel, Field
-from typing import Optional, List, Dict, Any
-
-class AgentsMerge(BaseModel):
- order: List[str]
- demote: int = 1
-
-class CursorFileOverride(BaseModel):
- front_matter: Dict[str, Any] = Field(default_factory=dict)
-
-class CursorSpec(BaseModel):
- front_matter: Dict[str, Any] = Field(default_factory=dict)
- files: Dict[str, CursorFileOverride] = Field(default_factory=dict)
-
-class Target(BaseModel):
- id: str
- path: str
- strategy: str # "merge" (for now)
- marker_begin: str
- marker_end: str
- parent: Optional[str] = None
-
-class KitIndex(BaseModel):
- meta: Dict[str, Any] = Field(default_factory=dict)
- agents: AgentsMerge
- cursor: CursorSpec
- targets: List[Target]
-```
-
-**Load `index.toml` using your utils:**
-
-```python
-# pipelex/kit/index_loader.py
-from pipelex.tools.misc.toml_utils import load_toml_from_path, TomlError
-from importlib.resources import files
-from .index_models import KitIndex
-
-def load_index() -> KitIndex:
- path = files("pipelex.kit") / "index.toml"
- data = load_toml_from_path(str(path))
- return KitIndex.model_validate(data)
-```
-
----
-
-# CLI integration (Typer)
-
-Add a **`kit`** sub-app under your existing CLI:
-
-```python
-# pipelex/cli/commands/kit_cmd.py
-import typer
-from pathlib import Path
-from typing_extensions import Annotated
-from pipelex.kit.index_loader import load_index
-from pipelex.kit.paths import get_agents_dir # small helper shown below
-from pipelex.kit.cursor_export import export_cursor_rules
-from pipelex.kit.targets_update import build_merged_rules, update_targets
-
-kit_app = typer.Typer(help="Manage kit assets: export Cursor rules and merge agent docs")
-
-@kit_app.command("sync")
-def sync(
- repo_root: Annotated[Path, typer.Option("--repo-root", dir_okay=True, writable=True)] = Path("."),
- cursor: Annotated[bool, typer.Option("--cursor/--no-cursor")] = True,
- single_files: Annotated[bool, typer.Option("--single-files/--no-single-files")] = True,
- dry_run: Annotated[bool, typer.Option("--dry-run")] = False,
- diff: Annotated[bool, typer.Option("--diff")] = False,
- backup: Annotated[str | None, typer.Option("--backup")] = None,
- force: Annotated[bool, typer.Option("--force")] = False,
-):
- idx = load_index()
- agents_dir = get_agents_dir()
-
- if cursor:
- export_cursor_rules(agents_dir, repo_root / ".cursor" / "rules", idx, dry_run=dry_run)
-
- if single_files:
- merged_md = build_merged_rules(agents_dir, idx) # ordered + demoted
- update_targets(repo_root, merged_md, idx.targets, dry_run=dry_run, diff=diff, backup=backup, force=force)
-```
-
-Wire it into your main CLI:
-
-```python
-# in your main cli module
-from pipelex.cli.commands.kit_cmd import kit_app
-app.add_typer(kit_app, name="kit", help="Manage kit assets")
-```
-
----
-
-# Core helpers
-
-## Paths
-
-```python
-# pipelex/kit/paths.py
-from importlib.resources import files
-from typing import Any
-from importlib.abc import Traversable
-
-def get_kit_root() -> Traversable:
- return files("pipelex.kit")
-
-def get_agents_dir() -> Traversable:
- return get_kit_root() / "agents"
-```
-
-## Cursor export (.md → .mdc with YAML front matter)
-
-```python
-# pipelex/kit/cursor_export.py
-from typing import Iterable
-from pathlib import Path
-import textwrap
-import yaml # pyyaml (MIT)
-from importlib.abc import Traversable
-from .index_models import KitIndex
-from pipelex.tools.misc.toml_utils import TomlError # (for symmetry if needed)
-
-def _iter_agent_files(agents_dir: Traversable) -> Iterable[tuple[str, str]]:
- for child in agents_dir.iterdir():
- if child.name.endswith(".md") and child.is_file():
- yield child.name, child.read_text(encoding="utf-8")
-
-def _front_matter_for(name: str, idx: KitIndex) -> dict:
- base = dict(idx.cursor.front_matter)
- key = name.removesuffix(".md")
- if key in idx.cursor.files:
- base |= idx.cursor.files[key].front_matter
- return base
-
-def export_cursor_rules(agents_dir: Traversable, out_dir: Path, idx: KitIndex, dry_run: bool=False) -> None:
- out_dir.mkdir(parents=True, exist_ok=True)
- for fname, body in _iter_agent_files(agents_dir):
- fm = _front_matter_for(fname, idx)
- yaml_block = "---\n" + yaml.safe_dump(fm, sort_keys=False).rstrip() + "\n---\n"
- mdc = yaml_block + body
- out_path = out_dir / (fname.removesuffix(".md") + ".mdc")
- if dry_run:
- typer.echo(f"[DRY] write {out_path}")
- else:
- out_path.write_text(mdc, encoding="utf-8")
-```
-
-## Merging for single-file targets (markdown-parser-py)
-
-```python
-# pipelex/kit/targets_update.py
-from dataclasses import dataclass
-from pathlib import Path
-from importlib.abc import Traversable
-from typing import List
-import difflib
-import typer
-
-from markdown_parser_py import Doc # replace with actual import names
-from markdown_parser_py import parse as md_parse, render as md_render # adjust to real API
-
-from .index_models import KitIndex, Target
-from .markers import find_span, wrap, replace_span
-from pipelex.tools.misc.toml_utils import load_toml_from_path # (not strictly needed here)
-
-def _read_agent_file(agents_dir: Traversable, name: str) -> str:
- return (agents_dir / name).read_text(encoding="utf-8")
-
-def _demote(doc: Doc, n: int) -> Doc:
- # Walk headings and +n to their level (implementation per markdown-parser-py API)
- # pseudo:
- # for h in doc.headings(): h.level += n
- return doc
-
-def build_merged_rules(agents_dir: Traversable, idx: KitIndex) -> str:
- parts: List[str] = []
- for name in idx.agents.order:
- md = _read_agent_file(agents_dir, name)
- d = md_parse(md)
- d = _demote(d, idx.agents.demote)
- parts.append(md_render(d).rstrip())
- return ("\n\n".join(parts)).strip() + "\n"
-
-def _insert_block_with_ast(target_md: str, block_md: str, parent: str | None) -> str:
- # Parse both; locate parent heading (if any) or choose heuristic (after first H1 or end)
- # Attach block as a new section. Return rendered string.
- tdoc = md_parse(target_md or "")
- bdoc = md_parse(block_md)
- # ... attach via library’s attach API (level handling already demoted)
- return md_render(tdoc)
-
-def _diff(before: str, after: str, path: str) -> str:
- return "".join(difflib.unified_diff(before.splitlines(True), after.splitlines(True), fromfile=path, tofile=path))
-
-def update_targets(repo_root: Path, merged_rules: str, targets: List[Target],
- dry_run: bool, diff: bool, backup: str | None, force: bool) -> None:
- for t in targets:
- p = repo_root / t.path
- before = p.read_text(encoding="utf-8") if p.exists() else ""
- span = find_span(before, t.marker_begin, t.marker_end)
-
- if span:
- after_block = wrap(t.marker_begin, t.marker_end, merged_rules)
- after = replace_span(before, span, after_block)
- else:
- inserted = _insert_block_with_ast(before, merged_rules, t.parent)
- after = inserted if inserted.endswith("\n") else inserted + "\n"
- # wrap only the inserted region — simplest approach is to wrap merged_rules before insert
- # or insert markers during AST attach (implementation detail)
-
- if dry_run:
- typer.echo(f"[DRY] update {p}")
- if diff:
- typer.echo(_diff(before, after, str(p)))
- else:
- if backup and p.exists():
- (p.with_suffix(p.suffix + backup)).write_text(before, encoding="utf-8")
- p.parent.mkdir(parents=True, exist_ok=True)
- p.write_text(after, encoding="utf-8")
-```
-
-## Markers
-
-```python
-# pipelex/kit/markers.py
-def find_span(text: str, begin: str, end: str):
- s = text.find(begin)
- if s == -1: return None
- e = text.find(end, s)
- if e == -1: return None
- e += len(end)
- return (s, e)
-
-def wrap(begin: str, end: str, md: str) -> str:
- return f"{begin}\n{md.rstrip()}\n{end}"
-
-def replace_span(text: str, span: tuple[int,int], replacement: str) -> str:
- s, e = span
- return text[:s] + replacement + text[e:]
-```
-
----
-
-# Behavior rules (quick)
-
-* **Cursor**: overwrite `.cursor/rules/*.mdc` each run (we own them).
-* **Single-file**: only mutate content within our markers; if absent, **insert via AST** and add markers.
-* **Demote before concat** (per `index.toml`).
-* Preserve front-matter/encoding/line endings.
-* `--dry-run` prints plan; `--diff` shows unified diff; `--backup` writes `*.bak`.
-
----
-
-# Exit codes
-
-* `0` success / no changes
-* `1` failures (I/O, parse, invalid index, write blocked)
-* `2` ambiguous parent resolution (if you choose to enforce)
-
-This plugs directly into your existing CLI, uses your TOML loader + Pydantic v2, and scopes the implementation clearly for another SWE to take over.
diff --git a/README.md b/README.md
index ec71e96cb..3e7a8254c 100644
--- a/README.md
+++ b/README.md
@@ -235,6 +235,18 @@ Using `uv`:
uv pip install "pipelex[anthropic,google,google-genai,mistralai,bedrock,fal]"
```
+### Privacy & Telemetry
+
+Pipelex collects optional, anonymous usage data to help improve the product. On first run, you'll be prompted to choose your telemetry preference:
+
+- **Off**: No telemetry data collected
+- **Anonymous**: Anonymous usage data only (command usage, performance metrics, feature usage)
+- **Identified**: Usage data with user identification (helps us provide better support)
+
+Your prompts, LLM responses, file paths, and URLs are automatically redacted and never transmitted. You can change your preference at any time or disable telemetry completely by setting the `DO_NOT_TRACK` environment variable.
+
+For more details, see the [Telemetry Documentation](https://docs.pipelex.com/pages/setup/telemetry/).
+
---
## Example: optimizing a tweet in 2 steps
diff --git a/docs/index.md b/docs/index.md
index 1b84137e4..98e8156f6 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -43,8 +43,9 @@ pipelex build pipe "Imagine a cute animal mascot for a startup based on its elev
**Other useful use-cases for business:**
```bash
-pipelex build pipe "Given an expense report, apply company rules"
-pipelex build pipe "Take a CV in a PDF file, a Job offer text, and analyze if they match"
+pipelex build pipe "Given an expense report, apply company rules" --output results/expense.plx
+pipelex build pipe "Take a resume PDF, a Job offer text, and analyze if they match" --output results/resume_match.plx
+pipelex build pipe "Take a theme, write a joke about it, then roast the joke" --output results/self_roaster.plx
```
Each of these commands generates a complete production-ready script in our Pipelex language, saved as `.plx` file including domain definition, concepts, and the multiple _pipe_ steps to take to achieve the goal.
@@ -55,16 +56,8 @@ Each of these commands generates a complete production-ready script in our Pipel
```bash
# Run a pipe by code
-pipelex run <pipe_code>
-
-# Run with inputs (JSON file containing input_memory dict)
-pipelex run <pipe_code> --inputs input.json
-
-# Run a bundle's main_pipe (auto-detected from .plx extension)
-pipelex run bundle.plx --inputs input.json
-
-# Customize output location
-pipelex run <pipe_code> --output results/output.json
+pipelex run results/resume_match.plx --inputs inputs.json
+pipelex run results/self_roaster.plx --inputs '{"theme": "the prisoner dilemma"}'
```
The `--inputs` file should be a JSON dictionary where keys are input variable names and values are the input data. For native concepts like Text, you can use strings directly. For structured types, provide objects matching the expected structure.
diff --git a/docs/pages/advanced-customization/index.md b/docs/pages/advanced-customization/index.md
index af83f63f8..f7719ee1b 100644
--- a/docs/pages/advanced-customization/index.md
+++ b/docs/pages/advanced-customization/index.md
@@ -60,7 +60,6 @@ Some components are controlled by feature flags in the configuration:
- `is_reporting_enabled`: Controls Reporting system
- `is_pipeline_tracking_enabled`: Controls Pipeline Tracking
-- `is_activity_tracking_enabled`: Controls Activity Tracking
When a feature is disabled, the corresponding NoOp implementation is used automatically.
diff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/design_and_run_pipelines.md b/docs/pages/build-reliable-ai-workflows-with-pipelex/design_and_run_pipelines.md
index 60f708bc4..6c429902c 100644
--- a/docs/pages/build-reliable-ai-workflows-with-pipelex/design_and_run_pipelines.md
+++ b/docs/pages/build-reliable-ai-workflows-with-pipelex/design_and_run_pipelines.md
@@ -144,7 +144,7 @@ async def main():
# Execute the pipeline and wait for the result
pipe_output = await execute_pipeline(
pipe_code="description_to_tagline",
- input_memory={
+ inputs={
"description": {
"concept": "ProductDescription",
"content": "EcoClean Pro is a revolutionary biodegradable cleaning solution that removes 99.9% of germs while being completely safe for children and pets. Made from plant-based ingredients.",
diff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/executing-pipelines-with-inputs.md b/docs/pages/build-reliable-ai-workflows-with-pipelex/executing-pipelines-with-inputs.md
index 99eb77aed..f154c7d5d 100644
--- a/docs/pages/build-reliable-ai-workflows-with-pipelex/executing-pipelines-with-inputs.md
+++ b/docs/pages/build-reliable-ai-workflows-with-pipelex/executing-pipelines-with-inputs.md
@@ -1,17 +1,17 @@
# Executing Pipelines with Inputs
-When you run a Pipelex pipeline from Python, you often need to provide input data. The `input_memory` parameter gives you a flexible and intuitive way to pass data to your pipelines.
+When you run a Pipelex pipeline from Python, you often need to provide input data. The `inputs` parameter gives you a flexible and intuitive way to pass data to your pipelines.
This guide explains the different formats you can use and when to use each one.
-## Understanding input_memory
+## Understanding inputs
-The `input_memory` parameter accepts a dictionary where:
+The `inputs` parameter accepts a dictionary where:
- **Keys** are the input variable names (matching the `inputs` defined in your pipeline)
- **Values** can be provided in multiple formats for convenience
-Under the hood, `input_memory` uses this type definition:
+Under the hood, `inputs` uses this type definition:
```python
StuffContentOrData = dict[str, Any] | StuffContent | list[Any] | str
@@ -43,7 +43,7 @@ The simplest way to provide text input is with a plain string. Pipelex automatic
```python
pipe_output = await execute_pipeline(
pipe_code="summarize_story",
- input_memory={
+ inputs={
"story": """
Once upon a time there was a brave knight who saved the kingdom from a dragon.
[...]
@@ -72,7 +72,7 @@ from pipelex.core.stuffs.pdf_content import PDFContent
pipe_output = await execute_pipeline(
pipe_code="process_invoice",
- input_memory={
+ inputs={
"document": PDFContent(url="invoice.pdf"),
},
)
@@ -85,7 +85,7 @@ from pipelex.core.stuffs.image_content import ImageContent
pipe_output = await execute_pipeline(
pipe_code="analyze_photo",
- input_memory={
+ inputs={
"photo": ImageContent(url="photo.jpg"),
},
)
@@ -112,7 +112,7 @@ from pipelex.core.stuffs.image_content import ImageContent
pipe_output = await execute_pipeline(
pipe_code="extract_gantt",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttChartImage", # Custom concept that refines Image
"content": ImageContent(url="gantt.png"),
@@ -126,7 +126,7 @@ pipe_output = await execute_pipeline(
```python
pipe_output = await execute_pipeline(
pipe_code="answer_question",
- input_memory={
+ inputs={
"question": {
"concept": "qa.Question",
"content": "What is the capital of France?",
@@ -146,7 +146,7 @@ pipe_output = await execute_pipeline(
## Format 4: Multiple Inputs with Mixed Formats
-You can mix and match formats freely in the same `input_memory` dictionary.
+You can mix and match formats freely in the same `inputs` dictionary.
### Complex Example
@@ -155,7 +155,7 @@ from pipelex.core.stuffs.text_content import load_text_from_path
pipe_output = await execute_pipeline(
pipe_code="analyze_contract",
- input_memory={
+ inputs={
# Format 1: Simple string
"client_instructions": "Focus on payment terms",
@@ -208,7 +208,7 @@ Follow these simple rules:
# Most document processing pipelines expect a PDF input
pipe_output = await execute_pipeline(
pipe_code="extract_data",
- input_memory={
+ inputs={
"document": PDFContent(url="document.pdf"),
},
)
@@ -220,7 +220,7 @@ pipe_output = await execute_pipeline(
# Image processing with native Image concept
pipe_output = await execute_pipeline(
pipe_code="describe_image",
- input_memory={
+ inputs={
"image": ImageContent(url="photo.jpg"),
},
)
@@ -232,7 +232,7 @@ pipe_output = await execute_pipeline(
# Simple text input for generation tasks
pipe_output = await execute_pipeline(
pipe_code="write_story",
- input_memory={
+ inputs={
"topic": "A robot learning to love",
},
)
@@ -244,7 +244,7 @@ pipe_output = await execute_pipeline(
# Custom concept that needs explicit specification
pipe_output = await execute_pipeline(
pipe_code="process_tweet",
- input_memory={
+ inputs={
"draft_tweet": {
"concept": "social.DraftTweet",
"content": "Check out this amazing framework!",
@@ -272,7 +272,7 @@ character = Character(
# Pass it to the pipeline
pipe_output = await execute_pipeline(
pipe_code="analyze_character",
- input_memory={
+ inputs={
"character": {
"concept": "story.Character",
"content": character,
@@ -283,7 +283,7 @@ pipe_output = await execute_pipeline(
## Alternative: Using working_memory Directly
-For advanced use cases, you can construct the working memory explicitly instead of using `input_memory`:
+For advanced use cases, you can construct the working memory explicitly instead of using `inputs`:
```python
from pipelex.core.stuffs.stuff_factory import StuffFactory
@@ -314,7 +314,7 @@ pipe_output = await execute_pipeline(
- You're building complex multi-stuff scenarios
- You're working with intermediate pipeline states
-**For most cases, `input_memory` is simpler and recommended.**
+**For most cases, `inputs` is simpler and recommended.**
## Troubleshooting
@@ -324,10 +324,10 @@ If you see an error about a concept not being found, you may need to use the exp
```python
# ❌ Won't work if MyType is a custom concept
-input_memory={"data": my_value}
+inputs={"data": my_value}
# ✅ Use explicit format
-input_memory={
+inputs={
"data": {
"concept": "domain.MyType",
"content": my_value,
@@ -341,7 +341,7 @@ Make sure the content type matches what your concept expects:
```python
# ❌ Wrong: passing a string when concept expects structured data
-input_memory={
+inputs={
"character": {
"concept": "story.Character",
"content": "Alice", # Should be a Character instance
@@ -349,7 +349,7 @@ input_memory={
}
# ✅ Correct: pass the right type
-input_memory={
+inputs={
"character": {
"concept": "story.Character",
"content": Character(name="Alice", age=30, ...),
diff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeLLM.md b/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeLLM.md
index a608ccf65..99ea96c26 100644
--- a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeLLM.md
+++ b/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeLLM.md
@@ -32,7 +32,7 @@ Describe the provided image in great detail.
"""
```
-**Important**: Do NOT reference image variables in your prompt template using `@image` or `$image`. Images are automatically passed to vision-enabled LLMs and should not be treated as text variables.
+**Important**: It is necessary to tag the image variable in the prompt with `@image` or `$image`, just like with regular objects.
**Flexible Image Inputs**
diff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/understanding-multiplicity.md b/docs/pages/build-reliable-ai-workflows-with-pipelex/understanding-multiplicity.md
index af6dc22fb..634953366 100644
--- a/docs/pages/build-reliable-ai-workflows-with-pipelex/understanding-multiplicity.md
+++ b/docs/pages/build-reliable-ai-workflows-with-pipelex/understanding-multiplicity.md
@@ -377,7 +377,7 @@ from pipelex.pipeline.execute import execute_pipeline
# Execute a pipe with multiple outputs
pipe_output = await execute_pipeline(
pipe_code="extract_line_items",
- input_memory={"invoice_text": "Your invoice text here..."}
+ inputs={"invoice_text": "Your invoice text here..."}
)
# Get the list of line items
@@ -396,7 +396,7 @@ from pipelex.core.stuffs.text_content import TextContent
pipe_output = await execute_pipeline(
pipe_code="summarize_all_documents",
- input_memory={
+ inputs={
"documents": [
TextContent(text="Document 1 content..."),
TextContent(text="Document 2 content..."),
diff --git a/docs/pages/configuration/config-advanced/feature-config.md b/docs/pages/configuration/config-advanced/feature-config.md
index 574e1d46e..9f4b3b594 100644
--- a/docs/pages/configuration/config-advanced/feature-config.md
+++ b/docs/pages/configuration/config-advanced/feature-config.md
@@ -7,14 +7,12 @@ The `FeatureConfig` class controls which features are enabled in Pipelex.
```python
class FeatureConfig(ConfigModel):
is_pipeline_tracking_enabled: bool
- is_activity_tracking_enabled: bool
is_reporting_enabled: bool
```
### Fields
- `is_pipeline_tracking_enabled`: When true, enables pipeline tracking functionality
-- `is_activity_tracking_enabled`: When true, enables activity tracking functionality
- `is_reporting_enabled`: When true, enables the reporting system
## Impact on Dependency Injection
@@ -24,7 +22,6 @@ The feature flags directly affect which implementation is used for certain compo
| Feature Flag | When True | When False |
|--------------|-----------|------------|
| `is_pipeline_tracking_enabled` | `PipelineTracker` | `PipelineTrackerNoOp` |
-| `is_activity_tracking_enabled` | `ActivityManager` | `ActivityManagerNoOp` |
| `is_reporting_enabled` | `ReportingManager` | `ReportingNoOp` |
## Feature Details
@@ -41,16 +38,6 @@ is_pipeline_tracking_enabled = true
- Useful for debugging and monitoring pipeline behavior
- Default: `true`
-### Activity Tracking
-
-```toml
-is_activity_tracking_enabled = true
-```
-
-- Controls whether activity tracking is enabled
-- When enabled, tracks detailed information about system activities
-- Default: `true`
-
### Reporting
```toml
@@ -68,9 +55,6 @@ is_reporting_enabled = true
# Enable pipeline tracking for debugging
is_pipeline_tracking_enabled = true
-# Enable activity tracking
-is_activity_tracking_enabled = true
-
# Enable reporting for cost monitoring
is_reporting_enabled = true
```
diff --git a/docs/pages/configuration/config-practical/telemetry-config.md b/docs/pages/configuration/config-practical/telemetry-config.md
new file mode 100644
index 000000000..867be35b0
--- /dev/null
+++ b/docs/pages/configuration/config-practical/telemetry-config.md
@@ -0,0 +1,164 @@
+# Telemetry Configuration
+
+## Overview
+
+Telemetry configuration is stored in `.pipelex/telemetry.toml`, separate from the main `pipelex.toml` configuration. This file is created automatically the first time you run a Pipelex command (after `pipelex init config`) and are prompted to choose your telemetry preference.
+
+For a user-friendly introduction to telemetry, see [Telemetry Setup](../../setup/telemetry.md).
+
+## Configuration File Location
+
+```
+.pipelex/telemetry.toml
+```
+
+This file is created in the `.pipelex` directory at your project root.
+
+## Configuration Options
+
+### Example Configuration
+
+```toml
+telemetry_mode = "off"
+host = "https://eu.i.posthog.com"
+project_api_key = "phc_HPJnNKpIXh0SxNDYyTAyUtnq9KxNNZJWQszynsWVx4Y"
+respect_dnt = true
+redact = ["prompt", "system_prompt", "response", "file_path", "url"]
+geoip_enabled = true
+dry_mode_enabled = false
+verbose_enabled = false
+user_id = ""
+```
+
+### Settings Reference
+
+#### `telemetry_mode`
+
+- **Type**: `string`
+- **Default**: `"off"`
+- **Allowed values**: `"off"`, `"anonymous"`, `"identified"`
+- **Description**: Controls the telemetry collection mode.
+ - `"off"`: No telemetry data is collected
+ - `"anonymous"`: Anonymous usage data only (no user identification)
+ - `"identified"`: Usage data with user identification (requires `user_id` to be set)
+
+#### `host`
+
+- **Type**: `string`
+- **Default**: `"https://eu.i.posthog.com"`
+- **Description**: The PostHog server host URL. We use the EU-hosted instance for privacy compliance.
+
+**Note**: This is typically not changed unless you're self-hosting PostHog.
+
+#### `project_api_key`
+
+- **Type**: `string`
+- **Default**: `"phc_HPJnNKpIXh0SxNDYyTAyUtnq9KxNNZJWQszynsWVx4Y"`
+- **Description**: The PostHog project API key for the Pipelex telemetry project.
+
+**Note**: This is typically not changed unless you're using a custom telemetry backend.
+
+#### `respect_dnt`
+
+- **Type**: `boolean`
+- **Default**: `true`
+- **Description**: When `true`, Pipelex respects the `DO_NOT_TRACK` environment variable. If `DO_NOT_TRACK` is set to any value except `false` or `0`, telemetry is automatically disabled.
+
+#### `redact`
+
+- **Type**: `array` of `string`
+- **Default**: `["prompt", "system_prompt", "response", "file_path", "url"]`
+- **Description**: List of event properties to redact from telemetry data. These sensitive fields are automatically filtered out before any data is sent.
+
+**Privacy protection**: This ensures that your actual prompts, LLM responses, and file paths are never transmitted to telemetry servers.
+
+#### `debug`
+
+- **Type**: `boolean`
+- **Default**: `false`
+- **Description**: When `true`, telemetry events are logged locally but not actually sent to PostHog. Useful for debugging telemetry implementation.
+
+#### `user_id`
+
+- **Type**: `string`
+- **Default**: `""`
+- **Description**: User identifier for the `"identified"` telemetry mode. If `telemetry_mode` is set to `"identified"` but `user_id` is empty, telemetry falls back to anonymous mode.
+
+**Usage**: Set this to your email, username, or any identifier you prefer when using identified mode.
+
+## Manually Changing Settings
+
+Edit `.pipelex/telemetry.toml` directly. Changes take effect on the next command run.
+
+```toml
+telemetry_mode = "off" # Disable telemetry
+telemetry_mode = "anonymous" # Enable anonymous telemetry
+```
+
+### Example: Enable Identified Telemetry
+
+```toml
+telemetry_mode = "identified"
+user_id = "[email protected]"
+```
+
+## Re-triggering the Configuration Prompt
+
+If you want to see the configuration prompt again (for example, to change your choice through the interactive interface), delete the `.pipelex/telemetry.toml` file:
+
+```bash
+rm .pipelex/telemetry.toml
+```
+
+The next time you run a Pipelex command (except `pipelex init`), you'll be prompted to choose your telemetry preference.
+
+## Environment Variable Override
+
+The `DO_NOT_TRACK` environment variable provides a universal way to disable telemetry:
+
+```bash
+# Linux/MacOS
+export DO_NOT_TRACK=1
+
+# Windows PowerShell
+$env:DO_NOT_TRACK="1"
+
+# Windows CMD
+set DO_NOT_TRACK=1
+```
+
+When `respect_dnt = true` (the default), this will disable all telemetry regardless of the `telemetry_mode` setting.
+
+## What Data is Collected?
+
+When telemetry is enabled (anonymous or identified mode), Pipelex collects:
+
+- Whole pipeline execution events (start, success, failure)
+- Each pipe execution events (start, success, failure)
+
+soon to be added:
+- Error types (without error messages)
+- Command usage (which CLI commands are run)
+- Feature usage patterns (which pipe types are used)
+- Performance metrics (execution time, token usage)
+
+**Never collected** (automatically redacted):
+
+- Your prompts or system prompts
+- LLM responses
+- File paths
+- URLs
+- Any content from your documents or images
+- Personal data (unless you explicitly set a `user_id` in identified mode)
+
+## Privacy and Compliance
+
+- Telemetry is **opt-in** via the first-run prompt
+- All sensitive data is **automatically redacted**
+- We use **PostHog** (EU-hosted) for telemetry infrastructure
+- We **respect DO_NOT_TRACK** by default
+- You can **completely disable** telemetry at any time
+- Telemetry configuration is **stored locally** in your project
+
+For more information about our data practices, see our [privacy policy](https://pipelex.com/privacy-policy).
+
diff --git a/docs/pages/cookbook-examples/extract-dpe.md b/docs/pages/cookbook-examples/extract-dpe.md
index 4af51b595..6978bd484 100644
--- a/docs/pages/cookbook-examples/extract-dpe.md
+++ b/docs/pages/cookbook-examples/extract-dpe.md
@@ -14,7 +14,7 @@ The pipeline `power_extractor_dpe` is designed to recognize and extract the key
async def extract_dpe(pdf_url: str) -> Dpe:
pipe_output = await execute_pipeline(
pipe_code="power_extractor_dpe",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
diff --git a/docs/pages/cookbook-examples/extract-gantt.md b/docs/pages/cookbook-examples/extract-gantt.md
index 9d8a5f99e..52bf9fd06 100644
--- a/docs/pages/cookbook-examples/extract-gantt.md
+++ b/docs/pages/cookbook-examples/extract-gantt.md
@@ -15,7 +15,7 @@ async def extract_gantt(image_url: str) -> GanttChart:
# Run the pipe
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttChartImage",
"content": ImageContent(url=image_url),
diff --git a/docs/pages/cookbook-examples/extract-generic.md b/docs/pages/cookbook-examples/extract-generic.md
index e62da82cc..c70ca64ef 100644
--- a/docs/pages/cookbook-examples/extract-generic.md
+++ b/docs/pages/cookbook-examples/extract-generic.md
@@ -14,7 +14,7 @@ The `power_extractor` pipeline is at the heart of this example. After its execut
async def extract_generic(pdf_url: str) -> TextAndImagesContent:
pipe_output = await execute_pipeline(
pipe_code="power_extractor",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
diff --git a/docs/pages/cookbook-examples/extract-proof-of-purchase.md b/docs/pages/cookbook-examples/extract-proof-of-purchase.md
index 141dbf294..e79a230c8 100644
--- a/docs/pages/cookbook-examples/extract-proof-of-purchase.md
+++ b/docs/pages/cookbook-examples/extract-proof-of-purchase.md
@@ -14,7 +14,7 @@ The pipeline `power_extractor_proof_of_purchase` is specifically designed to han
async def extract_proof_of_purchase(pdf_url: str) -> ProofOfPurchase:
pipe_output = await execute_pipeline(
pipe_code="power_extractor_proof_of_purchase",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
diff --git a/docs/pages/cookbook-examples/extract-table.md b/docs/pages/cookbook-examples/extract-table.md
index 80791a2ad..a7f68ebf5 100644
--- a/docs/pages/cookbook-examples/extract-table.md
+++ b/docs/pages/cookbook-examples/extract-table.md
@@ -14,7 +14,7 @@ The pipeline `extract_html_table_and_review` takes an image of a table, processe
async def extract_table(table_screenshot: str) -> HtmlTable:
pipe_output = await execute_pipeline(
pipe_code="extract_html_table_and_review",
- input_memory={
+ inputs={
"table_screenshot": {
"concept": "tables.TableScreenshot",
"content": ImageContent(url=table_screenshot),
diff --git a/docs/pages/cookbook-examples/invoice-extractor.md b/docs/pages/cookbook-examples/invoice-extractor.md
index 8e37231ff..38653df1a 100644
--- a/docs/pages/cookbook-examples/invoice-extractor.md
+++ b/docs/pages/cookbook-examples/invoice-extractor.md
@@ -14,7 +14,7 @@ The `process_invoice` pipeline is a complete workflow for invoice processing.
async def process_invoice(pdf_url: str) -> ListContent[Invoice]:
pipe_output = await execute_pipeline(
pipe_code="process_invoice",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
diff --git a/docs/pages/cookbook-examples/simple-ocr.md b/docs/pages/cookbook-examples/simple-ocr.md
index 5ec655a87..6f7a281a7 100644
--- a/docs/pages/cookbook-examples/simple-ocr.md
+++ b/docs/pages/cookbook-examples/simple-ocr.md
@@ -16,7 +16,7 @@ The core of this example is a simple function that executes a pre-defined pipeli
async def simple_ocr(pdf_url: str) -> ListContent[PageContent]:
pipe_output = await execute_pipeline(
pipe_code="extract_page_contents_from_pdf",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
@@ -24,4 +24,4 @@ async def simple_ocr(pdf_url: str) -> ListContent[PageContent]:
return page_content_list
```
-This showcases how easy it is to kick off a complex process with just a few lines of code. The `input_memory` dictionary simply maps the input name to the PDF content, and the pipeline handles the rest.
\ No newline at end of file
+This showcases how easy it is to kick off a complex process with just a few lines of code. The `inputs` dictionary simply maps the input name to the PDF content, and the pipeline handles the rest.
\ No newline at end of file
diff --git a/docs/pages/cookbook-examples/write-screenplay.md b/docs/pages/cookbook-examples/write-screenplay.md
index b9c809949..27c3be8fa 100644
--- a/docs/pages/cookbook-examples/write-screenplay.md
+++ b/docs/pages/cookbook-examples/write-screenplay.md
@@ -8,7 +8,7 @@ This example demonstrates how to use Pipelex for creative text generation. It ta
## The Pipeline Explained
-The `generate_screenplay` function takes a pitch as a string and executes the `generate_screenplay` pipeline, passing the pitch through the `input_memory` dictionary with the concept specification.
+The `generate_screenplay` function takes a pitch as a string and executes the `generate_screenplay` pipeline, passing the pitch through the `inputs` dictionary with the concept specification.
```python
async def generate_screenplay(pitch: str):
@@ -16,7 +16,7 @@ async def generate_screenplay(pitch: str):
pipe_output = await execute_pipeline(
pipe_code="generate_screenplay",
- input_memory={
+ inputs={
"pitch": {
"concept": "screenplay.Pitch",
"content": pitch,
diff --git a/docs/pages/cookbook-examples/write-tweet.md b/docs/pages/cookbook-examples/write-tweet.md
index f91d853f3..cf4b7e844 100644
--- a/docs/pages/cookbook-examples/write-tweet.md
+++ b/docs/pages/cookbook-examples/write-tweet.md
@@ -8,13 +8,13 @@ This example demonstrates how to create a pipeline that takes a draft of a tweet
## The Pipeline Explained
-The `optimize_tweet` function is the core of this example. It takes two strings, `draft_tweet` and `writing_style`, and executes the `optimize_tweet_sequence` pipeline, passing both inputs through the `input_memory` dictionary with their respective concept specifications.
+The `optimize_tweet` function is the core of this example. It takes two strings, `draft_tweet` and `writing_style`, and executes the `optimize_tweet_sequence` pipeline, passing both inputs through the `inputs` dictionary with their respective concept specifications.
```python
async def optimize_tweet(draft_tweet: str, writing_style: str) -> str:
pipe_output = await execute_pipeline(
pipe_code="optimize_tweet_sequence",
- input_memory={
+ inputs={
"draft_tweet": {
"concept": "tech_tweet.DraftTweet",
"content": draft_tweet,
diff --git a/docs/pages/setup/telemetry.md b/docs/pages/setup/telemetry.md
new file mode 100644
index 000000000..c31ff9ffa
--- /dev/null
+++ b/docs/pages/setup/telemetry.md
@@ -0,0 +1,81 @@
+# Telemetry
+
+## What is Telemetry?
+
+Pipelex collects optional, anonymous usage data to help improve the product. This helps us understand how Pipelex is being used and identify areas for improvement.
+
+## First Run Experience
+
+When you run most Pipelex commands for the first time (after running `pipelex init`), you'll be prompted to configure your telemetry preferences:
+
+```
+======================================================================
+Telemetry Configuration
+======================================================================
+
+Pipelex can collect anonymous usage data to help improve the product.
+
+Please choose your telemetry preference:
+ [1] off - No telemetry data collected
+ [2] anonymous - Anonymous usage data only
+ [3] identified - Usage data with user identification
+ [q] quit - Exit without configuring
+
+Enter your choice:
+```
+
+## Telemetry Modes
+
+### Off
+
+No telemetry data is collected. Pipelex will not send any data to our servers.
+
+### Anonymous
+
+Anonymous usage data only. This includes:
+
+- Command usage (which commands are run)
+- Pipeline execution statistics (success/failure rates, performance metrics)
+- Feature usage patterns
+
+This mode does **not** include:
+
+- Personal identification
+- Your prompts or system prompts
+- LLM responses
+- File paths or URLs
+- Any sensitive information
+
+### Identified
+
+Same as anonymous mode, but includes a user identifier. This helps us provide better support and understand user journeys across sessions.
+
+If you choose this mode, you can optionally provide a `user_id` in the configuration file.
+
+## DO_NOT_TRACK Support
+
+Pipelex respects the `DO_NOT_TRACK` environment variable. If you have `DO_NOT_TRACK` set in your environment (to any value except `false` or `0`), telemetry will be automatically disabled regardless of your configuration settings.
+
+```bash
+# Disable telemetry via environment variable
+export DO_NOT_TRACK=1
+```
+
+## Changing Your Settings
+
+You can change your telemetry settings at any time:
+
+1. **Via configuration file**: Edit `.pipelex/telemetry.toml` directly (see [Telemetry Configuration](../configuration/config-practical/telemetry-config.md))
+2. **Trigger the prompt again**: Delete `.pipelex/telemetry.toml`, and the prompt will appear next time you run a command
+
+## Privacy
+
+We take your privacy seriously:
+
+- Sensitive data (prompts, responses, file paths, URLs) is automatically redacted
+- You have full control over what level of telemetry you're comfortable with
+- All telemetry can be completely disabled
+- Our telemetry infrastructure uses PostHog, hosted in the EU
+
+For detailed configuration options, see [Telemetry Configuration](../configuration/config-practical/telemetry-config.md).
+
diff --git a/docs/pages/tools/cli.md b/docs/pages/tools/cli.md
index c4baf1e70..ad6e30bd0 100644
--- a/docs/pages/tools/cli.md
+++ b/docs/pages/tools/cli.md
@@ -323,7 +323,7 @@ Executes a pipeline, either from a standalone bundle (.plx) file or from your pr
- `--pipe` - Pipe code to run (alternative to positional argument)
- `--bundle` - Bundle file path (alternative to positional argument)
-- `--inputs`, `-i` - Path to JSON file containing input_memory
+- `--inputs`, `-i` - Path to JSON file containing inputs
- `--output`, `-o` - Path to save output JSON (defaults to `results/run_{pipe_code}.json`)
- `--no-output` - Skip saving output to file
- `--no-pretty-print` - Skip pretty printing the main output
diff --git a/mkdocs.yml b/mkdocs.yml
index 90ce4672c..16bcd4a78 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -44,9 +44,9 @@ extra:
- icon: fontawesome/brands/twitter
link: https://x.com/PipelexAI
name: Pipelex on X
- # - icon: fontawesome/brands/discord
- # link: https://go.pipelex.com/discord
- # name: Pipelex on Discord
+ - icon: fontawesome/brands/discord
+ link: https://go.pipelex.com/discord
+ name: Pipelex on Discord
generator: false
plugins:
@@ -89,6 +89,7 @@ nav:
- Setup:
- Configure AI Providers: pages/setup/configure-ai-providers.md
- Project Organization: pages/setup/project-organization.md
+ - Telemetry: pages/setup/telemetry.md
- Understand Pipelex:
- The Knowledge Pipeline Manifesto: manifesto.md
- The Pipelex Paradigm: pages/pipelex-paradigm-for-repeatable-ai-workflows/index.md
@@ -134,6 +135,7 @@ nav:
- LLM Providers & Models: pages/configuration/config-technical/inference-backend-config.md
- API Reference:
- API Guide: pages/api/index.md
+ - n8n Node: https://pipelex.github.io/n8n-nodes-pipelex/
- Configuration:
- Overview: pages/configuration/index.md
- Pipeline Validation Configuration:
@@ -143,6 +145,7 @@ nav:
- Logging: pages/configuration/config-practical/logging-config.md
- Pipe Run: pages/configuration/config-practical/pipe-run-config.md
- Reporting: pages/configuration/config-practical/reporting-config.md
+ - Telemetry: pages/configuration/config-practical/telemetry-config.md
- Tracker: pages/configuration/config-practical/tracker-config.md
- Technical Configuration:
- AWS: pages/configuration/config-technical/aws-config.md
diff --git a/pipelex/builder/builder_loop.py b/pipelex/builder/builder_loop.py
index 3ecaa7b7a..f5e75ab60 100644
--- a/pipelex/builder/builder_loop.py
+++ b/pipelex/builder/builder_loop.py
@@ -13,7 +13,7 @@ from pipelex.builder.builder_errors import (
from pipelex.builder.builder_validation import validate_bundle_spec
from pipelex.client.protocol import PipelineInputs
from pipelex.core.pipes.pipe_blueprint import AllowedPipeCategories
-from pipelex.exceptions import StaticValidationErrorType, WorkingMemoryStuffNotFoundError
+from pipelex.exceptions import PipelineExecutionError, StaticValidationErrorType, WorkingMemoryStuffNotFoundError
from pipelex.hub import get_required_pipe
from pipelex.language.plx_factory import PlxFactory
from pipelex.pipeline.execute import execute_pipeline
@@ -24,15 +24,19 @@ class BuilderLoop:
async def build_and_fix(
self,
pipe_code: str,
- input_memory: PipelineInputs | None = None,
+ inputs: PipelineInputs | None = None,
is_save_first_iteration_enabled: bool = True,
is_save_second_iteration_enabled: bool = True,
) -> PipelexBundleSpec:
pretty_print(f"Building and fixing with {pipe_code}")
- pipe_output = await execute_pipeline(
- pipe_code=pipe_code,
- inputs=input_memory,
- )
+ try:
+ pipe_output = await execute_pipeline(
+ pipe_code=pipe_code,
+ inputs=inputs,
+ )
+ except PipelineExecutionError as exc:
+ msg = f"Builder loop: Failed to execute pipeline: {exc}."
+ raise PipeBuilderError(message=msg) from exc
pretty_print(pipe_output, title="Pipe Output")
try:
diff --git a/pipelex/builder/runner_code.py b/pipelex/builder/runner_code.py
index d27a9c01a..99511db90 100644
--- a/pipelex/builder/runner_code.py
+++ b/pipelex/builder/runner_code.py
@@ -104,7 +104,7 @@ def generate_runner_code(pipe: PipeAbstract) -> str:
]
)
- # Build input_memory entries
+ # Build inputs entries
if inputs.nb_inputs > 0:
input_memory_entries: list[str] = []
for var_name, input_req in inputs.root.items():
@@ -127,7 +127,7 @@ def generate_runner_code(pipe: PipeAbstract) -> str:
if inputs.nb_inputs > 0:
function_lines.extend(
[
- " input_memory={",
+ " inputs={",
input_memory_block,
" },",
]
diff --git a/pipelex/cli/_cli.py b/pipelex/cli/_cli.py
index cc7c0cddb..c302453eb 100644
--- a/pipelex/cli/_cli.py
+++ b/pipelex/cli/_cli.py
@@ -1,5 +1,8 @@
+import os
+
import typer
from click import Command, Context
+from rich.console import Console
from typer.core import TyperGroup
from typing_extensions import override
@@ -9,6 +12,12 @@ from pipelex.cli.commands.kit_cmd import kit_app
from pipelex.cli.commands.run_cmd import run_cmd
from pipelex.cli.commands.show_cmd import show_app
from pipelex.cli.commands.validate_cmd import validate_cmd
+from pipelex.kit.paths import get_configs_dir
+from pipelex.system.configuration.config_loader import config_manager
+from pipelex.system.telemetry.telemetry_config import TELEMETRY_CONFIG_FILE_NAME, TelemetryMode
+from pipelex.system.telemetry.telemetry_manager_abstract import TelemetryManagerAbstract
+from pipelex.tools.misc.file_utils import path_exists
+from pipelex.tools.misc.toml_utils import load_toml_with_tomlkit, save_toml_to_path
class PipelexCLI(TyperGroup):
@@ -27,6 +36,89 @@ class PipelexCLI(TyperGroup):
return cmd
+def check_telemetry_consent() -> TelemetryMode | None:
+ """Check if user has configured telemetry and prompt if not."""
+ # Check if .pipelex directory exists - if not, user must run pipelex init first
+ pipelex_config_dir = config_manager.pipelex_config_dir
+ if not path_exists(pipelex_config_dir):
+ typer.echo("Pipelex has not been initialized in this directory.", err=True)
+ typer.echo("Please run 'pipelex init' first to set up the configuration.", err=True)
+ raise typer.Exit(code=1)
+
+ telemetry_config_path = os.path.join(pipelex_config_dir, TELEMETRY_CONFIG_FILE_NAME)
+
+ # If telemetry.toml exists, settings are already configured
+ if path_exists(telemetry_config_path):
+ return None
+
+ # If file doesn't exist, prompt user and create it
+ try:
+ # Map choice to telemetry mode using enum
+ mode_map: dict[str, TelemetryMode] = {
+ "1": TelemetryMode.OFF,
+ "2": TelemetryMode.ANONYMOUS,
+ "3": TelemetryMode.IDENTIFIED,
+ "off": TelemetryMode.OFF,
+ "anonymous": TelemetryMode.ANONYMOUS,
+ "identified": TelemetryMode.IDENTIFIED,
+ }
+
+ # Prompt user for telemetry preference
+ typer.echo("\n" + "=" * 70)
+ typer.echo("Telemetry Configuration")
+ typer.echo("=" * 70)
+ typer.echo("\nPipelex can collect anonymous usage data to help improve the product.")
+ typer.echo("\nPlease choose your telemetry preference:")
+ typer.echo(f" [1] {TelemetryMode.OFF:11} - No telemetry data collected")
+ typer.echo(f" [2] {TelemetryMode.ANONYMOUS:11} - Anonymous usage data only")
+ typer.echo(f" [3] {TelemetryMode.IDENTIFIED:11} - Usage data with user identification")
+ typer.echo(f" [q] {'quit':11} - Exit without configuring")
+ typer.echo()
+
+ # Loop until valid input is received
+ telemetry_mode: TelemetryMode | None = None
+ while telemetry_mode is None:
+ choice_str = typer.prompt(
+ "Enter your choice",
+ type=str,
+ )
+
+ # Normalize input to lowercase
+ choice_normalized = choice_str.lower().strip()
+
+ # Handle quit option
+ if choice_normalized in ("q", "quit"):
+ typer.echo("\nExiting without configuring telemetry.")
+ raise typer.Exit(code=0)
+
+ # Check if valid choice
+ if choice_normalized in mode_map:
+ telemetry_mode = mode_map[choice_normalized]
+ else:
+ typer.echo(f"Invalid choice: '{choice_str}'. Please enter 1, 2, 3, off, anonymous, identified, or q to quit.\n")
+
+ # Load template and set the chosen mode
+ template_path = os.path.join(str(get_configs_dir()), TELEMETRY_CONFIG_FILE_NAME)
+ toml_doc = load_toml_with_tomlkit(template_path)
+ toml_doc["telemetry_mode"] = telemetry_mode
+
+ # Save to user's .pipelex directory
+ save_toml_to_path(toml_doc, telemetry_config_path)
+
+ typer.echo(f"\n✓ Telemetry mode set to: {telemetry_mode}")
+ typer.echo("=" * 70 + "\n")
+
+ return telemetry_mode
+
+ except typer.Exit:
+ # Re-raise Exit exceptions (e.g., when user quits)
+ raise
+ except Exception as exc:
+ # Silently fail if there's any issue - don't block CLI usage
+ typer.echo(f"Warning: Could not save telemetry preference: {exc}", err=True)
+ return None
+
+
def main() -> None:
"""Entry point for the pipelex CLI."""
app()
@@ -40,6 +132,32 @@ app = typer.Typer(
)
[email protected](invoke_without_command=True)
+def app_callback(ctx: typer.Context) -> None:
+ """Run pre-command checks like printing the logo and checking telemetry consent."""
+ console = Console()
+ console.print(
+ """
+
+░█████████ ░[bold green4]██[/bold green4] ░██
+░██ ░██ ░██
+░██ ░██ ░██░████████ ░███████ ░██ ░███████ ░██ ░[bold green4]██[/bold green4]
+░█████████ ░██░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██
+░██ ░██░██ ░██ ░█████████ ░██ ░█████████ ░█████
+░██ ░██░███ ░██ ░██ ░██ ░██ ░██ ░██
+░██ ░██░██░█████ ░███████ ░██ ░███████ ░██ ░██
+ ░██
+ ░██
+
+"""
+ )
+ # Skip checks if no command is being run (e.g., just --help) or if running init command
+ if ctx.invoked_subcommand is None or ctx.invoked_subcommand == "init":
+ return
+
+ TelemetryManagerAbstract.telemetry_mode_just_set = check_telemetry_consent()
+
+
app.add_typer(init_app, name="init", help="Initialize Pipelex configuration in a `.pipelex` directory")
app.add_typer(kit_app, name="kit", help="Manage kit assets: agent rules, migration rules")
app.add_typer(
diff --git a/pipelex/cli/commands/build_cmd.py b/pipelex/cli/commands/build_cmd.py
index cf712f777..e0de0dee6 100644
--- a/pipelex/cli/commands/build_cmd.py
+++ b/pipelex/cli/commands/build_cmd.py
@@ -4,17 +4,20 @@ from typing import TYPE_CHECKING, Annotated
import click
import typer
+from posthog import new_context, tag
from pipelex import pretty_print
from pipelex.builder.builder import PipelexBundleSpec, load_and_validate_bundle
from pipelex.builder.builder_errors import PipeBuilderError, PipelexBundleError
from pipelex.builder.builder_loop import BuilderLoop
from pipelex.builder.runner_code import generate_runner_code
-from pipelex.exceptions import PipeInputError
+from pipelex.exceptions import PipeInputError, PipelineExecutionError
from pipelex.hub import get_report_delegate, get_required_pipe
from pipelex.language.plx_factory import PlxFactory
-from pipelex.pipelex import Pipelex
+from pipelex.pipelex import PACKAGE_VERSION, Pipelex
from pipelex.pipeline.execute import execute_pipeline
+from pipelex.system.runtime import IntegrationMode
+from pipelex.system.telemetry.events import EventProperty
from pipelex.tools.misc.file_utils import ensure_directory_for_file_path, get_incremental_file_path, save_text_to_path
from pipelex.tools.misc.json_utils import load_json_dict_from_path, save_as_json_to_path
@@ -43,8 +46,15 @@ pipelex build pipe "Given an RDFP PDF, build a compliance matrix"
pipelex build pipe "Given a theme, write a Haiku"
"""
+COMMAND = "build"
-@build_app.command("pipe", help="Build a Pipelex bundle with one validation/fix loop correcting deterministic issues")
+SUB_COMMAND_PIPE = "pipe"
+SUB_COMMAND_RUNNER = "runner"
+SUB_COMMAND_ONE_SHOT_PIPE = "one-shot-pipe"
+SUB_COMMAND_PARTIAL_PIPE = "partial-pipe"
+
+
+@build_app.command(SUB_COMMAND_PIPE, help="Build a Pipelex bundle with one validation/fix loop correcting deterministic issues")
def build_pipe_cmd(
prompt: Annotated[
str,
@@ -63,7 +73,7 @@ def build_pipe_cmd(
typer.Option("--no-output", help="Skip saving the pipeline to file"),
] = False,
) -> None:
- Pipelex.make()
+ Pipelex.make(integration_mode=IntegrationMode.CLI)
typer.echo("=" * 70)
typer.secho("🔥 Starting pipe builder... 🚀", fg=typer.colors.GREEN)
typer.echo("")
@@ -84,7 +94,7 @@ def build_pipe_cmd(
return
try:
- pipelex_bundle_spec = await builder_loop.build_and_fix(pipe_code=builder_pipe, input_memory={"brief": prompt})
+ pipelex_bundle_spec = await builder_loop.build_and_fix(pipe_code=builder_pipe, inputs={"brief": prompt})
except PipeBuilderError as exc:
msg = f"Builder loop: Failed to execute pipeline: {exc}."
if exc.working_memory:
@@ -104,15 +114,20 @@ def build_pipe_cmd(
save_text_to_path(text=plx_content, path=output_path)
typer.secho(f"\n✅ Pipeline saved to: {output_path}", fg=typer.colors.GREEN)
- start_time = time.time()
- asyncio.run(run_pipeline())
- end_time = time.time()
- typer.secho(f"\n✅ Pipeline built in {end_time - start_time:.2f} seconds", fg=typer.colors.GREEN)
+ with new_context():
+ tag(name=EventProperty.INTEGRATION, value=IntegrationMode.CLI)
+ tag(name=EventProperty.PIPELEX_VERSION, value=PACKAGE_VERSION)
+ tag(name=EventProperty.CLI_COMMAND, value=f"{COMMAND} {SUB_COMMAND_PIPE}")
- get_report_delegate().generate_report()
+ start_time = time.time()
+ asyncio.run(run_pipeline())
+ end_time = time.time()
+ typer.secho(f"\n✅ Pipeline built in {end_time - start_time:.2f} seconds", fg=typer.colors.GREEN)
+ get_report_delegate().generate_report()
-@build_app.command("runner", help="Build the Python code to run a pipe with the necessary inputs")
+
+@build_app.command(SUB_COMMAND_RUNNER, help="Build the Python code to run a pipe with the necessary inputs")
def prepare_runner_cmd(
target: Annotated[
str | None,
@@ -193,7 +208,7 @@ def prepare_runner_cmd(
async def prepare_runner(pipe_code: str | None = None, bundle_path: str | None = None):
# Initialize Pipelex
- Pipelex.make()
+ Pipelex.make(integration_mode=IntegrationMode.CLI)
if bundle_path:
try:
@@ -250,10 +265,15 @@ def prepare_runner_cmd(
typer.secho(f"❌ Error saving file: {exc}", fg=typer.colors.RED)
raise typer.Exit(1) from exc
- asyncio.run(prepare_runner(pipe_code=pipe_code, bundle_path=bundle_path))
+ with new_context():
+ tag(name=EventProperty.INTEGRATION, value=IntegrationMode.CLI)
+ tag(name=EventProperty.PIPELEX_VERSION, value=PACKAGE_VERSION)
+ tag(name=EventProperty.CLI_COMMAND, value=f"{COMMAND} {SUB_COMMAND_RUNNER}")
+
+ asyncio.run(prepare_runner(pipe_code=pipe_code, bundle_path=bundle_path))
-@build_app.command("one-shot-pipe", help="Developer utility for contributors: deliver pipeline in one shot, without validation loop")
+@build_app.command(SUB_COMMAND_ONE_SHOT_PIPE, help="Developer utility for contributors: deliver pipeline in one shot, without validation loop")
def build_one_shot_cmd(
brief: Annotated[
str,
@@ -272,7 +292,7 @@ def build_one_shot_cmd(
typer.Option("--no-output", help="Skip saving the pipeline to file"),
] = False,
) -> None:
- Pipelex.make()
+ Pipelex.make(integration_mode=IntegrationMode.CLI)
typer.echo("=" * 70)
typer.secho("🔥 Starting pipe builder... 🚀", fg=typer.colors.GREEN)
typer.echo("")
@@ -286,10 +306,14 @@ def build_one_shot_cmd(
else:
ensure_directory_for_file_path(file_path=output_path)
- pipe_output = await execute_pipeline(
- pipe_code=builder_pipe,
- inputs={"brief": brief},
- )
+ try:
+ pipe_output = await execute_pipeline(
+ pipe_code=builder_pipe,
+ inputs={"brief": brief},
+ )
+ except PipelineExecutionError as exc:
+ typer.secho(f"Failed to execute pipeline: {exc}", fg=typer.colors.RED, err=True)
+ raise typer.Exit(1) from exc
pretty_print(pipe_output, title="Pipe Output")
# Save to file unless explicitly disabled with --no-output
@@ -302,21 +326,27 @@ def build_one_shot_cmd(
save_text_to_path(text=plx_content, path=output_path)
typer.secho(f"\n✅ Pipeline saved to: {output_path}", fg=typer.colors.GREEN)
- start_time = time.time()
- asyncio.run(run_pipeline())
- end_time = time.time()
- typer.secho(f"\n✅ Pipeline built in {end_time - start_time:.2f} seconds", fg=typer.colors.GREEN)
+ with new_context():
+ tag(name=EventProperty.INTEGRATION, value=IntegrationMode.CLI)
+ tag(name=EventProperty.PIPELEX_VERSION, value=PACKAGE_VERSION)
+ tag(name=EventProperty.CLI_COMMAND, value=f"{COMMAND} {SUB_COMMAND_ONE_SHOT_PIPE}")
+
+ start_time = time.time()
+ asyncio.run(run_pipeline())
+ end_time = time.time()
+ typer.secho(f"\n✅ Pipeline built in {end_time - start_time:.2f} seconds", fg=typer.colors.GREEN)
- get_report_delegate().generate_report()
+ get_report_delegate().generate_report()
@build_app.command(
- "partial-pipe", help="Developer utility for contributors: deliver a partial pipeline specification (not an actual bundle) and save it as JSON"
+ SUB_COMMAND_PARTIAL_PIPE,
+ help="Developer utility for contributors: deliver a partial pipeline specification (not an actual bundle) and save it as JSON",
)
def build_partial_cmd(
inputs: Annotated[
str,
- typer.Argument(help="Inline brief or path to JSON file with input_memory"),
+ typer.Argument(help="Inline brief or path to JSON file with inputs"),
],
builder_pipe: Annotated[
str,
@@ -339,7 +369,7 @@ def build_partial_cmd(
typer.Option("--no-output", help="Skip saving the pipeline to file"),
] = False,
) -> None:
- Pipelex.make()
+ Pipelex.make(integration_mode=IntegrationMode.CLI)
typer.echo("=" * 70)
typer.secho("🔥 Starting pipe builder... 🚀", fg=typer.colors.GREEN)
typer.echo("")
@@ -356,15 +386,19 @@ def build_partial_cmd(
)
ensure_directory_for_file_path(file_path=output_path)
- input_memory: PipelineInputs | None = None
+ pipeline_inputs: PipelineInputs | None = None
if inputs.endswith(".json"):
- input_memory = load_json_dict_from_path(inputs)
+ pipeline_inputs = load_json_dict_from_path(inputs)
else:
- input_memory = {"brief": inputs}
- pipe_output = await execute_pipeline(
- pipe_code=builder_pipe,
- inputs=input_memory,
- )
+ pipeline_inputs = {"brief": inputs}
+ try:
+ pipe_output = await execute_pipeline(
+ pipe_code=builder_pipe,
+ inputs=pipeline_inputs,
+ )
+ except PipelineExecutionError as exc:
+ typer.secho(f"Failed to execute pipeline: {exc}", fg=typer.colors.RED, err=True)
+ raise typer.Exit(1) from exc
# Save to file unless explicitly disabled with --no-output
if output_path:
match extension:
@@ -387,9 +421,14 @@ def build_partial_cmd(
else:
typer.secho("\n⚠️ Pipeline not saved to file (--no-output specified)", fg=typer.colors.YELLOW)
- start_time = time.time()
- asyncio.run(run_pipeline())
- end_time = time.time()
- typer.secho(f"\n✅ Pipeline built in {end_time - start_time:.2f} seconds", fg=typer.colors.GREEN)
+ with new_context():
+ tag(name=EventProperty.INTEGRATION, value=IntegrationMode.CLI)
+ tag(name=EventProperty.PIPELEX_VERSION, value=PACKAGE_VERSION)
+ tag(name=EventProperty.CLI_COMMAND, value=f"{COMMAND} {SUB_COMMAND_PARTIAL_PIPE}")
+
+ start_time = time.time()
+ asyncio.run(run_pipeline())
+ end_time = time.time()
+ typer.secho(f"\n✅ Pipeline built in {end_time - start_time:.2f} seconds", fg=typer.colors.GREEN)
- get_report_delegate().generate_report()
+ get_report_delegate().generate_report()
diff --git a/pipelex/cli/commands/init_cmd.py b/pipelex/cli/commands/init_cmd.py
index e949fce2f..220ee92e4 100644
--- a/pipelex/cli/commands/init_cmd.py
+++ b/pipelex/cli/commands/init_cmd.py
@@ -8,6 +8,7 @@ import typer
from pipelex.exceptions import PipelexCLIError
from pipelex.kit.paths import get_configs_dir
from pipelex.system.configuration.config_loader import config_manager
+from pipelex.system.telemetry.telemetry_config import TELEMETRY_CONFIG_FILE_NAME
PACKAGE_NAME = __name__.split(".", maxsplit=1)[0]
PACKAGE_VERSION = metadata(PACKAGE_NAME)["Version"]
@@ -31,6 +32,10 @@ def do_init_config(reset: bool = False) -> None:
dst_item = os.path.join(dst_dir, item)
relative_item = os.path.join(relative_path, item) if relative_path else item
+ # Skip telemetry.toml - it will be created when user is prompted
+ if item == TELEMETRY_CONFIG_FILE_NAME:
+ continue
+
if os.path.isdir(src_item):
os.makedirs(dst_item, exist_ok=True)
copy_directory_structure(src_item, dst_item, relative_item)
diff --git a/pipelex/cli/commands/run_cmd.py b/pipelex/cli/commands/run_cmd.py
index 878b50bb6..5696d1bd5 100644
--- a/pipelex/cli/commands/run_cmd.py
+++ b/pipelex/cli/commands/run_cmd.py
@@ -1,20 +1,27 @@
from __future__ import annotations
import asyncio
+import json
from typing import Annotated
import click
import typer
+from posthog import new_context, tag
from pipelex import log, pretty_print_md
from pipelex.builder.builder import load_and_validate_bundle
from pipelex.builder.builder_errors import PipelexBundleError
-from pipelex.exceptions import PipeInputError
+from pipelex.exceptions import PipeInputError, PipelineExecutionError
from pipelex.pipelex import Pipelex
from pipelex.pipeline.execute import execute_pipeline
+from pipelex.system.runtime import IntegrationMode
+from pipelex.system.telemetry.events import EventProperty
+from pipelex.system.telemetry.telemetry_manager import PACKAGE_VERSION
from pipelex.tools.misc.file_utils import get_incremental_file_path
from pipelex.tools.misc.json_utils import JsonTypeError, load_json_dict_from_path, save_as_json_to_path
+COMMAND = "run"
+
def run_cmd(
target: Annotated[
@@ -31,7 +38,7 @@ def run_cmd(
] = None,
inputs: Annotated[
str | None,
- typer.Option("--inputs", "-i", help="Path to JSON file with input_memory"),
+ typer.Option("--inputs", "-i", help="Path to JSON file with inputs"),
] = None,
output: Annotated[
str | None,
@@ -104,7 +111,7 @@ def run_cmd(
async def run_pipeline(pipe_code: str | None = None, bundle_path: str | None = None):
# Initialize Pipelex
- Pipelex.make()
+ Pipelex.make(integration_mode=IntegrationMode.CLI)
source_description: str
if bundle_path:
try:
@@ -135,25 +142,32 @@ def run_cmd(
try:
# Load inputs if provided
- input_memory = None
+ pipeline_inputs = None
if inputs:
- try:
- input_memory = load_json_dict_from_path(inputs)
- typer.echo(f"Loaded inputs from: {inputs}")
- except FileNotFoundError as file_not_found_exc:
- typer.secho(f"Failed to load input file '{inputs}': file not found", fg=typer.colors.RED, err=True)
- raise typer.Exit(1) from file_not_found_exc
- except JsonTypeError as json_type_error_exc:
- typer.secho(f"Failed to parse input file '{inputs}': must be a valid JSON dictionary", fg=typer.colors.RED, err=True)
- raise typer.Exit(1) from json_type_error_exc
+ if inputs.startswith("{"):
+ pipeline_inputs = json.loads(inputs)
+ else:
+ try:
+ pipeline_inputs = load_json_dict_from_path(inputs)
+ typer.echo(f"Loaded inputs from: {inputs}")
+ except FileNotFoundError as file_not_found_exc:
+ typer.secho(f"Failed to load input file '{inputs}': file not found", fg=typer.colors.RED, err=True)
+ raise typer.Exit(1) from file_not_found_exc
+ except JsonTypeError as json_type_error_exc:
+ typer.secho(f"Failed to parse input file '{inputs}': must be a valid JSON dictionary", fg=typer.colors.RED, err=True)
+ raise typer.Exit(1) from json_type_error_exc
# Execute pipeline
typer.secho(f"\n🚀 Executing {source_description}...\n", fg=typer.colors.GREEN, bold=True)
- pipe_output = await execute_pipeline(
- pipe_code=pipe_code,
- inputs=input_memory,
- )
+ try:
+ pipe_output = await execute_pipeline(
+ pipe_code=pipe_code,
+ inputs=pipeline_inputs,
+ )
+ except PipelineExecutionError as exc:
+ typer.secho(f"Failed to execute pipeline: {exc}", fg=typer.colors.RED, err=True)
+ raise typer.Exit(1) from exc
# Pretty print main_stuff unless disabled
if not no_pretty_print:
@@ -179,4 +193,8 @@ def run_cmd(
typer.secho(f"Failed to execute pipeline: {exc}", fg=typer.colors.RED, err=True)
raise typer.Exit(1) from exc
- asyncio.run(run_pipeline(pipe_code=pipe_code, bundle_path=bundle_path))
+ with new_context():
+ tag(name=EventProperty.INTEGRATION, value=IntegrationMode.CLI)
+ tag(name=EventProperty.PIPELEX_VERSION, value=PACKAGE_VERSION)
+ tag(name=EventProperty.CLI_COMMAND, value=COMMAND)
+ asyncio.run(run_pipeline(pipe_code=pipe_code, bundle_path=bundle_path))
diff --git a/pipelex/cli/commands/show_cmd.py b/pipelex/cli/commands/show_cmd.py
index 5222e42b6..34e84d937 100644
--- a/pipelex/cli/commands/show_cmd.py
+++ b/pipelex/cli/commands/show_cmd.py
@@ -4,6 +4,7 @@ import asyncio
from typing import TYPE_CHECKING, Annotated, cast
import typer
+from posthog import new_context, tag
from rich import box
from rich.console import Console
from rich.table import Table
@@ -12,13 +13,22 @@ from pipelex import pretty_print
from pipelex.cogt.model_backends.backend_library import InferenceBackendLibrary
from pipelex.cogt.model_backends.model_lists import ModelLister
from pipelex.exceptions import PipelexCLIError, PipelexConfigError
-from pipelex.hub import get_models_manager, get_pipe_library, get_required_pipe
+from pipelex.hub import get_models_manager, get_pipe_library, get_required_pipe, get_telemetry_manager
from pipelex.pipelex import Pipelex
from pipelex.system.configuration.config_loader import config_manager
+from pipelex.system.runtime import IntegrationMode
+from pipelex.system.telemetry.events import EventName, EventProperty
+from pipelex.system.telemetry.telemetry_manager import PACKAGE_VERSION
if TYPE_CHECKING:
from pipelex.cogt.models.model_manager import ModelManager
+COMMAND = "show"
+SUB_COMMAND_PIPES = "pipes"
+SUB_COMMAND_PIPE = "pipe"
+SUB_COMMAND_MODELS = "models"
+SUB_COMMAND_BACKENDS = "backends"
+
def do_show_config() -> None:
"""Show the pipelex configuration."""
@@ -32,10 +42,9 @@ def do_show_config() -> None:
def do_list_pipes() -> None:
"""List all available pipes."""
- Pipelex.make()
-
try:
- get_pipe_library().pretty_list_pipes()
+ nb_pipes = get_pipe_library().pretty_list_pipes()
+ get_telemetry_manager().track_event(EventName.PIPES_LIST, properties={EventProperty.NB_PIPES: nb_pipes})
except Exception as exc:
msg = f"Failed to list pipes: {exc}"
raise PipelexCLIError(msg) from exc
@@ -43,15 +52,13 @@ def do_list_pipes() -> None:
def do_show_pipe(pipe_code: str) -> None:
"""Show a single pipe definition from the library."""
- Pipelex.make()
pipe = get_required_pipe(pipe_code=pipe_code)
+ get_telemetry_manager().track_event(EventName.PIPE_SHOW, properties={EventProperty.PIPE_TYPE: pipe.type})
pretty_print(pipe, title=f"Pipe '{pipe_code}'")
def do_show_backends(show_all: bool = False) -> None:
"""Display all backends and the active routing profile."""
- Pipelex.make()
-
try:
models_manager = cast("ModelManager", get_models_manager())
@@ -152,6 +159,7 @@ def do_show_backends(show_all: bool = False) -> None:
console.print("[dim]💡 To enable more backends, edit: [bold].pipelex/inference/backends.toml[/bold][/dim]")
console.print("[dim]💡 To list available models for a backend: [bold]pipelex show models <backend_name>[/bold][/dim]\n")
+ get_telemetry_manager().track_event(EventName.BACKENDS_SHOW, properties={EventProperty.NB_BACKENDS: len(all_backends)})
# Typer group for show commands
@@ -172,7 +180,14 @@ def list_pipes_cmd() -> None:
This includes pipes from your project's .plx files and any
pipes from imported packages.
"""
- do_list_pipes()
+ Pipelex.make(integration_mode=IntegrationMode.CLI)
+
+ with new_context():
+ tag(name=EventProperty.INTEGRATION, value=IntegrationMode.CLI)
+ tag(name=EventProperty.PIPELEX_VERSION, value=PACKAGE_VERSION)
+ tag(name=EventProperty.CLI_COMMAND, value=f"{COMMAND} {SUB_COMMAND_PIPES}")
+
+ do_list_pipes()
@show_app.command("pipe", help="Display the detailed definition of a specific pipe")
@@ -185,7 +200,14 @@ def show_pipe_cmd(
Example:
pipelex show pipe hello_world
"""
- do_show_pipe(pipe_code=pipe_code)
+ Pipelex.make(integration_mode=IntegrationMode.CLI)
+
+ with new_context():
+ tag(name=EventProperty.INTEGRATION, value=IntegrationMode.CLI)
+ tag(name=EventProperty.PIPELEX_VERSION, value=PACKAGE_VERSION)
+ tag(name=EventProperty.CLI_COMMAND, value=f"{COMMAND} {SUB_COMMAND_PIPE}")
+
+ do_show_pipe(pipe_code=pipe_code)
@show_app.command("models", help="List available AI models from a specific backend provider")
@@ -205,12 +227,18 @@ def show_models_cmd(
pipelex show models openai
pipelex show models anthropic --flat
"""
- asyncio.run(
- ModelLister.list_models(
- backend_name=backend_name,
- flat=flat,
+ Pipelex.make(integration_mode=IntegrationMode.CLI)
+ with new_context():
+ tag(name=EventProperty.INTEGRATION, value=IntegrationMode.CLI)
+ tag(name=EventProperty.PIPELEX_VERSION, value=PACKAGE_VERSION)
+ tag(name=EventProperty.CLI_COMMAND, value=f"{COMMAND} {SUB_COMMAND_MODELS}")
+
+ asyncio.run(
+ ModelLister.list_models(
+ backend_name=backend_name,
+ flat=flat,
+ )
)
- )
@show_app.command("backends", help="Display backend configurations and active routing profile")
@@ -225,4 +253,10 @@ def show_backends_cmd(
pipelex show backends
pipelex show backends --all
"""
- do_show_backends(show_all=show_all_backends)
+ Pipelex.make(integration_mode=IntegrationMode.CLI)
+ with new_context():
+ tag(name=EventProperty.INTEGRATION, value=IntegrationMode.CLI)
+ tag(name=EventProperty.PIPELEX_VERSION, value=PACKAGE_VERSION)
+ tag(name=EventProperty.CLI_COMMAND, value=f"{COMMAND} {SUB_COMMAND_BACKENDS}")
+
+ do_show_backends(show_all=show_all_backends)
diff --git a/pipelex/cli/commands/validate_cmd.py b/pipelex/cli/commands/validate_cmd.py
index 472277dcf..4a4e97248 100644
--- a/pipelex/cli/commands/validate_cmd.py
+++ b/pipelex/cli/commands/validate_cmd.py
@@ -5,6 +5,7 @@ from typing import TYPE_CHECKING, Annotated
import click
import typer
+from posthog import new_context, tag
from rich.console import Console
from rich.syntax import Syntax
@@ -13,21 +14,33 @@ from pipelex.builder.builder_errors import PipelexBundleError
from pipelex.builder.builder_validation import validate_dry_run_bundle_blueprint
from pipelex.core.interpreter import PipelexInterpreter
from pipelex.exceptions import LibraryLoadingError, PipeInputError
-from pipelex.hub import get_pipes, get_required_pipe
+from pipelex.hub import get_pipes, get_required_pipe, get_telemetry_manager
from pipelex.pipe_run.dry_run import dry_run_pipe, dry_run_pipes
from pipelex.pipelex import Pipelex
+from pipelex.system.runtime import IntegrationMode
+from pipelex.system.telemetry.events import EventName, EventProperty
+from pipelex.system.telemetry.telemetry_manager import PACKAGE_VERSION
if TYPE_CHECKING:
from pipelex.core.validation_errors import ValidationErrorDetailsProtocol
console = Console()
+COMMAND = "validate"
+
def do_validate_all_libraries_and_dry_run() -> None:
"""Validate libraries and dry-run all pipes."""
- pipelex_instance = Pipelex.make()
- pipelex_instance.validate_libraries()
- asyncio.run(dry_run_pipes(pipes=get_pipes(), raise_on_failure=True))
- log.info("Setup sequence passed OK, config and pipelines are validated.")
+ pipelex_instance = Pipelex.make(integration_mode=IntegrationMode.CLI)
+ with new_context():
+ tag(name=EventProperty.INTEGRATION, value=IntegrationMode.CLI)
+ tag(name=EventProperty.PIPELEX_VERSION, value=PACKAGE_VERSION)
+ tag(name=EventProperty.CLI_COMMAND, value=f"{COMMAND} all")
+
+ pipelex_instance.validate_libraries()
+ pipes = get_pipes()
+ get_telemetry_manager().track_event(EventName.PIPE_DRY_RUN, properties={EventProperty.NB_PIPES: len(pipes)})
+ asyncio.run(dry_run_pipes(pipes=pipes, raise_on_failure=True))
+ log.info("Setup sequence passed OK, config and pipelines are validated.")
def validate_cmd(
@@ -103,18 +116,14 @@ def validate_cmd(
raise typer.Exit(1)
async def validate_pipe(pipe_code: str | None = None, bundle_path: str | None = None):
- # Initialize Pipelex
- try:
- pipelex_instance = Pipelex.make()
- except LibraryLoadingError as library_loading_error:
- typer.secho(f"Failed to validate: {library_loading_error}", fg=typer.colors.RED, err=True)
- present_validation_error(details_provider=library_loading_error)
- raise typer.Exit(1) from library_loading_error
-
if bundle_path:
# When validating a bundle, load_pipe_from_bundle validates ALL pipes in the bundle
try:
bundle_blueprint = PipelexInterpreter.load_bundle_blueprint(bundle_path=bundle_path)
+ get_telemetry_manager().track_event(
+ EventName.BUNDLE_DRY_RUN,
+ properties={EventProperty.NB_PIPES: bundle_blueprint.nb_pipes, EventProperty.NB_CONCEPTS: bundle_blueprint.nb_concepts},
+ )
await validate_dry_run_bundle_blueprint(bundle_blueprint=bundle_blueprint)
if not pipe_code:
typer.secho(f"✅ Successfully validated all pipes in bundle '{bundle_path}'", fg=typer.colors.GREEN)
@@ -135,6 +144,9 @@ def validate_cmd(
elif pipe_code:
# Validate a single pipe by code
typer.echo(f"Validating pipe '{pipe_code}'...")
+ get_telemetry_manager().track_event(
+ EventName.PIPE_DRY_RUN, properties={EventProperty.PIPE_TYPE: get_required_pipe(pipe_code=pipe_code).type}
+ )
pipelex_instance.validate_libraries()
await dry_run_pipe(
get_required_pipe(pipe_code=pipe_code),
@@ -145,7 +157,23 @@ def validate_cmd(
typer.secho("Failed to validate: no pipe code or bundle specified", fg=typer.colors.RED, err=True)
raise typer.Exit(1)
- asyncio.run(validate_pipe(pipe_code=pipe_code, bundle_path=bundle_path))
+ # Initialize Pipelex
+ try:
+ pipelex_instance = Pipelex.make(integration_mode=IntegrationMode.CLI)
+ except LibraryLoadingError as library_loading_error:
+ typer.secho(f"Failed to validate: {library_loading_error}", fg=typer.colors.RED, err=True)
+ present_validation_error(details_provider=library_loading_error)
+ raise typer.Exit(1) from library_loading_error
+
+ with new_context():
+ tag(name=EventProperty.INTEGRATION, value=IntegrationMode.CLI)
+ tag(name=EventProperty.PIPELEX_VERSION, value=PACKAGE_VERSION)
+ if bundle_path:
+ tag(name=EventProperty.CLI_COMMAND, value=f"{COMMAND} bundle")
+ else:
+ tag(name=EventProperty.CLI_COMMAND, value=f"{COMMAND} pipe")
+
+ asyncio.run(validate_pipe(pipe_code=pipe_code, bundle_path=bundle_path))
def present_validation_error(details_provider: ValidationErrorDetailsProtocol):
diff --git a/pipelex/client/client.py b/pipelex/client/client.py
index 2edceb323..ea9184a38 100644
--- a/pipelex/client/client.py
+++ b/pipelex/client/client.py
@@ -5,7 +5,7 @@ from typing_extensions import override
from pipelex.client.pipeline_request_factory import PipelineRequestFactory
from pipelex.client.pipeline_response_factory import PipelineResponseFactory
-from pipelex.client.protocol import PipelexProtocol, PipelineInputs, PipelineResponse
+from pipelex.client.protocol import PipelexProtocol, PipelineInputs, PipelineRequest, PipelineRequestError, PipelineResponse
from pipelex.core.memory.working_memory import WorkingMemory
from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory
from pipelex.core.pipes.variable_multiplicity import VariableMultiplicity
@@ -80,52 +80,90 @@ class PipelexClient(PipelexProtocol):
@override
async def execute_pipeline(
self,
- pipe_code: str,
- working_memory: WorkingMemory | None = None,
- inputs: PipelineInputs | None = None,
+ pipe_code: str | None = None,
+ plx_content: str | None = None,
+ inputs: PipelineInputs | WorkingMemory | None = None,
output_name: str | None = None,
output_multiplicity: VariableMultiplicity | None = None,
dynamic_output_concept_code: str | None = None,
) -> PipelineResponse:
- if working_memory and inputs:
- msg = f"'working_memory' and 'inputs' cannot be provided together to the API execute_pipeline {pipe_code=}."
- raise ValueError(msg)
+ """Execute a pipeline synchronously and wait for its completion.
+ Args:
+ pipe_code: The code identifying the pipeline to execute
+ plx_content: Content of the pipeline bundle to execute
+ inputs: Inputs passed to the pipeline
+ output_name: Name of the output slot to write to
+ output_multiplicity: Output multiplicity setting
+ dynamic_output_concept_code: Override for the dynamic output concept code
+ Returns:
+ PipelineResponse: Complete execution results including pipeline state and output
+
+ """
+ if not pipe_code and not plx_content:
+ msg = "Either pipe_code or plx_content must be provided to the API execute_pipeline."
+ raise PipelineRequestError(message=msg)
+
+ working_memory: WorkingMemory | None = None
+ pipeline_request: PipelineRequest | None = None
if inputs is not None:
- working_memory = WorkingMemoryFactory.make_from_pipeline_inputs(pipeline_inputs=inputs)
+ if isinstance(inputs, WorkingMemory):
+ working_memory = inputs
+ else:
+ working_memory = WorkingMemoryFactory.make_from_pipeline_inputs(pipeline_inputs=inputs)
pipeline_request = PipelineRequestFactory.make_from_working_memory(
+ pipe_code=pipe_code,
+ plx_content=plx_content,
working_memory=working_memory,
output_name=output_name,
output_multiplicity=output_multiplicity,
dynamic_output_concept_code=dynamic_output_concept_code,
)
-
- response = await self._make_api_call(f"v1/pipeline/{pipe_code}/execute", request=pipeline_request.model_dump_json())
+ response = await self._make_api_call("v1/pipeline/execute", request=pipeline_request.model_dump_json())
return PipelineResponseFactory.make_from_api_response(response)
@override
async def start_pipeline(
self,
- pipe_code: str,
- working_memory: WorkingMemory | None = None,
- inputs: PipelineInputs | None = None,
+ pipe_code: str | None = None,
+ plx_content: str | None = None,
+ inputs: PipelineInputs | WorkingMemory | None = None,
output_name: str | None = None,
output_multiplicity: VariableMultiplicity | None = None,
dynamic_output_concept_code: str | None = None,
) -> PipelineResponse:
- if working_memory and inputs:
- msg = f"'working_memory' and 'inputs' cannot be provided together to the API start_pipeline {pipe_code=}."
- raise ValueError(msg)
+ """Start a pipeline execution asynchronously without waiting for completion.
+
+ Args:
+ pipe_code: The code identifying the pipeline to execute
+ plx_content: Content of the pipeline bundle to execute
+ inputs: Inputs passed to the pipeline
+ output_name: Name of the output slot to write to
+ output_multiplicity: Output multiplicity setting
+ dynamic_output_concept_code: Override for the dynamic output concept code
+ Returns:
+ PipelineResponse: Initial response with pipeline_run_id and created_at timestamp
+ """
+ if not pipe_code and not plx_content:
+ msg = "Either pipe_code or plx_content must be provided to the API start_pipeline."
+ raise PipelineRequestError(message=msg)
+ working_memory: WorkingMemory | None = None
+ pipeline_request: PipelineRequest | None = None
if inputs is not None:
- working_memory = WorkingMemoryFactory.make_from_pipeline_inputs(pipeline_inputs=inputs)
+ if isinstance(inputs, WorkingMemory):
+ working_memory = inputs
+ else:
+ working_memory = WorkingMemoryFactory.make_from_pipeline_inputs(pipeline_inputs=inputs)
pipeline_request = PipelineRequestFactory.make_from_working_memory(
+ pipe_code=pipe_code,
+ plx_content=plx_content,
working_memory=working_memory,
output_name=output_name,
output_multiplicity=output_multiplicity,
dynamic_output_concept_code=dynamic_output_concept_code,
)
- response = await self._make_api_call(f"v1/pipeline/{pipe_code}/start", request=pipeline_request.model_dump_json())
+ response = await self._make_api_call("v1/pipeline/start", request=pipeline_request.model_dump_json())
return PipelineResponseFactory.make_from_api_response(response)
diff --git a/pipelex/client/pipeline_request_factory.py b/pipelex/client/pipeline_request_factory.py
index 301486f08..29f134944 100644
--- a/pipelex/client/pipeline_request_factory.py
+++ b/pipelex/client/pipeline_request_factory.py
@@ -11,15 +11,18 @@ class PipelineRequestFactory:
@staticmethod
def make_from_working_memory(
+ pipe_code: str | None,
+ plx_content: str | None,
working_memory: WorkingMemory | None = None,
output_name: str | None = None,
output_multiplicity: VariableMultiplicity | None = None,
dynamic_output_concept_code: str | None = None,
- plx_content: str | None = None,
) -> PipelineRequest:
"""Create a PipelineRequest from a WorkingMemory object.
Args:
+ pipe_code: The code identifying the pipeline to execute
+ plx_content: Content of the pipeline bundle to execute
working_memory: The WorkingMemory to convert
output_name: Name of the output slot to write to
output_multiplicity: Output multiplicity setting
@@ -30,12 +33,13 @@ class PipelineRequestFactory:
"""
return PipelineRequest(
+ pipe_code=pipe_code,
+ plx_content=plx_content,
# `ApiSerializer.serialize_working_memory_for_api` returns a dict[str, dict[str, Any]] (plain dicts), which is a valid PipelineInputs
inputs=cast("PipelineInputs", ApiSerializer.serialize_working_memory_for_api(working_memory=working_memory)),
output_name=output_name,
output_multiplicity=output_multiplicity,
dynamic_output_concept_code=dynamic_output_concept_code,
- plx_content=plx_content,
)
@staticmethod
@@ -50,9 +54,10 @@ class PipelineRequestFactory:
"""
return PipelineRequest(
+ pipe_code=request_body.get("pipe_code"),
+ plx_content=request_body.get("plx_content"),
inputs=request_body.get("inputs", {}),
output_name=request_body.get("output_name"),
output_multiplicity=request_body.get("output_multiplicity"),
dynamic_output_concept_code=request_body.get("dynamic_output_concept_code"),
- plx_content=request_body.get("plx_content"),
)
diff --git a/pipelex/client/protocol.py b/pipelex/client/protocol.py
index 429b03398..1f1e22fa4 100644
--- a/pipelex/client/protocol.py
+++ b/pipelex/client/protocol.py
@@ -1,7 +1,7 @@
from abc import abstractmethod
from typing import Any, Protocol, Sequence
-from pydantic import BaseModel
+from pydantic import BaseModel, model_validator
from pydantic.functional_validators import SkipValidation
from typing_extensions import Annotated, runtime_checkable
@@ -10,6 +10,7 @@ from pipelex.core.pipes.pipe_output import DictPipeOutput
from pipelex.core.pipes.variable_multiplicity import VariableMultiplicity
from pipelex.core.stuffs.stuff import DictStuff
from pipelex.core.stuffs.stuff_content import StuffContent
+from pipelex.exceptions import PipelexException
from pipelex.types import StrEnum
# StuffContentOrData represents all possible formats for pipeline inputs input:
@@ -64,24 +65,42 @@ class ApiResponse(BaseModel):
error: str | None = None
+class PipelineRequestError(PipelexException):
+ pass
+
+
class PipelineRequest(BaseModel):
"""Request for executing a pipeline.
Attributes:
+ pipe_code (str | None): Code of the pipe to execute
+ plx_content (str | None): Content of the pipeline bundle to execute
inputs (PipelineInputs | None): Inputs in PipelineInputs format - Pydantic validation is skipped
to preserve the flexible format (dicts, strings, StuffContent objects, etc.)
output_name (str | None): Name of the output slot to write to
output_multiplicity (PipeOutputMultiplicity | None): Output multiplicity setting
dynamic_output_concept_code (str | None): Override for the dynamic output concept code
- plx_content (str | None): Content of the pipeline bundle to execute
"""
+ pipe_code: str | None = None
+ plx_content: str | None = None
inputs: Annotated[PipelineInputs | None, SkipValidation] = None
output_name: str | None = None
output_multiplicity: VariableMultiplicity | None = None
dynamic_output_concept_code: str | None = None
- plx_content: str | None = None
+
+ @model_validator(mode="before")
+ @classmethod
+ def validate_request(cls, values: dict[str, Any]):
+ if values.get("pipe_code") is None and values.get("plx_content") is None:
+ msg = (
+ "pipe_code and plx_content cannot be None together. Its either: Both of them, or if there is no plx_content, "
+ "then pipe_code must be provided and must reference a pipe already registered in the library."
+ "If plx_content is provided but no pipe_code, plx_content must have a main_pipe property."
+ )
+ raise PipelineRequestError(msg)
+ return values
class PipelineResponse(ApiResponse):
@@ -126,9 +145,9 @@ class PipelexProtocol(Protocol):
@abstractmethod
async def execute_pipeline(
self,
- pipe_code: str,
- working_memory: WorkingMemory | None = None,
- inputs: PipelineInputs | None = None,
+ pipe_code: str | None = None,
+ plx_content: str | None = None,
+ inputs: PipelineInputs | WorkingMemory | None = None,
output_name: str | None = None,
output_multiplicity: VariableMultiplicity | None = None,
dynamic_output_concept_code: str | None = None,
@@ -137,8 +156,8 @@ class PipelexProtocol(Protocol):
Args:
pipe_code (str): The code identifying the pipeline to execute
- working_memory (WorkingMemory | None): Memory context passed to the pipeline
- inputs (PipelineInputs | None): Inputs passed to the pipeline
+ plx_content (str | None): Content of the pipeline bundle to execute
+ inputs (PipelineInputs | WorkingMemory | None): Inputs passed to the pipeline
output_name (str | None): Target output slot name
output_multiplicity (PipeOutputMultiplicity | None): Output multiplicity setting
dynamic_output_concept_code (str | None): Override for dynamic output concept
@@ -155,9 +174,9 @@ class PipelexProtocol(Protocol):
@abstractmethod
async def start_pipeline(
self,
- pipe_code: str,
- working_memory: WorkingMemory | None = None,
- inputs: PipelineInputs | None = None,
+ pipe_code: str | None = None,
+ plx_content: str | None = None,
+ inputs: PipelineInputs | WorkingMemory | None = None,
output_name: str | None = None,
output_multiplicity: VariableMultiplicity | None = None,
dynamic_output_concept_code: str | None = None,
@@ -166,8 +185,8 @@ class PipelexProtocol(Protocol):
Args:
pipe_code (str): The code identifying the pipeline to execute
- working_memory (WorkingMemory | None): Memory context passed to the pipeline
- inputs (PipelineInputs | None): Inputs passed to the pipeline
+ plx_content (str | None): Content of the pipeline bundle to execute
+ inputs (PipelineInputs | WorkingMemory | None): Inputs passed to the pipeline
output_name (str | None): Target output slot name
output_multiplicity (PipeOutputMultiplicity | None): Output multiplicity setting
dynamic_output_concept_code (str | None): Override for dynamic output concept
diff --git a/pipelex/cogt/llm/llm_worker_internal_abstract.py b/pipelex/cogt/llm/llm_worker_internal_abstract.py
index 81c26e25a..ec02cd435 100644
--- a/pipelex/cogt/llm/llm_worker_internal_abstract.py
+++ b/pipelex/cogt/llm/llm_worker_internal_abstract.py
@@ -49,7 +49,7 @@ class LLMWorkerInternalAbstract(LLMWorkerAbstract):
self,
llm_job: LLMJob,
):
- log.info(f"LLM Worker: {self.desc} --------------------------------")
+ log.info(f"{self.desc} --------------------------------")
await super()._before_job(llm_job=llm_job)
llm_job.llm_job_before_start(inference_model=self.inference_model)
if get_config().cogt.llm_config.is_dump_text_prompts_enabled:
diff --git a/pipelex/cogt/model_backends/model_lists.py b/pipelex/cogt/model_backends/model_lists.py
index 777571c18..c283ae6fe 100644
--- a/pipelex/cogt/model_backends/model_lists.py
+++ b/pipelex/cogt/model_backends/model_lists.py
@@ -18,7 +18,6 @@ if TYPE_CHECKING:
from pipelex.cogt.model_backends.backend import InferenceBackend
from pipelex.exceptions import PipelexCLIError
from pipelex.hub import get_models_manager
-from pipelex.pipelex import Pipelex
from pipelex.plugins.openai.openai_llms import openai_list_available_models
from pipelex.plugins.plugin_sdk_registry import Plugin
from pipelex.tools.aws.aws_config import AwsCredentialsError
@@ -39,8 +38,6 @@ class ModelLister:
backend_name: Name of the backend to list models for
flat: Whether to output in flat CSV format
"""
- Pipelex.make()
-
try:
backend = get_models_manager().get_required_inference_backend(backend_name)
except Exception as exc:
diff --git a/pipelex/config.py b/pipelex/config.py
index 2f328d22b..f82415790 100644
--- a/pipelex/config.py
+++ b/pipelex/config.py
@@ -77,7 +77,6 @@ class PromptingConfig(ConfigModel):
class FeatureConfig(ConfigModel):
is_pipeline_tracking_enabled: bool
- is_activity_tracking_enabled: bool
is_reporting_enabled: bool
diff --git a/pipelex/core/bundles/pipelex_bundle_blueprint.py b/pipelex/core/bundles/pipelex_bundle_blueprint.py
index f55c599db..31cf0851c 100644
--- a/pipelex/core/bundles/pipelex_bundle_blueprint.py
+++ b/pipelex/core/bundles/pipelex_bundle_blueprint.py
@@ -54,3 +54,11 @@ class PipelexBundleBlueprint(BaseModel):
msg = f"Main pipe '{self.main_pipe}' could not be found in bundle spec"
raise PipelexBundleError(message=msg)
return self
+
+ @property
+ def nb_pipes(self) -> int:
+ return len(self.pipe) if self.pipe else 0
+
+ @property
+ def nb_concepts(self) -> int:
+ return len(self.concept) if self.concept else 0
diff --git a/pipelex/core/pipes/pipe_abstract.py b/pipelex/core/pipes/pipe_abstract.py
index f93a60642..bf7736bf8 100644
--- a/pipelex/core/pipes/pipe_abstract.py
+++ b/pipelex/core/pipes/pipe_abstract.py
@@ -24,6 +24,10 @@ class PipeAbstract(ABC, BaseModel):
inputs: InputRequirements = Field(default_factory=InputRequirements)
output: Concept
+ @property
+ def pipe_type(self) -> str:
+ return self.__class__.__name__
+
@field_validator("code", mode="before")
@classmethod
def validate_pipe_code_syntax(cls, code: str) -> str:
@@ -91,7 +95,7 @@ class PipeAbstract(ABC, BaseModel):
limit = pipe_run_params.pipe_stack_limit
if len(pipe_stack) > limit:
msg = f"Exceeded pipe stack limit of {limit}. You can raise that limit in the config. Stack:\n{pipe_stack}"
- raise PipeStackOverflowError(msg)
+ raise PipeStackOverflowError(message=msg, limit=limit, pipe_stack=pipe_stack)
PipeAbstractType = type[PipeAbstract]
diff --git a/pipelex/core/pipes/pipe_library.py b/pipelex/core/pipes/pipe_library.py
index bd51bbd74..d139d0206 100644
--- a/pipelex/core/pipes/pipe_library.py
+++ b/pipelex/core/pipes/pipe_library.py
@@ -42,7 +42,11 @@ class PipeLibrary(RootModel[PipeLibraryRoot], PipeLibraryAbstract):
@override
def add_new_pipe(self, pipe: PipeAbstract):
if pipe.code in self.root:
- msg = f"Pipe '{pipe.code}' already exists in the library"
+ msg = (
+ f"Pipe '{pipe.code}' already exists in the library. You might be running the same pipe twice in the same pipeline."
+ "We do not yet handle this case, so please avoid running the same pipe twice in the same pipeline"
+ "Or consider adding for good in the library and call it by its code."
+ )
raise PipeLibraryError(msg)
self.root[pipe.code] = pipe
@@ -85,7 +89,7 @@ class PipeLibrary(RootModel[PipeLibraryRoot], PipeLibraryAbstract):
self.root = {}
@override
- def pretty_list_pipes(self) -> None:
+ def pretty_list_pipes(self) -> int:
def _format_concept_code(concept_code: str | None, current_domain: str) -> str:
"""Format concept code by removing domain prefix if it matches current domain."""
if not concept_code:
@@ -141,3 +145,4 @@ class PipeLibrary(RootModel[PipeLibraryRoot], PipeLibraryAbstract):
}
pretty_print(table)
+ return len(pipes)
diff --git a/pipelex/core/pipes/pipe_library_abstract.py b/pipelex/core/pipes/pipe_library_abstract.py
index 434fae582..a33fc5f29 100644
--- a/pipelex/core/pipes/pipe_library_abstract.py
+++ b/pipelex/core/pipes/pipe_library_abstract.py
@@ -32,7 +32,7 @@ class PipeLibraryAbstract(ABC):
pass
@abstractmethod
- def pretty_list_pipes(self) -> None:
+ def pretty_list_pipes(self) -> int:
pass
@abstractmethod
diff --git a/pipelex/exceptions.py b/pipelex/exceptions.py
index c584a3ece..f198563a5 100644
--- a/pipelex/exceptions.py
+++ b/pipelex/exceptions.py
@@ -1,5 +1,7 @@
from __future__ import annotations
+from typing import TYPE_CHECKING
+
from click import ClickException
from typing_extensions import override
@@ -14,6 +16,10 @@ from pipelex.core.validation_errors import ValidationErrorDetailsProtocol
from pipelex.system.exceptions import RootException
from pipelex.tools.misc.context_provider_abstract import ContextProviderException
+if TYPE_CHECKING:
+ from pipelex.cogt.templating.template_category import TemplateCategory
+ from pipelex.pipe_run.pipe_run_mode import PipeRunMode
+
class PipelexException(RootException):
pass
@@ -270,25 +276,82 @@ class StuffContentValidationError(StuffError):
super().__init__(f"Failed to validate content from {original_type} to {target_type}: {validation_error}")
-class PipeExecutionError(PipelexException):
+class PipeRunError(PipelexException):
pass
-class PipeRunError(PipeExecutionError):
- pass
-
+class DryRunError(PipeRunError):
+ """Raised when a dry run fails due to missing inputs or other validation issues."""
-class PipeStackOverflowError(PipeExecutionError):
- pass
+ def __init__(self, message: str, pipe_type: str, pipe_code: str | None = None):
+ self.pipe_type = pipe_type
+ self.pipe_code = pipe_code
+ super().__init__(message)
-# TODO: create variants of DryRunError for each type of Pipe
-class DryRunError(PipeExecutionError):
+class DryRunMissingInputsError(DryRunError):
"""Raised when a dry run fails due to missing inputs or other validation issues."""
- def __init__(self, message: str, missing_inputs: list[str] | None = None, pipe_code: str | None = None):
+ def __init__(self, message: str, pipe_type: str, pipe_code: str, missing_inputs: list[str] | None = None):
self.missing_inputs = missing_inputs or []
+ super().__init__(message, pipe_type, pipe_code)
+
+
+class DryRunMissingPipesError(DryRunError):
+ """Raised when a dry run fails due to missing pipes or other validation issues."""
+
+ def __init__(self, message: str, pipe_type: str, pipe_code: str, missing_pipes: list[str] | None = None):
+ self.missing_pipes = missing_pipes or []
+ super().__init__(message, pipe_type, pipe_code)
+
+
+class DryRunTemplatingError(DryRunError):
+ """Raised when a dry run fails due to templating issues."""
+
+ def __init__(self, message: str, pipe_type: str, pipe_code: str, template_category: TemplateCategory, template: str):
+ self.template_category = template_category
+ self.template = template
+ super().__init__(message, pipe_type, pipe_code)
+
+
+class PipeStackOverflowError(PipeRunError):
+ def __init__(self, message: str, limit: int, pipe_stack: list[str]):
+ self.limit = limit
+ self.pipe_stack = pipe_stack
+ super().__init__(message)
+
+
+class PipeRouterError(PipelexException):
+ def __init__(
+ self,
+ message: str,
+ run_mode: PipeRunMode,
+ pipe_code: str,
+ output_name: str | None,
+ pipe_stack: list[str],
+ missing_inputs: list[str] | None = None,
+ ):
+ self.run_mode = run_mode
+ self.pipe_code = pipe_code
+ self.output_name = output_name
+ self.pipe_stack = pipe_stack
+ self.missing_inputs = missing_inputs
+ super().__init__(message)
+
+
+class PipelineExecutionError(PipelexException):
+ def __init__(
+ self,
+ message: str,
+ run_mode: PipeRunMode,
+ pipe_code: str,
+ output_name: str | None,
+ pipe_stack: list[str],
+ ):
+ self.run_mode = run_mode
self.pipe_code = pipe_code
+ self.output_name = output_name
+ self.pipe_stack = pipe_stack
super().__init__(message)
@@ -389,3 +452,7 @@ class StartPipelineError(Exception):
class PipelineInputError(Exception):
pass
+
+
+class PipeExecutionError(PipelexException):
+ pass
diff --git a/pipelex/hub.py b/pipelex/hub.py
index d8a851d33..1af5c59b9 100644
--- a/pipelex/hub.py
+++ b/pipelex/hub.py
@@ -29,6 +29,7 @@ from pipelex.plugins.plugin_manager import PluginManager
from pipelex.reporting.reporting_protocol import ReportingProtocol
from pipelex.system.configuration.config_loader import config_manager
from pipelex.system.configuration.config_root import ConfigRoot
+from pipelex.system.telemetry.telemetry_manager import TelemetryManagerAbstract
from pipelex.tools.secrets.secrets_provider_abstract import SecretsProviderAbstract
from pipelex.tools.storage.storage_provider_abstract import StorageProviderAbstract
@@ -47,6 +48,8 @@ class PipelexHub:
self._secrets_provider: SecretsProviderAbstract | None = None
self._class_registry: ClassRegistryAbstract | None = None
self._storage_provider: StorageProviderAbstract | None = None
+ self._telemetry_manager: TelemetryManagerAbstract | None = None
+
# cogt
self._models_manager: ModelManagerAbstract | None = None
self._plugin_manager: PluginManager | None = None
@@ -116,6 +119,9 @@ class PipelexHub:
def set_class_registry(self, class_registry: ClassRegistryAbstract):
self._class_registry = class_registry
+ def set_telemetry_manager(self, telemetry_manager: TelemetryManagerAbstract):
+ self._telemetry_manager = telemetry_manager
+
# cogt
def set_models_manager(self, models_manager: ModelManagerAbstract):
@@ -200,6 +206,12 @@ class PipelexHub:
raise RuntimeError(msg)
return self._storage_provider
+ def get_telemetry_manager(self) -> TelemetryManagerAbstract:
+ if self._telemetry_manager is None:
+ msg = "TelemetryManager is not initialized"
+ raise RuntimeError(msg)
+ return self._telemetry_manager
+
# cogt
def get_required_models_manager(self) -> ModelManagerAbstract:
@@ -309,6 +321,10 @@ def get_class_registry() -> ClassRegistryAbstract:
return get_pipelex_hub().get_required_class_registry()
+def get_telemetry_manager() -> TelemetryManagerAbstract:
+ return get_pipelex_hub().get_telemetry_manager()
+
+
# cogt
diff --git a/pipelex/kit/agent_rules/run_pipelex.md b/pipelex/kit/agent_rules/run_pipelex.md
index c9241dd75..2f146d388 100644
--- a/pipelex/kit/agent_rules/run_pipelex.md
+++ b/pipelex/kit/agent_rules/run_pipelex.md
@@ -49,7 +49,7 @@ async def extract_gantt(image_url: str) -> GanttChart:
# Run the pipe
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -88,7 +88,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
# If you assign a string, by default it will be considered as a TextContent.
pipe_output = await execute_pipeline(
pipe_code="master_advisory_orchestrator",
- input_memory={
+ inputs={
"user_input": problem_description,
},
)
@@ -98,7 +98,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
# the system knows what content it corresponds to:
pipe_output = await execute_pipeline(
pipe_code="power_extractor_dpe",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
@@ -107,7 +107,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
# Because ImageContent is a native concept, we can use it directly as a value:
pipe_output = await execute_pipeline(
pipe_code="fashion_variation_pipeline",
- input_memory={
+ inputs={
"fashion_photo": ImageContent(url=image_url),
},
)
@@ -117,7 +117,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
# so we must provide it using a dict with the concept and the content:
pipe_output = await execute_pipeline(
pipe_code="extract_gantt_by_steps",
- input_memory={
+ inputs={
"gantt_chart_image": {
"concept": "gantt.GanttImage",
"content": ImageContent(url=image_url),
@@ -129,7 +129,7 @@ So here are a few concrete examples of calls to execute_pipeline with various wa
pipe_output = await execute_pipeline(
pipe_code="retrieve_then_answer",
dynamic_output_concept_code="contracts.Fees",
- input_memory={
+ inputs={
"text": load_text_from_path(path=text_path),
"question": {
"concept": "answer.Question",
diff --git a/pipelex/kit/configs/inference/backends/azure_openai.toml b/pipelex/kit/configs/inference/backends/azure_openai.toml
index 26e01b4e1..5943007c4 100644
--- a/pipelex/kit/configs/inference/backends/azure_openai.toml
+++ b/pipelex/kit/configs/inference/backends/azure_openai.toml
@@ -96,3 +96,8 @@ inputs = ["text", "images"]
outputs = ["text", "structured"]
costs = { input = 1.25, output = 10.0 }
+[gpt-5]
+model_id = "gpt-5-2025-08-07"
+inputs = ["text", "images"]
+outputs = ["text", "structured"]
+costs = { input = 1.25, output = 10.0 }
diff --git a/pipelex/kit/configs/inference/deck/base_deck.toml b/pipelex/kit/configs/inference/deck/base_deck.toml
index 7cfc55299..7a52ca603 100644
--- a/pipelex/kit/configs/inference/deck/base_deck.toml
+++ b/pipelex/kit/configs/inference/deck/base_deck.toml
@@ -66,7 +66,7 @@ llm_cheap = { model = "base-gemini", temperature = 0.1 }
# Generation skills
llm_for_factual_writing = { model = "base-gpt", temperature = 0.1 }
-llm_for_creative_writing = { model = "claude-4.5-sonnet", temperature = 0.9 }
+llm_for_creative_writing = { model = "base-gpt", temperature = 0.9 }
llm_to_write_questions = { model = "gpt-4o-mini", temperature = 0.3 }
# Reasoning skills
diff --git a/pipelex/kit/configs/pipelex.toml b/pipelex/kit/configs/pipelex.toml
index 89ff02d75..5dc8a89b1 100644
--- a/pipelex/kit/configs/pipelex.toml
+++ b/pipelex/kit/configs/pipelex.toml
@@ -63,7 +63,6 @@ observer_dir = "results/observer"
[pipelex.feature_config]
# WIP/Experimental feature flags
is_pipeline_tracking_enabled = false
-is_activity_tracking_enabled = false
is_reporting_enabled = true
[pipelex.reporting_config]
diff --git a/pipelex/kit/configs/telemetry.toml b/pipelex/kit/configs/telemetry.toml
new file mode 100644
index 000000000..bf3ea0e5b
--- /dev/null
+++ b/pipelex/kit/configs/telemetry.toml
@@ -0,0 +1,9 @@
+telemetry_mode = "off" # Values: "off" | "anonymous" | "identified"
+host = "https://eu.i.posthog.com"
+project_api_key = "phc_HPJnNKpIXh0SxNDYyTAyUtnq9KxNNZJWQszynsWVx4Y"
+respect_dnt = true
+redact = ["prompt", "system_prompt", "response", "file_path", "url"]
+geoip_enabled = true
+dry_mode_enabled = false
+verbose_enabled = false
+user_id = ""
diff --git a/pipelex/kit/migrations/migrate_0.11.0_0.12.x.md b/pipelex/kit/migrations/migrate_0.11.0_0.12.x.md
index 198a79b07..7959a4155 100644
--- a/pipelex/kit/migrations/migrate_0.11.0_0.12.x.md
+++ b/pipelex/kit/migrations/migrate_0.11.0_0.12.x.md
@@ -973,7 +973,7 @@ from pipelex.cogt.extract.extract_worker_abstract import ExtractWorkerAbstract
```python
pipe_output = await execute_pipeline(
pipe_code="ocr_page_contents_from_pdf",
- input_memory={
+ inputs={
"ocr_input": PDFContent(url=pdf_url),
},
)
@@ -983,7 +983,7 @@ pipe_output = await execute_pipeline(
```python
pipe_output = await execute_pipeline(
pipe_code="extract_page_contents_from_pdf",
- input_memory={
+ inputs={
"document": PDFContent(url=pdf_url),
},
)
diff --git a/pipelex/observer/local_observer.py b/pipelex/observer/local_observer.py
index 506b77922..e0428ecc0 100644
--- a/pipelex/observer/local_observer.py
+++ b/pipelex/observer/local_observer.py
@@ -5,6 +5,13 @@ from typing_extensions import override
from pipelex.config import get_config
from pipelex.observer.observer_protocol import ObserverProtocol, PayloadType
+from pipelex.types import StrEnum
+
+
+class LocalObserverEventType(StrEnum):
+ BEFORE_RUN = "before_run"
+ AFTER_SUCCESSFUL_RUN = "after_successful_run"
+ AFTER_FAILING_RUN = "after_failing_run"
class LocalObserver(ObserverProtocol):
@@ -24,12 +31,12 @@ class LocalObserver(ObserverProtocol):
@override
async def observe_before_run(self, payload: PayloadType) -> None:
- self._write_to_jsonl("before_run", payload)
+ self._write_to_jsonl(LocalObserverEventType.BEFORE_RUN, payload)
@override
async def observe_after_successful_run(self, payload: PayloadType) -> None:
- self._write_to_jsonl("successful_run", payload)
+ self._write_to_jsonl(LocalObserverEventType.AFTER_SUCCESSFUL_RUN, payload)
@override
async def observe_after_failing_run(self, payload: PayloadType) -> None:
- self._write_to_jsonl("failing_run", payload)
+ self._write_to_jsonl(LocalObserverEventType.AFTER_FAILING_RUN, payload)
diff --git a/pipelex/observer/observer_protocol.py b/pipelex/observer/observer_protocol.py
index 94d7281a4..1f71edfea 100644
--- a/pipelex/observer/observer_protocol.py
+++ b/pipelex/observer/observer_protocol.py
@@ -2,9 +2,18 @@ from typing import Any, Protocol
from typing_extensions import override
+from pipelex.types import StrEnum
+
PayloadType = dict[str, Any]
+class PayloadKey(StrEnum):
+ PIPELINE_RUN_ID = "pipeline_run_id"
+ PIPE_JOB = "pipe_job"
+ PIPE_OUTPUT = "pipe_output"
+ ERROR = "error"
+
+
class ObserverProtocol(Protocol):
async def observe_before_run(
self,
diff --git a/pipelex/pipe_controllers/condition/pipe_condition.py b/pipelex/pipe_controllers/condition/pipe_condition.py
index df95af863..216df76e6 100644
--- a/pipelex/pipe_controllers/condition/pipe_condition.py
+++ b/pipelex/pipe_controllers/condition/pipe_condition.py
@@ -15,9 +15,10 @@ from pipelex.core.pipes.input_requirements import InputRequirements
from pipelex.core.pipes.input_requirements_factory import InputRequirementsFactory
from pipelex.core.pipes.pipe_output import PipeOutput
from pipelex.exceptions import (
- DryRunError,
+ DryRunMissingInputsError,
+ DryRunMissingPipesError,
+ DryRunTemplatingError,
PipeConditionError,
- PipeExecutionError,
PipeInputError,
StaticValidationError,
StaticValidationErrorType,
@@ -30,6 +31,7 @@ from pipelex.pipe_controllers.pipe_controller import PipeController
from pipelex.pipe_run.pipe_job_factory import PipeJobFactory
from pipelex.pipe_run.pipe_run_params import PipeRunParams
from pipelex.pipeline.job_metadata import JobMetadata
+from pipelex.tools.jinja2.jinja2_errors import Jinja2DetectVariablesError
from pipelex.tools.jinja2.jinja2_required_variables import detect_jinja2_required_variables
from pipelex.tools.typing.validation_utils import has_exactly_one_among_attributes_from_list
from pipelex.types import Self
@@ -93,10 +95,11 @@ class PipeCondition(PipeController):
def applied_expression_template(self) -> str:
if self.expression_template:
return self.expression_template
- if self.expression:
+ elif self.expression:
return "{{ " + self.expression + " }}"
- msg = "No expression or expression_template provided"
- raise PipeExecutionError(msg)
+ else:
+ msg = "No expression or expression_template provided"
+ raise PipeDefinitionError(message=msg, domain_code=self.domain, pipe_code=self.code, description=self.description)
#########################################################################################
# Inputs
@@ -366,10 +369,11 @@ class PipeCondition(PipeController):
if missing_input_names:
log.error(f"Dry run failed: missing required inputs: {missing_input_names}")
- raise DryRunError(
+ raise DryRunMissingInputsError(
message=f"Dry run failed for pipe '{self.code}' (PipeCondition): missing required inputs: {', '.join(missing_input_names)}",
- missing_inputs=missing_input_names,
+ pipe_type=self.__class__.__name__,
pipe_code=self.code,
+ missing_inputs=missing_input_names,
)
# 2. Validate that the expression template is valid
@@ -379,15 +383,18 @@ class PipeCondition(PipeController):
template_source=self.applied_expression_template,
)
log.verbose(f"Expression template is valid, requires variables: {required_variables}")
- except Exception as exc:
- log.error(f"Dry run failed: invalid expression template: {exc}")
- error_msg = (
- f"Dry run failed for pipe '{self.code}' (PipeCondition): invalid expression template '{self.applied_expression_template}': {exc}"
+ except Jinja2DetectVariablesError as exc:
+ log.error(f"Dry run failed: could not detect required variables from expression template: {exc}")
+ msg = (
+ f"Dry run failed for pipe '{self.code}' (PipeCondition): could not detect required variables "
+ f"from expression template: {exc}\nTemplate:\n'{self.applied_expression_template}'"
)
- raise DryRunError(
- message=error_msg,
- missing_inputs=[],
+ raise DryRunTemplatingError(
+ message=msg,
+ pipe_type=self.__class__.__name__,
pipe_code=self.code,
+ template_category=TemplateCategory.EXPRESSION,
+ template=self.applied_expression_template,
) from exc
# 3. Validate that all values in the outcomes map (appart from special outcomes) do exist as pipe codes
@@ -399,11 +406,11 @@ class PipeCondition(PipeController):
missing_pipes = [pipe_code for pipe_code in all_pipe_codes if not get_optional_pipe(pipe_code=pipe_code)]
if missing_pipes:
- error_msg = (
+ msg = (
f"Dry run failed for PipeCondition '{self.code}': missing pipes: {', '.join(missing_pipes)}. "
f"Pipe map: {self.outcome_map}, default: {self.default_outcome}"
)
- raise DryRunError(message=error_msg, pipe_code=self.code)
+ raise DryRunMissingPipesError(message=msg, pipe_type=self.__class__.__name__, pipe_code=self.code, missing_pipes=missing_pipes)
# Here, it should launch the dry run of all the pipes in the outcomes map
for pipe_code in self.mapped_pipe_codes:
diff --git a/pipelex/pipe_controllers/parallel/pipe_parallel.py b/pipelex/pipe_controllers/parallel/pipe_parallel.py
index 7be52e71e..dcda4d2e4 100644
--- a/pipelex/pipe_controllers/parallel/pipe_parallel.py
+++ b/pipelex/pipe_controllers/parallel/pipe_parallel.py
@@ -1,7 +1,7 @@
import asyncio
from typing import TYPE_CHECKING, Any, Literal
-from pydantic import model_validator
+from pydantic import field_validator, model_validator
from typing_extensions import override
from pipelex import log
@@ -13,11 +13,12 @@ from pipelex.core.pipes.input_requirements import InputRequirements
from pipelex.core.pipes.input_requirements_factory import InputRequirementsFactory
from pipelex.core.pipes.pipe_output import PipeOutput
from pipelex.core.stuffs.stuff_factory import StuffFactory
-from pipelex.exceptions import DryRunError, PipeRunParamsError, StaticValidationError, StaticValidationErrorType
+from pipelex.exceptions import DryRunMissingInputsError, PipeRunParamsError, StaticValidationError, StaticValidationErrorType
from pipelex.hub import get_pipeline_tracker, get_required_pipe
from pipelex.pipe_controllers.pipe_controller import PipeController
from pipelex.pipe_controllers.sub_pipe import SubPipe
-from pipelex.pipe_run.pipe_run_params import PipeRunMode, PipeRunParams
+from pipelex.pipe_run.pipe_run_mode import PipeRunMode
+from pipelex.pipe_run.pipe_run_params import PipeRunParams
from pipelex.pipeline.job_metadata import JobMetadata
from pipelex.types import Self
@@ -35,6 +36,23 @@ class PipeParallel(PipeController):
add_each_output: bool
combined_output: Concept | None
+ @field_validator("parallel_sub_pipes", mode="before")
+ @classmethod
+ def validate_parallel_sub_pipes(cls, parallel_sub_pipes: list[SubPipe]) -> list[SubPipe]:
+ seen_output_names: set[str] = set()
+ for sub_pipe in parallel_sub_pipes:
+ if not sub_pipe.output_name:
+ msg = f"PipeParallel '{cls.code}' sub-pipe '{sub_pipe.pipe_code}' output name not specified"
+ raise PipeDefinitionError(msg)
+ if sub_pipe.output_name in seen_output_names:
+ msg = (
+ f"PipeParallel '{cls.code}' sub-pipe '{sub_pipe.pipe_code}' output name '{sub_pipe.output_name}' "
+ "is already used by another sub-pipe"
+ )
+ raise PipeDefinitionError(msg)
+ seen_output_names.add(sub_pipe.output_name)
+ return parallel_sub_pipes
+
@override
def required_variables(self) -> set[str]:
return set()
@@ -234,7 +252,6 @@ class PipeParallel(PipeController):
# 1. Validate that all required inputs are present in the working memory
needed_inputs = self.needed_inputs()
missing_input_names: list[str] = []
-
for named_input_requirement in needed_inputs.named_input_requirements:
if not working_memory.get_optional_stuff(named_input_requirement.variable_name):
missing_input_names.append(named_input_requirement.variable_name)
@@ -242,10 +259,11 @@ class PipeParallel(PipeController):
if missing_input_names:
msg = f"Dry run failed: missing required inputs: {missing_input_names}"
log.error(f"Dry run failed: missing required inputs: {missing_input_names}")
- raise DryRunError(
+ raise DryRunMissingInputsError(
message=msg,
- missing_inputs=missing_input_names,
+ pipe_type=self.__class__.__name__,
pipe_code=self.code,
+ missing_inputs=missing_input_names,
)
# 2. Validate that all sub-pipes exist
@@ -269,16 +287,7 @@ class PipeParallel(PipeController):
),
)
- try:
- pipe_outputs = await asyncio.gather(*tasks)
- except Exception as exc:
- msg = f"Dry run failed: parallel sub-pipe execution failed: {exc}"
- log.error(msg)
- raise DryRunError(
- message=msg,
- missing_inputs=[],
- pipe_code=self.code,
- ) from exc
+ pipe_outputs = await asyncio.gather(*tasks)
# 4. Process outputs as in the regular run
output_stuffs: dict[str, Stuff] = {}
@@ -288,23 +297,19 @@ class PipeParallel(PipeController):
output_stuff = pipe_output.main_stuff
sub_pipe_output_name = self.parallel_sub_pipes[output_index].output_name
if not sub_pipe_output_name:
- msg = f"Dry run failed for pipe '{self.code}' (PipeParallel): sub-pipe output name not specified"
- raise DryRunError(
- message=msg,
- missing_inputs=[],
- pipe_code=self.code,
- )
+ sub_pipe_code = self.parallel_sub_pipes[output_index].pipe_code
+ msg = f"Dry run failed for pipe '{self.code}' (PipeParallel): sub-pipe '{sub_pipe_code}' output name not specified"
+ raise PipeDefinitionError(msg)
if self.add_each_output:
working_memory.add_new_stuff(name=sub_pipe_output_name, stuff=output_stuff)
if sub_pipe_output_name in output_stuffs:
- msg = f"Dry run failed for pipe '{self.code}' (PipeParallel): duplicate output name '{sub_pipe_output_name}'"
- raise DryRunError(
- message=msg,
- missing_inputs=[],
- pipe_code=self.code,
+ sub_pipe_code = self.parallel_sub_pipes[output_index].pipe_code
+ msg = (
+ f"Dry run failed for pipe '{self.code}' (PipeParallel): sub-pipe '{sub_pipe_code}' duplicate output name '{sub_pipe_output_name}'"
)
+ raise PipeDefinitionError(msg)
output_stuffs[sub_pipe_output_name] = output_stuff
output_stuff_contents[sub_pipe_output_name] = output_stuff.content
diff --git a/pipelex/pipe_controllers/pipe_controller.py b/pipelex/pipe_controllers/pipe_controller.py
index d4d94430a..71b87c11c 100644
--- a/pipelex/pipe_controllers/pipe_controller.py
+++ b/pipelex/pipe_controllers/pipe_controller.py
@@ -7,7 +7,8 @@ from pipelex import log
from pipelex.core.memory.working_memory import WorkingMemory
from pipelex.core.pipes.pipe_abstract import PipeAbstract
from pipelex.core.pipes.pipe_output import PipeOutput
-from pipelex.pipe_run.pipe_run_params import PipeRunMode, PipeRunParams
+from pipelex.pipe_run.pipe_run_mode import PipeRunMode
+from pipelex.pipe_run.pipe_run_params import PipeRunParams
from pipelex.pipeline.job_metadata import JobMetadata
diff --git a/pipelex/pipe_operators/compose/pipe_compose.py b/pipelex/pipe_operators/compose/pipe_compose.py
index cdc7871ad..67675a2cd 100644
--- a/pipelex/pipe_operators/compose/pipe_compose.py
+++ b/pipelex/pipe_operators/compose/pipe_compose.py
@@ -22,7 +22,8 @@ from pipelex.core.stuffs.text_content import TextContent
from pipelex.exceptions import PipeRunParamsError
from pipelex.hub import get_content_generator
from pipelex.pipe_operators.pipe_operator import PipeOperator
-from pipelex.pipe_run.pipe_run_params import PipeRunMode, PipeRunParams
+from pipelex.pipe_run.pipe_run_mode import PipeRunMode
+from pipelex.pipe_run.pipe_run_params import PipeRunParams
from pipelex.pipe_run.pipe_run_params_factory import PipeRunParamsFactory
from pipelex.pipeline.job_metadata import JobMetadata
from pipelex.tools.jinja2.jinja2_errors import Jinja2TemplateSyntaxError
diff --git a/pipelex/pipe_operators/extract/pipe_extract.py b/pipelex/pipe_operators/extract/pipe_extract.py
index c56eb9993..e32276a51 100644
--- a/pipelex/pipe_operators/extract/pipe_extract.py
+++ b/pipelex/pipe_operators/extract/pipe_extract.py
@@ -33,7 +33,8 @@ from pipelex.hub import (
get_native_concept,
)
from pipelex.pipe_operators.pipe_operator import PipeOperator
-from pipelex.pipe_run.pipe_run_params import PipeRunMode, PipeRunParams
+from pipelex.pipe_run.pipe_run_mode import PipeRunMode
+from pipelex.pipe_run.pipe_run_params import PipeRunParams
from pipelex.pipeline.job_metadata import JobMetadata
from pipelex.tools.pdf.pypdfium2_renderer import pypdfium2_renderer
from pipelex.types import Self
diff --git a/pipelex/pipe_operators/func/pipe_func.py b/pipelex/pipe_operators/func/pipe_func.py
index c9e7a5350..63e4dc07c 100644
--- a/pipelex/pipe_operators/func/pipe_func.py
+++ b/pipelex/pipe_operators/func/pipe_func.py
@@ -1,19 +1,21 @@
import asyncio
from typing import Literal, cast, get_type_hints
+from pydantic import field_validator
from typing_extensions import override
from pipelex import log
from pipelex.core.concepts.concept_factory import ConceptFactory
from pipelex.core.memory.working_memory import WorkingMemory
from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory
+from pipelex.core.pipe_errors import PipeDefinitionError
from pipelex.core.pipes.input_requirements import InputRequirements, TypedNamedInputRequirement
from pipelex.core.pipes.pipe_output import PipeOutput
from pipelex.core.stuffs.list_content import ListContent
from pipelex.core.stuffs.stuff_content import StuffContent
from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.core.stuffs.text_content import TextContent
-from pipelex.exceptions import DryRunError
+from pipelex.exceptions import DryRunMissingInputsError
from pipelex.pipe_operators.pipe_operator import PipeOperator
from pipelex.pipe_run.pipe_run_params import PipeRunParams
from pipelex.pipeline.job_metadata import JobMetadata
@@ -28,6 +30,24 @@ class PipeFunc(PipeOperator[PipeFuncOutput]):
type: Literal["PipeFunc"] = "PipeFunc"
function_name: str
+ @field_validator("function_name", mode="before")
+ @classmethod
+ def validate_function_name(cls, function_name: str) -> str:
+ function = func_registry.get_function(function_name)
+ if not function:
+ msg = f"Function '{function_name}' not found in registry"
+ raise PipeDefinitionError(msg)
+
+ return_type = get_type_hints(function).get("return")
+
+ if return_type is None:
+ msg = f"Function '{function_name}' has no return type annotation"
+ raise PipeDefinitionError(msg)
+ if not issubclass(return_type, StuffContent):
+ msg = f"Function '{function_name}' return type {return_type} is not a subclass of StuffContent"
+ raise PipeDefinitionError(msg)
+ return function_name
+
@override
def required_variables(self) -> set[str]:
return set()
@@ -99,38 +119,43 @@ class PipeFunc(PipeOperator[PipeFuncOutput]):
# Check that all needed inputs are present in working memory
needed_inputs = self.needed_inputs()
- for input_name, _ in needed_inputs.items:
- if input_name not in working_memory.root:
- msg = f"Required input '{input_name}' not found in working memory for function '{self.function_name}' in pipe '{self.code}'"
- raise DryRunError(msg)
-
- try:
- return_type = get_type_hints(function).get("return")
-
- if return_type is None:
- msg = f"Function '{self.function_name}' has no return type annotation"
- raise DryRunError(msg)
- if not issubclass(return_type, StuffContent):
- msg = f"Function '{self.function_name}' return type {return_type} is not a subclass of StuffContent"
- raise DryRunError(msg)
-
- # TODO: Support PipeFunc returning with multiplicity. Create an equivalent of TypedNamedInputRequirement for outputs.
- requirement = TypedNamedInputRequirement(
- variable_name="mock_output",
- concept=ConceptFactory.make(
- concept_code=self.output.code,
- domain="generic",
- description="Lorem Ipsum",
- structure_class_name=self.output.structure_class_name,
- ),
- structure_class=return_type,
- multiplicity=False,
+
+ missing_input_names: list[str] = []
+ for named_input_requirement in needed_inputs.named_input_requirements:
+ if not working_memory.get_optional_stuff(named_input_requirement.variable_name):
+ missing_input_names.append(named_input_requirement.variable_name)
+ if missing_input_names:
+ msg = f"Dry run failed for PipeFunc (function '{self.function_name}'): missing required inputs: {missing_input_names}"
+ log.error(f"Dry run failed: missing required inputs: {missing_input_names}")
+ raise DryRunMissingInputsError(
+ message=msg,
+ pipe_type=self.__class__.__name__,
+ pipe_code=self.code,
+ missing_inputs=missing_input_names,
)
- mock_content = WorkingMemoryFactory.create_mock_content(requirement)
- except Exception as exc:
- msg = f"Failed to get type hints for function '{self.function_name}' in pipe '{self.code}': {exc}"
- raise DryRunError(msg) from exc
+ return_type = get_type_hints(function).get("return")
+
+ if return_type is None:
+ msg = f"Function '{self.function_name}' has no return type annotation"
+ raise PipeDefinitionError(msg)
+ if not issubclass(return_type, StuffContent):
+ msg = f"Function '{self.function_name}' return type {return_type} is not a subclass of StuffContent"
+ raise PipeDefinitionError(msg)
+
+ # TODO: Support PipeFunc returning with multiplicity. Create an equivalent of TypedNamedInputRequirement for outputs.
+ requirement = TypedNamedInputRequirement(
+ variable_name="mock_output",
+ concept=ConceptFactory.make(
+ concept_code=self.output.code,
+ domain="generic",
+ description="Lorem Ipsum",
+ structure_class_name=self.output.structure_class_name,
+ ),
+ structure_class=return_type,
+ multiplicity=False,
+ )
+ mock_content = WorkingMemoryFactory.create_mock_content(requirement)
output_stuff = StuffFactory.make_stuff(
name=output_name,
diff --git a/pipelex/pipe_operators/func/pipe_func_blueprint.py b/pipelex/pipe_operators/func/pipe_func_blueprint.py
index 723d9a657..5e7e83fa4 100644
--- a/pipelex/pipe_operators/func/pipe_func_blueprint.py
+++ b/pipelex/pipe_operators/func/pipe_func_blueprint.py
@@ -9,3 +9,5 @@ class PipeFuncBlueprint(PipeBlueprint):
type: Literal["PipeFunc"] = "PipeFunc"
pipe_category: Literal["PipeOperator"] = "PipeOperator"
function_name: str = Field(description="The name of the function to call.")
+
+ # TODO: validate function_name
diff --git a/pipelex/pipe_operators/func/pipe_func_factory.py b/pipelex/pipe_operators/func/pipe_func_factory.py
index 3a848b332..75eb47b3b 100644
--- a/pipelex/pipe_operators/func/pipe_func_factory.py
+++ b/pipelex/pipe_operators/func/pipe_func_factory.py
@@ -27,6 +27,7 @@ class PipeFuncFactory(PipeFactoryProtocol[PipeFuncBlueprint, PipeFunc]):
concept_string_or_code=output_parse_result.concept,
concept_codes_from_the_same_domain=concept_codes_from_the_same_domain,
)
+ # TODO: make function_name into a callable in PipeFunc
return PipeFunc(
domain=domain,
code=pipe_code,
diff --git a/pipelex/pipe_operators/img_gen/pipe_img_gen.py b/pipelex/pipe_operators/img_gen/pipe_img_gen.py
index c32fcd38d..4d2fcfa06 100644
--- a/pipelex/pipe_operators/img_gen/pipe_img_gen.py
+++ b/pipelex/pipe_operators/img_gen/pipe_img_gen.py
@@ -32,7 +32,8 @@ from pipelex.exceptions import (
)
from pipelex.hub import get_concept_library, get_content_generator, get_model_deck, get_native_concept
from pipelex.pipe_operators.pipe_operator import PipeOperator
-from pipelex.pipe_run.pipe_run_params import PipeRunMode, PipeRunParams, output_multiplicity_to_apply
+from pipelex.pipe_run.pipe_run_mode import PipeRunMode
+from pipelex.pipe_run.pipe_run_params import PipeRunParams, output_multiplicity_to_apply
from pipelex.pipe_run.pipe_run_params_factory import PipeRunParamsFactory
from pipelex.pipeline.job_metadata import JobMetadata
from pipelex.types import Self
diff --git a/pipelex/pipe_operators/llm/pipe_llm.py b/pipelex/pipe_operators/llm/pipe_llm.py
index 41f1218de..5c63350a3 100644
--- a/pipelex/pipe_operators/llm/pipe_llm.py
+++ b/pipelex/pipe_operators/llm/pipe_llm.py
@@ -28,7 +28,7 @@ from pipelex.core.stuffs.stuff_content import StuffContent
from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.core.stuffs.text_content import TextContent
from pipelex.exceptions import (
- PipeExecutionError,
+ PipeRunError,
StaticValidationError,
StaticValidationErrorType,
)
@@ -263,7 +263,7 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):
except LLMCompletionError as exc:
location = self._format_error_location(pipe_run_params=pipe_run_params)
msg = f"Error generating text with LLM {location}: {exc}"
- raise PipeExecutionError(msg) from exc
+ raise PipeRunError(msg) from exc
the_content = TextContent(
text=generated_text,
@@ -377,7 +377,7 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):
except LLMCompletionError as exc:
location = self._format_error_location(pipe_run_params=pipe_run_params)
msg = f"Error generating list of objects with text then object {location}: {exc}"
- raise PipeExecutionError(msg) from exc
+ raise PipeRunError(msg) from exc
else:
# We're generating a list of objects directly
method_desc = "object_direct"
@@ -393,7 +393,7 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):
except LLMCompletionError as exc:
location = self._format_error_location(pipe_run_params=pipe_run_params)
msg = f"Error generating list of objects with direct method {location}: {exc}"
- raise PipeExecutionError(msg) from exc
+ raise PipeRunError(msg) from exc
the_content = ListContent(items=generated_objects)
else:
@@ -417,7 +417,7 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):
except LLMCompletionError as exc:
location = self._format_error_location(pipe_run_params=pipe_run_params)
msg = f"Error generating single object with text then object {location}: {exc}"
- raise PipeExecutionError(msg) from exc
+ raise PipeRunError(msg) from exc
else:
# We're generating a single object directly
method_desc = "object_direct"
@@ -432,7 +432,7 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):
except LLMCompletionError as exc:
location = self._format_error_location(pipe_run_params=pipe_run_params)
msg = f"Error generating single object with direct method {location}: {exc}"
- raise PipeExecutionError(msg) from exc
+ raise PipeRunError(msg) from exc
the_content = generated_object
return the_content
diff --git a/pipelex/pipe_operators/pipe_operator.py b/pipelex/pipe_operators/pipe_operator.py
index a49103871..b87dd3cb8 100644
--- a/pipelex/pipe_operators/pipe_operator.py
+++ b/pipelex/pipe_operators/pipe_operator.py
@@ -8,7 +8,8 @@ from pipelex.core.memory.working_memory import WorkingMemory
from pipelex.core.pipes.pipe_abstract import PipeAbstract
from pipelex.core.pipes.pipe_output import PipeOutput
from pipelex.core.stuffs.text_content import TextContent
-from pipelex.pipe_run.pipe_run_params import PipeRunMode, PipeRunParams
+from pipelex.pipe_run.pipe_run_mode import PipeRunMode
+from pipelex.pipe_run.pipe_run_params import PipeRunParams
from pipelex.pipeline.job_metadata import JobMetadata
PipeOperatorOutputType = TypeVar("PipeOperatorOutputType", bound=PipeOutput)
diff --git a/pipelex/pipe_run/pipe_job.py b/pipelex/pipe_run/pipe_job.py
index 0809850d4..7bd33cf65 100644
--- a/pipelex/pipe_run/pipe_job.py
+++ b/pipelex/pipe_run/pipe_job.py
@@ -12,3 +12,7 @@ class PipeJob(BaseModel):
pipe_run_params: PipeRunParams
job_metadata: JobMetadata
output_name: str | None = None
+
+ @property
+ def pipe_type(self) -> str:
+ return self.pipe.__class__.__name__
diff --git a/pipelex/pipe_run/pipe_router_protocol.py b/pipelex/pipe_run/pipe_router_protocol.py
index 52d1c5aea..05bfb6299 100644
--- a/pipelex/pipe_run/pipe_router_protocol.py
+++ b/pipelex/pipe_run/pipe_router_protocol.py
@@ -1,7 +1,8 @@
from typing import Protocol
from pipelex.core.pipes.pipe_output import PipeOutput
-from pipelex.observer.observer_protocol import ObserverProtocol, PayloadType
+from pipelex.exceptions import DryRunMissingInputsError, PipeRouterError, PipeRunError
+from pipelex.observer.observer_protocol import ObserverProtocol, PayloadKey, PayloadType
from pipelex.pipe_run.pipe_job import PipeJob
@@ -13,8 +14,8 @@ class PipeRouterProtocol(Protocol):
pipe_job: PipeJob,
) -> None:
payload: PayloadType = {
- "pipeline_run_id": pipe_job.job_metadata.pipeline_run_id,
- "pipe_job": pipe_job,
+ PayloadKey.PIPELINE_RUN_ID: pipe_job.job_metadata.pipeline_run_id,
+ PayloadKey.PIPE_JOB: pipe_job,
}
await self.observer.observe_before_run(payload)
@@ -24,9 +25,9 @@ class PipeRouterProtocol(Protocol):
pipe_output: PipeOutput,
) -> None:
payload: PayloadType = {
- "pipeline_run_id": pipe_job.job_metadata.pipeline_run_id,
- "pipe_job": pipe_job,
- "pipe_output": pipe_output,
+ PayloadKey.PIPELINE_RUN_ID: pipe_job.job_metadata.pipeline_run_id,
+ PayloadKey.PIPE_JOB: pipe_job,
+ PayloadKey.PIPE_OUTPUT: pipe_output,
}
await self.observer.observe_after_successful_run(payload)
@@ -36,9 +37,9 @@ class PipeRouterProtocol(Protocol):
error: Exception,
) -> None:
payload: PayloadType = {
- "pipeline_run_id": pipe_job.job_metadata.pipeline_run_id,
- "pipe_job": pipe_job,
- "error": error,
+ PayloadKey.PIPELINE_RUN_ID: pipe_job.job_metadata.pipeline_run_id,
+ PayloadKey.PIPE_JOB: pipe_job,
+ PayloadKey.ERROR: error,
}
await self.observer.observe_after_failing_run(payload)
@@ -50,9 +51,25 @@ class PipeRouterProtocol(Protocol):
try:
pipe_output = await self._run_pipe_job(pipe_job)
- except Exception as exc:
+ except DryRunMissingInputsError as exc:
await self._after_failing_run(pipe_job, exc)
- raise
+ raise PipeRouterError(
+ message=exc.message,
+ run_mode=pipe_job.pipe_run_params.run_mode,
+ pipe_code=pipe_job.pipe.code,
+ output_name=pipe_job.output_name,
+ pipe_stack=pipe_job.pipe_run_params.pipe_stack,
+ missing_inputs=exc.missing_inputs,
+ ) from exc
+ except PipeRunError as exc:
+ await self._after_failing_run(pipe_job, exc)
+ raise PipeRouterError(
+ message=exc.message,
+ run_mode=pipe_job.pipe_run_params.run_mode,
+ pipe_code=pipe_job.pipe.code,
+ output_name=pipe_job.output_name,
+ pipe_stack=pipe_job.pipe_run_params.pipe_stack,
+ ) from exc
await self._after_successful_run(pipe_job, pipe_output)
diff --git a/pipelex/pipe_run/pipe_run_mode.py b/pipelex/pipe_run/pipe_run_mode.py
new file mode 100644
index 000000000..5df56666a
--- /dev/null
+++ b/pipelex/pipe_run/pipe_run_mode.py
@@ -0,0 +1,16 @@
+from __future__ import annotations
+
+from pipelex.types import StrEnum
+
+
+class PipeRunMode(StrEnum):
+ LIVE = "live"
+ DRY = "dry"
+
+ @property
+ def is_dry(self) -> bool:
+ match self:
+ case PipeRunMode.DRY:
+ return True
+ case PipeRunMode.LIVE:
+ return False
diff --git a/pipelex/pipe_run/pipe_run_params.py b/pipelex/pipe_run/pipe_run_params.py
index 039339035..3cb8f6972 100644
--- a/pipelex/pipe_run/pipe_run_params.py
+++ b/pipelex/pipe_run/pipe_run_params.py
@@ -8,6 +8,7 @@ from pipelex import log
from pipelex.core.memory.working_memory import BATCH_ITEM_STUFF_NAME, MAIN_STUFF_NAME
from pipelex.core.pipes.variable_multiplicity import VariableMultiplicity, VariableMultiplicityResolution
from pipelex.exceptions import BatchParamsError
+from pipelex.pipe_run.pipe_run_mode import PipeRunMode
from pipelex.types import Self, StrEnum
@@ -16,19 +17,6 @@ class PipeRunParamKey(StrEnum):
NB_OUTPUT = "_nb_output"
-class PipeRunMode(StrEnum):
- LIVE = "live"
- DRY = "dry"
-
- @property
- def is_dry(self) -> bool:
- match self:
- case PipeRunMode.DRY:
- return True
- case PipeRunMode.LIVE:
- return False
-
-
FORCE_DRY_RUN_MODE_ENV_KEY = "PIPELEX_FORCE_DRY_RUN_MODE"
diff --git a/pipelex/pipelex.py b/pipelex/pipelex.py
index a42a24607..978225131 100644
--- a/pipelex/pipelex.py
+++ b/pipelex/pipelex.py
@@ -1,3 +1,4 @@
+import os
from importlib.metadata import metadata
from typing import Any, cast
@@ -47,10 +48,17 @@ from pipelex.pipeline.track.pipeline_tracker_protocol import (
from pipelex.plugins.plugin_manager import PluginManager
from pipelex.reporting.reporting_manager import ReportingManager
from pipelex.reporting.reporting_protocol import ReportingNoOp, ReportingProtocol
+from pipelex.system.configuration.config_loader import config_manager
from pipelex.system.configuration.config_root import ConfigRoot
+from pipelex.system.environment import get_optional_env
from pipelex.system.registries.func_registry import func_registry
-from pipelex.system.runtime import runtime_manager
+from pipelex.system.runtime import IntegrationMode, runtime_manager
+from pipelex.system.telemetry.observer_telemetry import ObserverTelemetry
+from pipelex.system.telemetry.telemetry_config import TELEMETRY_CONFIG_FILE_NAME, TelemetryConfig
+from pipelex.system.telemetry.telemetry_manager import DO_NOT_TRACK_ENV_VAR_KEY, TelemetryManager
+from pipelex.system.telemetry.telemetry_manager_abstract import TelemetryManagerAbstract, TelemetryManagerNoOp
from pipelex.test_extras.registry_test_models import TestRegistryModels
+from pipelex.tools.misc.toml_utils import load_toml_from_path
from pipelex.tools.secrets.env_secrets_provider import EnvSecretsProvider
from pipelex.tools.secrets.secrets_provider_abstract import SecretsProviderAbstract
from pipelex.tools.storage.storage_provider_abstract import StorageProviderAbstract
@@ -105,7 +113,7 @@ class Pipelex(metaclass=MetaSingleton):
self.pipelex_hub.set_library_manager(library_manager=self.library_manager)
self.reporting_delegate: ReportingProtocol | None = None
-
+ self.telemetry_manager: TelemetryManagerAbstract | None = None
# pipeline
self.pipeline_tracker: PipelineTrackerProtocol | None = None
@@ -139,6 +147,7 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
def setup(
self,
+ integration_mode: IntegrationMode,
class_registry: ClassRegistryAbstract | None = None,
secrets_provider: SecretsProviderAbstract | None = None,
storage_provider: StorageProviderAbstract | None = None,
@@ -149,6 +158,9 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
pipeline_tracker: PipelineTracker | None = None,
pipe_router: PipeRouterProtocol | None = None,
reporting_delegate: ReportingProtocol | None = None,
+ force_enable_telemetry: bool = False,
+ telemetry_config: TelemetryConfig | None = None,
+ telemetry_manager: TelemetryManagerAbstract | None = None,
observers: dict[str, ObserverProtocol] | None = None,
**kwargs: Any,
):
@@ -240,7 +252,28 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
log.verbose("Registering test models for unit testing")
self.class_registry.register_classes(TestRegistryModels.get_all_models())
- observers = observers or {"local": LocalObserver()}
+ if integration_mode.allows_telemetry() or force_enable_telemetry:
+ if not telemetry_config:
+ config_path = os.path.join(config_manager.pipelex_config_dir, TELEMETRY_CONFIG_FILE_NAME)
+ telemetry_config_toml = load_toml_from_path(path=config_path)
+ telemetry_config = TelemetryConfig.model_validate(telemetry_config_toml)
+
+ if telemetry_config.respect_dnt and (dnt := get_optional_env(DO_NOT_TRACK_ENV_VAR_KEY)) and dnt.lower() not in ["false", "0"]:
+ self.telemetry_manager = TelemetryManagerNoOp()
+ log.debug(f"Telemetry is disabled by env var 'DO_NOT_TRACK' which is set to {dnt}")
+ else:
+ self.telemetry_manager = telemetry_manager or TelemetryManager(telemetry_config=telemetry_config)
+ else:
+ self.telemetry_manager = TelemetryManagerNoOp()
+ log.debug(f"Telemetry is disabled because the integration mode '{integration_mode}' does not allow it")
+
+ self.telemetry_manager.setup(integration_mode=integration_mode)
+
+ self.pipelex_hub.set_telemetry_manager(telemetry_manager=self.telemetry_manager)
+ if not observers:
+ local_observer = LocalObserver()
+ observer_telemetry = ObserverTelemetry(telemetry_manager=self.telemetry_manager)
+ observers = {"local": local_observer, "telemetry": observer_telemetry}
multi_observer = MultiObserver(observers=observers)
self.pipelex_hub.set_observer(observer=multi_observer)
self.pipelex_hub.set_pipe_router(pipe_router or PipeRouter(observer=multi_observer))
@@ -270,6 +303,8 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
self.pipeline_manager.teardown()
if self.pipeline_tracker:
self.pipeline_tracker.teardown()
+ if self.telemetry_manager:
+ self.telemetry_manager.teardown()
self.library_manager.teardown()
# cogt
@@ -293,6 +328,7 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
@classmethod
def make(
cls,
+ integration_mode: IntegrationMode = IntegrationMode.PYTHON,
class_registry: ClassRegistryAbstract | None = None,
secrets_provider: SecretsProviderAbstract | None = None,
storage_provider: StorageProviderAbstract | None = None,
@@ -303,6 +339,9 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
pipeline_tracker: PipelineTracker | None = None,
pipe_router: PipeRouterProtocol | None = None,
reporting_delegate: ReportingProtocol | None = None,
+ force_enable_telemetry: bool = False,
+ telemetry_config: TelemetryConfig | None = None,
+ telemetry_manager: TelemetryManagerAbstract | None = None,
observers: dict[str, ObserverProtocol] | None = None,
**kwargs: Any,
) -> Self:
@@ -313,6 +352,7 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
management, storage, model routing, and pipeline execution.
Args:
+ integration_mode: Integration mode (CLI, FASTAPI, DOCKER, MCP, N8N, PYTHON, PYTEST)
class_registry: Custom class registry for dynamic loading
secrets_provider: Custom secrets/credentials provider
storage_provider: Custom storage backend
@@ -323,6 +363,9 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
pipeline_tracker: Custom pipeline tracking/logging
pipe_router: Custom pipe routing logic
reporting_delegate: Custom reporting handler
+ force_enable_telemetry: Force enable telemetry even if the integration mode does not allow it
+ telemetry_config: Custom telemetry configuration
+ telemetry_manager: Custom telemetry manager
observers: Custom observers for pipeline events
**kwargs: Additional configuration options, only supported by your own subclass of Pipelex if you really need one
@@ -339,6 +382,7 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
pipelex_instance = cls()
pipelex_instance.setup(
+ integration_mode=integration_mode,
class_registry=class_registry,
secrets_provider=secrets_provider,
storage_provider=storage_provider,
@@ -349,6 +393,9 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.
pipeline_tracker=pipeline_tracker,
pipe_router=pipe_router,
reporting_delegate=reporting_delegate,
+ force_enable_telemetry=force_enable_telemetry,
+ telemetry_config=telemetry_config,
+ telemetry_manager=telemetry_manager,
observers=observers,
**kwargs,
)
diff --git a/pipelex/pipelex.toml b/pipelex/pipelex.toml
index d21a6f86e..c09065e1c 100644
--- a/pipelex/pipelex.toml
+++ b/pipelex/pipelex.toml
@@ -24,7 +24,6 @@ excluded_dirs = [
[pipelex.feature_config]
# WIP/Experimental feature flags
is_pipeline_tracking_enabled = false
-is_activity_tracking_enabled = false
is_reporting_enabled = true
[pipelex.reporting_config]
diff --git a/pipelex/pipeline/execute.py b/pipelex/pipeline/execute.py
index 2e6b86e33..4ca793adf 100644
--- a/pipelex/pipeline/execute.py
+++ b/pipelex/pipeline/execute.py
@@ -1,32 +1,44 @@
+from typing import TYPE_CHECKING
+
from pipelex.client.protocol import PipelineInputs
from pipelex.core.memory.working_memory import WorkingMemory
from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory
from pipelex.core.pipes.pipe_output import PipeOutput
+from pipelex.exceptions import PipeExecutionError, PipelineExecutionError, PipeRouterError
from pipelex.hub import (
+ get_library_manager,
get_pipe_router,
get_pipeline_manager,
get_report_delegate,
get_required_pipe,
+ get_telemetry_manager,
)
from pipelex.pipe_run.pipe_job_factory import PipeJobFactory
+from pipelex.pipe_run.pipe_run_mode import PipeRunMode
from pipelex.pipe_run.pipe_run_params import (
FORCE_DRY_RUN_MODE_ENV_KEY,
- PipeRunMode,
VariableMultiplicity,
)
from pipelex.pipe_run.pipe_run_params_factory import PipeRunParamsFactory
from pipelex.pipeline.job_metadata import JobMetadata
+from pipelex.pipeline.validate_plx import validate_plx
from pipelex.system.environment import get_optional_env
+from pipelex.system.telemetry.events import EventName, EventProperty, Outcome
+
+if TYPE_CHECKING:
+ from pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprint
+ from pipelex.core.pipes.pipe_abstract import PipeAbstract
async def execute_pipeline(
- pipe_code: str,
+ pipe_code: str | None = None,
+ plx_content: str | None = None,
inputs: PipelineInputs | WorkingMemory | None = None,
- search_domains: list[str] | None = None,
output_name: str | None = None,
output_multiplicity: VariableMultiplicity | None = None,
dynamic_output_concept_code: str | None = None,
pipe_run_mode: PipeRunMode | None = None,
+ search_domains: list[str] | None = None,
) -> PipeOutput:
"""Execute a pipeline and wait for its completion.
@@ -37,9 +49,11 @@ async def execute_pipeline(
Parameters
----------
pipe_code:
- The code of the pipe to execute.
+ The code identifying the pipeline to execute.
+ plx_content:
+ Content of the pipeline bundle to execute.
inputs:
- Optional pipeline inputs or working memory to pass to the pipe.
+ Inputs passed to the pipeline.
output_name:
Name of the output slot to write to.
output_multiplicity:
@@ -60,8 +74,30 @@ async def execute_pipeline(
A tuple containing the pipe output and the pipeline run ID.
"""
+ if not plx_content and not pipe_code:
+ msg = "Either pipe_code or plx_content must be provided to the API execute_pipeline."
+ raise ValueError(msg)
+
+ pipe: PipeAbstract | None = None
+ blueprint: PipelexBundleBlueprint | None = None
+
+ if plx_content:
+ blueprint, _ = await validate_plx(plx_content=plx_content, remove_after_validation=False)
+
+ if pipe_code:
+ pipe = get_required_pipe(pipe_code=pipe_code)
+ elif blueprint.main_pipe:
+ pipe = get_required_pipe(pipe_code=blueprint.main_pipe)
+ else:
+ msg = "No pipe code or main pipe in the PLX content provided to the API execute_pipeline."
+ raise PipeExecutionError(message=msg)
+ elif pipe_code:
+ pipe = get_required_pipe(pipe_code=pipe_code)
+ else:
+ msg = "Either provide pipe_code or plx_content to the API execute_pipeline. 'pipe_code' must be provided when 'plx_content' is None"
+ raise PipeExecutionError(message=msg)
+
search_domains = search_domains or []
- pipe = get_required_pipe(pipe_code=pipe_code)
if pipe.domain not in search_domains:
search_domains.insert(0, pipe.domain)
@@ -83,11 +119,10 @@ async def execute_pipeline(
pipe_run_mode = PipeRunMode.LIVE
pipeline = get_pipeline_manager().add_new_pipeline()
- pipeline_run_id = pipeline.pipeline_run_id
- get_report_delegate().open_registry(pipeline_run_id=pipeline_run_id)
+ get_report_delegate().open_registry(pipeline_run_id=pipeline.pipeline_run_id)
job_metadata = JobMetadata(
- pipeline_run_id=pipeline_run_id,
+ pipeline_run_id=pipeline.pipeline_run_id,
)
pipe_run_params = PipeRunParamsFactory.make_run_params(
@@ -104,4 +139,29 @@ async def execute_pipeline(
output_name=output_name,
)
- return await get_pipe_router().run(pipe_job)
+ properties = {
+ EventProperty.PIPELINE_RUN_ID: job_metadata.pipeline_run_id,
+ EventProperty.PIPE_TYPE: pipe.pipe_type,
+ }
+ get_telemetry_manager().track_event(event_name=EventName.PIPELINE_EXECUTE, properties=properties)
+
+ try:
+ pipe_output = await get_pipe_router().run(pipe_job)
+ except PipeRouterError as exc:
+ raise PipelineExecutionError(
+ message=exc.message,
+ run_mode=pipe_job.pipe_run_params.run_mode,
+ pipe_code=pipe_job.pipe.code,
+ output_name=pipe_job.output_name,
+ pipe_stack=pipe_job.pipe_run_params.pipe_stack,
+ ) from exc
+ finally:
+ if plx_content and blueprint is not None:
+ get_library_manager().remove_from_blueprint(blueprint=blueprint)
+ properties = {
+ EventProperty.PIPELINE_RUN_ID: job_metadata.pipeline_run_id,
+ EventProperty.PIPE_TYPE: pipe.pipe_type,
+ EventProperty.PIPELINE_EXECUTE_OUTCOME: Outcome.SUCCESS,
+ }
+ get_telemetry_manager().track_event(event_name=EventName.PIPELINE_COMPLETE, properties=properties)
+ return pipe_output
diff --git a/pipelex/pipeline/start.py b/pipelex/pipeline/start.py
index 18ba885d5..93b0debd2 100644
--- a/pipelex/pipeline/start.py
+++ b/pipelex/pipeline/start.py
@@ -4,9 +4,15 @@ from pipelex.client.protocol import PipelineInputs
from pipelex.core.memory.working_memory import WorkingMemory
from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory
from pipelex.core.pipes.pipe_output import PipeOutput
-from pipelex.hub import get_pipe_router, get_pipeline_manager, get_report_delegate, get_required_pipe
+from pipelex.hub import (
+ get_pipe_router,
+ get_pipeline_manager,
+ get_report_delegate,
+ get_required_pipe,
+)
from pipelex.pipe_run.pipe_job_factory import PipeJobFactory
-from pipelex.pipe_run.pipe_run_params import PipeRunMode, VariableMultiplicity
+from pipelex.pipe_run.pipe_run_mode import PipeRunMode
+from pipelex.pipe_run.pipe_run_params import VariableMultiplicity
from pipelex.pipe_run.pipe_run_params_factory import PipeRunParamsFactory
from pipelex.pipeline.job_metadata import JobMetadata
@@ -18,6 +24,7 @@ async def start_pipeline(
output_multiplicity: VariableMultiplicity | None = None,
dynamic_output_concept_code: str | None = None,
pipe_run_mode: PipeRunMode = PipeRunMode.LIVE,
+ search_domains: list[str] | None = None,
) -> tuple[str, asyncio.Task[PipeOutput]]:
"""Start a pipeline in the background.
@@ -29,7 +36,7 @@ async def start_pipeline(
Parameters
----------
pipe_code:
- The code of the pipe to execute.
+ The code identifying the pipeline to execute.
inputs:
Optional pipeline inputs or working memory to pass to the pipe.
output_name:
@@ -40,6 +47,8 @@ async def start_pipeline(
Override the dynamic output concept code.
pipe_run_mode:
Pipe run mode: ``PipeRunMode.LIVE`` or ``PipeRunMode.DRY``.
+ search_domains:
+ List of domains to search for pipes.
Returns:
-------
@@ -48,21 +57,28 @@ async def start_pipeline(
can be awaited to get the pipe output.
"""
+ pipe = get_required_pipe(pipe_code=pipe_code)
+
+ search_domains = search_domains or []
+ if pipe.domain not in search_domains:
+ search_domains.insert(0, pipe.domain)
+
working_memory: WorkingMemory | None = None
if inputs:
if isinstance(inputs, WorkingMemory):
working_memory = inputs
else:
- working_memory = WorkingMemoryFactory.make_from_pipeline_inputs(pipeline_inputs=inputs)
+ working_memory = WorkingMemoryFactory.make_from_pipeline_inputs(
+ pipeline_inputs=inputs,
+ search_domains=search_domains,
+ )
pipeline = get_pipeline_manager().add_new_pipeline()
- pipeline_run_id = pipeline.pipeline_run_id
- get_report_delegate().open_registry(pipeline_run_id=pipeline_run_id)
- pipe = get_required_pipe(pipe_code=pipe_code)
+ get_report_delegate().open_registry(pipeline_run_id=pipeline.pipeline_run_id)
job_metadata = JobMetadata(
- pipeline_run_id=pipeline_run_id,
+ pipeline_run_id=pipeline.pipeline_run_id,
)
pipe_run_params = PipeRunParamsFactory.make_run_params(
@@ -85,4 +101,4 @@ async def start_pipeline(
# Launch execution without awaiting the result.
task: asyncio.Task[PipeOutput] = asyncio.create_task(get_pipe_router().run(pipe_job))
- return pipeline_run_id, task
+ return pipeline.pipeline_run_id, task
diff --git a/pipelex/pipeline/validate_plx.py b/pipelex/pipeline/validate_plx.py
new file mode 100644
index 000000000..ac1fd45f9
--- /dev/null
+++ b/pipelex/pipeline/validate_plx.py
@@ -0,0 +1,76 @@
+from pydantic import ValidationError
+
+from pipelex import log
+from pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprint
+from pipelex.core.exceptions import PipelexConfigurationError
+from pipelex.core.interpreter import PipelexInterpreter, PLXDecodeError
+from pipelex.core.pipes.pipe_abstract import PipeAbstract
+from pipelex.exceptions import (
+ ConceptLoadingError,
+ DomainLoadingError,
+ DryRunError,
+ PipeLibraryError,
+ PipeLoadingError,
+)
+from pipelex.hub import get_library_manager
+from pipelex.pipe_run.dry_run import dry_run_pipes
+
+
+async def validate_plx(plx_content: str, remove_after_validation: bool = True) -> tuple[PipelexBundleBlueprint, list[PipeAbstract]]:
+ """Validate PLX content.
+
+ This function:
+ 1. Parses PLX content into a bundle blueprint
+ 2. Loads pipes from the blueprint
+ 3. Runs static validation and dry runs all pipes
+
+ Args:
+ plx_content: The PLX content to validate
+ remove_after_validation: Whether to remove the blueprint from the library manager after validation
+
+ Returns:
+ Tuple of (blueprint, pipes): The blueprint and the loaded pipes
+
+ Raises:
+ PipelexConfigurationError: For interpreter configuration errors
+ PLXDecodeError: For PLX parsing/decoding errors
+ ValidationError: For Pydantic validation errors in blueprint
+ DomainLoadingError: For domain loading errors
+ ConceptLoadingError: For concept loading errors
+ PipeLoadingError: For pipe loading errors
+ PipeLibraryError: For pipe library validation errors
+ DryRunError: For dry run validation errors
+ """
+ library_manager = get_library_manager()
+ blueprint: PipelexBundleBlueprint | None = None
+
+ try:
+ converter = PipelexInterpreter(file_content=plx_content)
+ blueprint = converter.make_pipelex_bundle_blueprint()
+
+ pipes = library_manager.load_from_blueprint(blueprint=blueprint)
+
+ for pipe in pipes:
+ pipe.validate_with_libraries()
+ await dry_run_pipes(pipes=[pipe], raise_on_failure=True)
+
+ if remove_after_validation:
+ library_manager.remove_from_blueprint(blueprint=blueprint)
+ return blueprint, pipes
+ except (
+ PipelexConfigurationError,
+ PLXDecodeError,
+ ValidationError,
+ DomainLoadingError,
+ ConceptLoadingError,
+ PipeLoadingError,
+ PipeLibraryError,
+ DryRunError,
+ ):
+ if blueprint is not None:
+ try:
+ library_manager.remove_from_blueprint(blueprint=blueprint)
+ except Exception as cleanup_error:
+ log.error(f"Error during cleanup after validation failure: {cleanup_error}")
+
+ raise
diff --git a/pipelex/system/registries/func_registry.py b/pipelex/system/registries/func_registry.py
index e9abaff1a..ccbf0e14b 100644
--- a/pipelex/system/registries/func_registry.py
+++ b/pipelex/system/registries/func_registry.py
@@ -163,6 +163,7 @@ class FuncRegistry(RootModel[FuncRegistryDict]):
"""
return hasattr(func, PIPE_FUNC_MARKER) and getattr(func, PIPE_FUNC_MARKER) is True
+ # TODO: refactor this into a subclass of FuncRegistry dedicated to pipe funcs, avoid the circular import issue, avoid the code-smell
def is_eligible_function(self, func: Any, require_decorator: bool = False) -> bool:
"""Checks if a function matches the criteria for PipeFunc registration:
- Must be callable
@@ -187,59 +188,54 @@ class FuncRegistry(RootModel[FuncRegistryDict]):
the_function = cast("Callable[..., Any]", func)
- try:
- # Import here to avoid circular imports
- # TODO: code-smell
- from pipelex.core.memory.working_memory import WorkingMemory # noqa: PLC0415
- from pipelex.core.stuffs.stuff_content import StuffContent # noqa: PLC0415
+ # Import here to avoid circular imports
+ # TODO: code-smell
+ from pipelex.core.memory.working_memory import WorkingMemory # noqa: PLC0415
+ from pipelex.core.stuffs.stuff_content import StuffContent # noqa: PLC0415
- # Get function signature
- sig = inspect.signature(the_function)
- params = list(sig.parameters.values())
+ # Get function signature
+ sig = inspect.signature(the_function)
+ params = list(sig.parameters.values())
- # Check parameter count and name
- if len(params) != 1:
- return False
+ # Check parameter count and name
+ if len(params) != 1:
+ return False
- param = params[0]
- if param.name != "working_memory":
- return False
+ param = params[0]
+ if param.name != "working_memory":
+ return False
- # Get type hints
- type_hints = get_type_hints(the_function)
+ # Get type hints
+ type_hints = get_type_hints(the_function)
- # Check parameter type
- if "working_memory" not in type_hints:
- return False
+ # Check parameter type
+ if "working_memory" not in type_hints:
+ return False
- param_type = type_hints["working_memory"]
- if param_type != WorkingMemory:
- return False
+ param_type = type_hints["working_memory"]
+ if param_type != WorkingMemory:
+ return False
- # Check return type
- if "return" not in type_hints:
- return False
+ # Check return type
+ if "return" not in type_hints:
+ return False
- return_type = type_hints["return"]
+ return_type = type_hints["return"]
- # Check if return type is a subclass of StuffContent
- try:
- if inspect.isclass(return_type) and issubclass(return_type, StuffContent):
+ # Check if return type is a subclass of StuffContent
+ try:
+ if inspect.isclass(return_type) and issubclass(return_type, StuffContent):
+ return True
+ # Handle generic types like ListContent[SomeType]
+ if hasattr(return_type, "__origin__"):
+ origin = return_type.__origin__
+ if inspect.isclass(origin) and issubclass(origin, StuffContent):
return True
- # Handle generic types like ListContent[SomeType]
- if hasattr(return_type, "__origin__"):
- origin = return_type.__origin__
- if inspect.isclass(origin) and issubclass(origin, StuffContent):
- return True
- except TypeError:
- # Handle cases where issubclass fails on generic types
- pass
+ except TypeError:
+ # Handle cases where issubclass fails on generic types
+ pass
- return False
-
- except Exception:
- # If we can't analyze the function, skip it
- return False
+ return False
func_registry = FuncRegistry()
diff --git a/pipelex/system/runtime.py b/pipelex/system/runtime.py
index f23613e07..b2b4a1465 100644
--- a/pipelex/system/runtime.py
+++ b/pipelex/system/runtime.py
@@ -6,6 +6,33 @@ from pipelex.types import StrEnum
RUN_MODE_ENV_VAR_KEY = "RUN_MODE"
+class IntegrationMode(StrEnum):
+ CLI = "cli"
+ FASTAPI = "fastapi"
+ DOCKER = "docker"
+ MCP = "mcp"
+ N8N = "n8n"
+ PYTHON = "python"
+ PYTEST = "pytest"
+
+ def allows_telemetry(self) -> bool:
+ match self:
+ case IntegrationMode.CLI:
+ return True
+ case IntegrationMode.FASTAPI:
+ return True
+ case IntegrationMode.DOCKER:
+ return True
+ case IntegrationMode.MCP:
+ return True
+ case IntegrationMode.N8N:
+ return True
+ case IntegrationMode.PYTHON:
+ return False
+ case IntegrationMode.PYTEST:
+ return False
+
+
class RunMode(StrEnum):
NORMAL = "normal"
UNIT_TEST = "unit_test"
diff --git a/tests/unit/pipelex/core/concepts/__init__.py b/pipelex/system/telemetry/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/concepts/__init__.py
rename to pipelex/system/telemetry/__init__.py
diff --git a/pipelex/system/telemetry/events.py b/pipelex/system/telemetry/events.py
new file mode 100644
index 000000000..2f8e7c708
--- /dev/null
+++ b/pipelex/system/telemetry/events.py
@@ -0,0 +1,59 @@
+from pipelex.types import StrEnum
+
+
+class EventName(StrEnum):
+ # Settings
+ TELEMETRY_JUST_ENABLED = "telemetry_just_enabled"
+
+ # Show
+ BACKENDS_SHOW = "backends_show"
+
+ # Pipeline
+ PIPELINE_EXECUTE = "pipeline_execute"
+ PIPELINE_COMPLETE = "pipeline_complete"
+
+ # Pipe
+ PIPES_LIST = "pipes_list"
+ PIPE_SHOW = "pipe_show"
+ PIPE_RUN = "pipe_run"
+ PIPE_COMPLETE = "pipe_complete"
+
+ # Validation
+ BUNDLE_DRY_RUN = "bundle_dry_run"
+ PIPE_DRY_RUN = "pipe_dry_run"
+
+
+class Setting(StrEnum):
+ TELEMETRY_MODE = "telemetry_mode"
+
+
+class EventProperty(StrEnum):
+ # Context
+ INTEGRATION = "integration"
+ PIPELEX_VERSION = "pipelex_version"
+ # Sub-context
+ CLI_COMMAND = "cli_command"
+ SETTING = "setting"
+
+ # Settings
+ TELEMETRY_MODE = "telemetry_mode"
+
+ # Show
+ NB_BACKENDS = "nb_backends"
+
+ # Pipeline
+ PIPELINE_RUN_ID = "pipeline_run_id"
+ PIPELINE_EXECUTE_OUTCOME = "pipeline_execute_outcome"
+
+ # Pipe
+ PIPE_TYPE = "pipe_type"
+ NB_PIPES = "nb_pipes"
+ PIPE_RUN_OUTCOME = "pipe_run_outcome"
+
+ # Bundle
+ NB_CONCEPTS = "nb_concepts"
+
+
+class Outcome(StrEnum):
+ SUCCESS = "success"
+ FAILURE = "failure"
diff --git a/pipelex/system/telemetry/observer_telemetry.py b/pipelex/system/telemetry/observer_telemetry.py
new file mode 100644
index 000000000..b358ec66f
--- /dev/null
+++ b/pipelex/system/telemetry/observer_telemetry.py
@@ -0,0 +1,42 @@
+from typing_extensions import override
+
+from pipelex.observer.observer_protocol import ObserverProtocol, PayloadKey, PayloadType
+from pipelex.system.telemetry.events import EventName, EventProperty, Outcome
+from pipelex.system.telemetry.telemetry_manager_abstract import TelemetryManagerAbstract
+
+
+class ObserverTelemetry(ObserverProtocol):
+ def __init__(self, telemetry_manager: TelemetryManagerAbstract):
+ self.telemetry_manager = telemetry_manager
+
+ @override
+ async def observe_before_run(self, payload: PayloadType) -> None:
+ pipe_job = payload[PayloadKey.PIPE_JOB]
+ properties = {
+ EventProperty.PIPELINE_RUN_ID: payload[PayloadKey.PIPELINE_RUN_ID],
+ EventProperty.PIPE_TYPE: pipe_job.pipe_type,
+ }
+ self.telemetry_manager.track_event(event_name=EventName.PIPE_RUN, properties=properties)
+
+ @override
+ async def observe_after_successful_run(self, payload: PayloadType) -> None:
+ pipe_job = payload[PayloadKey.PIPE_JOB]
+ properties = {
+ EventProperty.PIPELINE_RUN_ID: payload[PayloadKey.PIPELINE_RUN_ID],
+ EventProperty.PIPE_TYPE: pipe_job.pipe_type,
+ EventProperty.PIPE_RUN_OUTCOME: Outcome.SUCCESS,
+ }
+ self.telemetry_manager.track_event(event_name=EventName.PIPE_COMPLETE, properties=properties)
+
+ @override
+ async def observe_after_failing_run(
+ self,
+ payload: PayloadType,
+ ) -> None:
+ pipe_job = payload[PayloadKey.PIPE_JOB]
+ properties = {
+ EventProperty.PIPELINE_RUN_ID: payload[PayloadKey.PIPELINE_RUN_ID],
+ EventProperty.PIPE_TYPE: pipe_job.pipe_type,
+ EventProperty.PIPE_RUN_OUTCOME: Outcome.FAILURE,
+ }
+ self.telemetry_manager.track_event(event_name=EventName.PIPE_COMPLETE, properties=properties)
diff --git a/pipelex/system/telemetry/telemetry_config.py b/pipelex/system/telemetry/telemetry_config.py
new file mode 100644
index 000000000..a607f5308
--- /dev/null
+++ b/pipelex/system/telemetry/telemetry_config.py
@@ -0,0 +1,34 @@
+from pydantic import Field
+
+from pipelex.system.configuration.config_model import ConfigModel
+from pipelex.types import StrEnum
+
+TELEMETRY_CONFIG_FILE_NAME = "telemetry.toml"
+
+
+class TelemetryMode(StrEnum):
+ OFF = "off"
+ ANONYMOUS = "anonymous"
+ IDENTIFIED = "identified"
+
+ @property
+ def is_enabled(self) -> bool:
+ match self:
+ case TelemetryMode.OFF:
+ return False
+ case TelemetryMode.ANONYMOUS:
+ return True
+ case TelemetryMode.IDENTIFIED:
+ return True
+
+
+class TelemetryConfig(ConfigModel):
+ telemetry_mode: TelemetryMode = Field(strict=False)
+ host: str
+ project_api_key: str
+ respect_dnt: bool
+ redact: list[str]
+ geoip_enabled: bool
+ dry_mode_enabled: bool
+ verbose_enabled: bool
+ user_id: str
diff --git a/pipelex/system/telemetry/telemetry_manager.py b/pipelex/system/telemetry/telemetry_manager.py
new file mode 100644
index 000000000..515fb678a
--- /dev/null
+++ b/pipelex/system/telemetry/telemetry_manager.py
@@ -0,0 +1,153 @@
+from importlib.metadata import metadata
+from typing import Any, Callable
+
+import posthog
+from posthog import Posthog, new_context, tag
+from posthog.args import ExceptionArg, OptionalCaptureArgs
+from typing_extensions import Unpack, override
+
+from pipelex.system.exceptions import RootException
+from pipelex.system.runtime import IntegrationMode
+from pipelex.system.telemetry.events import EventName, EventProperty, Setting
+from pipelex.system.telemetry.telemetry_config import TelemetryConfig, TelemetryMode
+from pipelex.system.telemetry.telemetry_manager_abstract import TelemetryManagerAbstract
+from pipelex.tools.log.log import log
+
+DO_NOT_TRACK_ENV_VAR_KEY = "DO_NOT_TRACK"
+PACKAGE_NAME = __name__.split(".", maxsplit=1)[0]
+PACKAGE_VERSION = metadata(PACKAGE_NAME)["Version"]
+
+
+class TelemetryManager(TelemetryManagerAbstract):
+ PRIVACY_NOTICE = "[Privacy: exception message redacted]"
+
+ def __init__(self, telemetry_config: TelemetryConfig):
+ self.telemetry_config = telemetry_config
+
+ # Create PostHog client
+ self.posthog = Posthog(
+ project_api_key=self.telemetry_config.project_api_key,
+ host=self.telemetry_config.host,
+ disable_geoip=not self.telemetry_config.geoip_enabled,
+ debug=self.telemetry_config.verbose_enabled,
+ on_error=self._handle_transmission_error,
+ )
+
+ # Store original capture_exception method
+ self._original_capture_exception: Callable[..., Any] = self.posthog.capture_exception
+
+ # Wrap capture_exception to sanitize before sending
+ self._wrap_capture_exception()
+
+ posthog.privacy_mode = True
+ posthog.default_client = self.posthog
+
+ def _handle_transmission_error(self, error: Exception | None, _items: list[dict[str, Any]]) -> None:
+ """Handle errors that occur during telemetry transmission.
+
+ Args:
+ error: The transmission error that occurred
+ _items: List of telemetry items that failed to send
+ """
+ if error:
+ log.error(f"Telemetry transmission error: {error}")
+
+ def _wrap_capture_exception(self) -> None:
+ """Wrap the PostHog capture_exception method to sanitize exception messages."""
+
+ def sanitized_capture_exception(
+ exception: ExceptionArg | None = None,
+ **kwargs: Unpack[OptionalCaptureArgs],
+ ) -> Any:
+ """Capture exception with message sanitization for RootException subclasses."""
+ if exception and isinstance(exception, RootException):
+ # Create a new exception with sanitized message while preserving the class type
+ # Use __new__ to create an instance without calling __init__, which may require extra args
+ # This creates a "shell" instance with NO custom attributes (e.g., no tested_concept, wanted_concept, etc.)
+ exception_type = type(exception)
+ sanitized_exception = exception_type.__new__(exception_type)
+
+ # Set the exception args to our privacy notice
+ # This is what str(exception) will return
+ sanitized_exception.args = (self.PRIVACY_NOTICE,)
+
+ # Preserve the traceback so we still get stack trace information
+ if hasattr(exception, "__traceback__"):
+ sanitized_exception.__traceback__ = exception.__traceback__
+
+ # Note: No custom attributes (tested_concept, wanted_concept, etc.) are present
+ # because we used __new__() without calling __init__(). The __dict__ is already empty.
+
+ return self._original_capture_exception(sanitized_exception, **kwargs)
+ else:
+ # For non-RootException, capture as-is (or auto-detect current exception)
+ return self._original_capture_exception(exception, **kwargs)
+
+ # Replace the method
+ self.posthog.capture_exception = sanitized_capture_exception # type: ignore[method-assign]
+
+ @override
+ def setup(self, integration_mode: IntegrationMode):
+ if telemetry_mode := TelemetryManagerAbstract.telemetry_was_just_enabled():
+ with new_context():
+ tag(name=EventProperty.INTEGRATION, value=integration_mode)
+ tag(name=EventProperty.PIPELEX_VERSION, value=PACKAGE_VERSION)
+ tag(name=EventProperty.SETTING, value=Setting.TELEMETRY_MODE)
+ self.posthog.capture(
+ EventName.TELEMETRY_JUST_ENABLED,
+ properties={
+ EventProperty.TELEMETRY_MODE: telemetry_mode,
+ EventProperty.PIPELEX_VERSION: PACKAGE_VERSION,
+ },
+ )
+
+ @override
+ def teardown(self):
+ pass
+
+ @override
+ def track_event(self, event_name: EventName, properties: dict[EventProperty, Any] | None = None):
+ # We copy the incoming properties to avoid modifying the original dictionary
+ # and to convert the keys to str
+ # and to remove the properties that are in the redact list
+ tracked_properties: dict[str, Any]
+ if properties:
+ tracked_properties = {key: value for key, value in properties.items() if key not in self.telemetry_config.redact}
+ else:
+ tracked_properties = {}
+ match self.telemetry_config.telemetry_mode:
+ case TelemetryMode.ANONYMOUS:
+ self._track_anonymous_event(event_name=event_name, properties=tracked_properties)
+ case TelemetryMode.IDENTIFIED:
+ if not self.telemetry_config.user_id:
+ log.error(f"Could not track event '{event_name}' as identified because user_id is not set, tracking as anonymous")
+ self._track_anonymous_event(event_name=event_name, properties=tracked_properties)
+ else:
+ self._track_identified_event(event_name=event_name, properties=tracked_properties, user_id=self.telemetry_config.user_id)
+ case TelemetryMode.OFF:
+ log.verbose(f"Telemetry is off, skipping event '{event_name}'")
+
+ def _track_anonymous_event(self, event_name: str, properties: dict[str, Any]):
+ if not self.posthog:
+ return
+ if self.telemetry_config.dry_mode_enabled:
+ if properties:
+ log.debug(properties, title=f"Tracking anonymous event '{event_name}'. Properties")
+ else:
+ log.debug(f"Tracking anonymous event '{event_name}'. No properties.")
+ else:
+ properties["$process_person_profile"] = False
+ self.posthog.capture(event_name, properties=properties)
+ log.verbose(f"Tracked anonymous event '{event_name}' with properties: {properties}")
+
+ def _track_identified_event(self, event_name: str, properties: dict[str, Any], user_id: str):
+ if not self.posthog:
+ return
+ if self.telemetry_config.dry_mode_enabled:
+ if properties:
+ log.debug(properties, title=f"Tracking identified event '{event_name}'. Properties")
+ else:
+ log.debug(f"Tracking identified event '{event_name}'. No properties.")
+ else:
+ self.posthog.capture(event_name, distinct_id=user_id, properties=properties)
+ log.verbose(f"Tracked identified event '{event_name}' with properties: {properties}")
diff --git a/pipelex/system/telemetry/telemetry_manager_abstract.py b/pipelex/system/telemetry/telemetry_manager_abstract.py
new file mode 100644
index 000000000..529294468
--- /dev/null
+++ b/pipelex/system/telemetry/telemetry_manager_abstract.py
@@ -0,0 +1,45 @@
+from abc import ABC, abstractmethod
+from typing import Any
+
+from typing_extensions import override
+
+from pipelex.system.runtime import IntegrationMode
+from pipelex.system.telemetry.events import EventName, EventProperty
+from pipelex.system.telemetry.telemetry_config import TelemetryMode
+
+
+class TelemetryManagerAbstract(ABC):
+ telemetry_mode_just_set: TelemetryMode | None = None
+
+ @classmethod
+ def telemetry_was_just_enabled(cls) -> TelemetryMode | None:
+ if cls.telemetry_mode_just_set is None:
+ return None
+ else:
+ return cls.telemetry_mode_just_set if cls.telemetry_mode_just_set.is_enabled else None
+
+ @abstractmethod
+ def setup(self, integration_mode: IntegrationMode):
+ pass
+
+ @abstractmethod
+ def teardown(self):
+ pass
+
+ @abstractmethod
+ def track_event(self, event_name: EventName, properties: dict[EventProperty, Any] | None = None):
+ pass
+
+
+class TelemetryManagerNoOp(TelemetryManagerAbstract):
+ @override
+ def setup(self, integration_mode: IntegrationMode):
+ pass
+
+ @override
+ def teardown(self):
+ pass
+
+ @override
+ def track_event(self, event_name: EventName, properties: dict[EventProperty, Any] | None = None):
+ pass
diff --git a/pipelex/tools/misc/toml_utils.py b/pipelex/tools/misc/toml_utils.py
index df67e28de..1ef69cd36 100644
--- a/pipelex/tools/misc/toml_utils.py
+++ b/pipelex/tools/misc/toml_utils.py
@@ -3,6 +3,7 @@ from __future__ import annotations
from typing import Any
import tomli
+import tomlkit
from pipelex.system.exceptions import ToolException
from pipelex.tools.misc.file_utils import path_exists
@@ -55,3 +56,29 @@ def load_toml_from_path_if_exists(path: str) -> dict[str, Any] | None:
if not path_exists(path):
return None
return load_toml_from_path(path)
+
+
+def load_toml_with_tomlkit(path: str) -> tomlkit.TOMLDocument:
+ """Load TOML using tomlkit to preserve formatting and comments.
+
+ Args:
+ path: Path to the TOML file
+
+ Returns:
+ TOMLDocument that preserves formatting and comments
+
+ """
+ with open(path, encoding="utf-8") as f:
+ return tomlkit.load(f)
+
+
+def save_toml_to_path(data: dict[str, Any] | tomlkit.TOMLDocument, path: str) -> None:
+ """Save dictionary as TOML to path, preserving formatting and comments.
+
+ Args:
+ data: Dictionary or TOMLDocument to save as TOML
+ path: Path where the TOML file should be saved
+
+ """
+ with open(path, "w", encoding="utf-8") as f:
+ tomlkit.dump(data, f) # type: ignore[arg-type]
diff --git a/pyproject.toml b/pyproject.toml
index c6699d362..e780319da 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,8 +1,8 @@
[project]
name = "pipelex"
-version = "0.13.1"
+version = "0.13.2"
description = "Pipelex is an open-source dev tool based on a simple declarative language that lets you define replicable, structured, composable LLM pipelines."
-authors = [{ name = "Evotis S.A.S.", email = "[email protected]" }]
+authors = [{ name = "Evotis S.A.S.", email = "[email protected]" }]
maintainers = [{ name = "Pipelex staff", email = "[email protected]" }]
license = "MIT"
readme = "README.md"
@@ -31,6 +31,7 @@ dependencies = [
"openai>=1.60.1",
"pillow>=11.2.1",
"polyfactory>=2.21.0",
+ "posthog>=6.7.0",
"pypdfium2>=4.30.0,!=4.30.1",
"pydantic>=2.10.6,<3.0.0",
"python-dotenv>=1.0.1",
diff --git a/tests/conftest.py b/tests/conftest.py
index 0652aa35f..6bdc24aab 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -7,6 +7,7 @@ import pipelex.pipelex
from pipelex import log
from pipelex.config import get_config
from pipelex.hub import get_report_delegate
+from pipelex.system.runtime import IntegrationMode
pytest_plugins = [
"pipelex.test_extras.shared_pytest_plugins",
@@ -20,7 +21,7 @@ def reset_pipelex_config_fixture():
# Code to run before each test
Console().print("[magenta]pipelex setup[/magenta]")
try:
- pipelex_instance = pipelex.pipelex.Pipelex.make()
+ pipelex_instance = pipelex.pipelex.Pipelex.make(integration_mode=IntegrationMode.PYTEST)
config = get_config()
log.verbose(config, title="Test config")
assert isinstance(config, pipelex.config.PipelexConfig)
diff --git a/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_simple.py b/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_simple.py
index e24ba958e..adada5154 100644
--- a/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_simple.py
+++ b/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_simple.py
@@ -8,7 +8,7 @@ from pipelex.core.concepts.concept_native import NativeConceptCode
from pipelex.core.domains.domain import SpecialDomain
from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory
from pipelex.core.pipes.input_requirements import TypedNamedInputRequirement
-from pipelex.exceptions import DryRunError
+from pipelex.exceptions import DryRunMissingInputsError
from pipelex.pipe_controllers.condition.pipe_condition_blueprint import PipeConditionBlueprint
from pipelex.pipe_controllers.condition.pipe_condition_factory import PipeConditionFactory
from pipelex.pipe_run.pipe_run_params import PipeRunMode
@@ -42,7 +42,7 @@ class TestPipeConditionSimple:
# Test with empty working memory - should FAIL
empty_working_memory = WorkingMemoryFactory.make_empty()
- with pytest.raises(DryRunError) as exc_info:
+ with pytest.raises(DryRunMissingInputsError) as exc_info:
await pipe_condition.run_pipe(
job_metadata=JobMetadata(job_name="test_direct_condition_fail"),
working_memory=empty_working_memory,
@@ -102,7 +102,7 @@ class TestPipeConditionSimple:
print("✅ Direct PipeCondition SUCCEEDED completely!")
pretty_print(pipe_output)
- except DryRunError as exc:
+ except DryRunMissingInputsError as exc:
msg_exc = str(exc)
# If it fails, it should NOT be due to missing inputs
assert "missing required inputs" not in str(msg_exc)
diff --git a/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_with_input_memory.py b/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_with_input_memory.py
index a08b69b06..2ddc2c22c 100644
--- a/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_with_input_memory.py
+++ b/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_with_input_memory.py
@@ -90,8 +90,8 @@ class TestPipeSequenceWithInputMemory:
"""Test pipe sequence functionality with input memory."""
async def test_optimize_tweet_sequence_with_input_memory(self):
- """Test the optimize_tweet_sequence pipeline using input_memory parameter."""
- # Execute the pipeline using input_memory
+ """Test the optimize_tweet_sequence pipeline using inputs parameter."""
+ # Execute the pipeline using inputs
pipe_output = await execute_pipeline(
pipe_code="optimize_tweet_sequence",
inputs={
diff --git a/tests/integration/pipelex/client/test_client.py b/tests/integration/pipelex/client/test_client.py
index 7000f63e6..77f3a6807 100644
--- a/tests/integration/pipelex/client/test_client.py
+++ b/tests/integration/pipelex/client/test_client.py
@@ -106,7 +106,7 @@ class TestPipelexApiClient:
client = PipelexClient()
pipeline_reponse = await client.execute_pipeline(
pipe_code=example.pipe_code,
- working_memory=memory,
+ inputs=memory,
)
pretty_print(pipeline_reponse, title="PIPELINE RESPONSE")
diff --git a/tests/integration/pipelex/language/test_plx_factory.py b/tests/integration/pipelex/language/test_plx_factory.py
index 8930a5473..109069b18 100644
--- a/tests/integration/pipelex/language/test_plx_factory.py
+++ b/tests/integration/pipelex/language/test_plx_factory.py
@@ -3,7 +3,7 @@ import pytest
from pipelex import pretty_print
from pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprint
from pipelex.language.plx_factory import PlxFactory
-from tests.unit.pipelex.core.test_data import InterpreterTestCases
+from tests.unit.core.test_data import InterpreterTestCases
class TestPlxFactoryIntegration:
diff --git a/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_complex.py b/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_complex.py
index 584d5697c..d400470dc 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_complex.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_complex.py
@@ -10,7 +10,7 @@ from pipelex.core.concepts.concept_factory import ConceptFactory
from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory
from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.core.stuffs.text_content import TextContent
-from pipelex.exceptions import DryRunError
+from pipelex.exceptions import PipeRouterError
from pipelex.hub import get_pipe_router, get_required_pipe
from pipelex.pipe_run.pipe_job_factory import PipeJobFactory
from pipelex.pipe_run.pipe_run_params import PipeRunMode
@@ -264,7 +264,7 @@ class TestPipeConditionComplex:
assert pipe_output.working_memory is not None
async def test_complex_pipeline_dry_run_missing_inputs(self, request: FixtureRequest):
- """Test complex pipeline dry run with missing inputs - should fail."""
+ """Test complex pipeline dry run with missing inputs - should fail with PipeRouterError."""
doc_request = DocumentRequest(document_type="technical", priority="urgent", language="english", complexity="high")
doc_stuff = StuffFactory.make_stuff(
@@ -280,7 +280,7 @@ class TestPipeConditionComplex:
working_memory = WorkingMemoryFactory.make_from_single_stuff(doc_stuff)
- with pytest.raises(DryRunError) as exc_info:
+ with pytest.raises(PipeRouterError) as exc_info:
await get_pipe_router().run(
pipe_job=PipeJobFactory.make_pipe_job(
pipe=get_required_pipe(pipe_code="complex_document_processor"),
@@ -292,6 +292,7 @@ class TestPipeConditionComplex:
error = exc_info.value
assert error.pipe_code == "complex_document_processor"
+ assert error.missing_inputs is not None
assert "user_profile" in error.missing_inputs
assert "missing required inputs" in str(error)
diff --git a/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_simple.py b/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_simple.py
index 307118e67..d3a5180a2 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_simple.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_simple.py
@@ -12,7 +12,7 @@ from pipelex.core.domains.domain import SpecialDomain
from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory
from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.core.stuffs.text_content import TextContent
-from pipelex.exceptions import DryRunError
+from pipelex.exceptions import PipeRouterError
from pipelex.hub import get_pipe_router, get_required_pipe
from pipelex.pipe_controllers.condition.pipe_condition_blueprint import PipeConditionBlueprint
from pipelex.pipe_controllers.condition.pipe_condition_factory import PipeConditionFactory
@@ -214,12 +214,12 @@ class TestPipeConditionSimple:
assert original_input.content.category == "small"
async def test_condition_dry_run_missing_inputs_failure(self, request: FixtureRequest):
- """Test PipeCondition dry run with missing inputs using real pipe - should fail with DryRunError."""
+ """Test PipeCondition dry run with missing inputs using real pipe - should fail with PipeRouterError."""
# Create empty working memory - missing required input
empty_working_memory = WorkingMemoryFactory.make_empty()
- # Run dry run using the real pipe - this should fail with DryRunError
- with pytest.raises(DryRunError) as exc_info:
+ # Run dry run using the real pipe - this should fail with PipeRouterError
+ with pytest.raises(PipeRouterError) as exc_info:
await get_pipe_router().run(
pipe_job=PipeJobFactory.make_pipe_job(
pipe=get_required_pipe(pipe_code="basic_condition_by_category_2"),
@@ -232,6 +232,7 @@ class TestPipeConditionSimple:
# Verify the error details
error = exc_info.value
assert error.pipe_code == "basic_condition_by_category_2"
+ assert error.missing_inputs is not None
assert "input_data" in error.missing_inputs
assert "missing required inputs" in str(error)
assert "input_data" in str(error)
diff --git a/tests/integration/pipelex/pipes/test_bracket_notation_operators.py b/tests/integration/pipelex/pipes/test_bracket_notation_operators.py
index 29616378e..de667649b 100644
--- a/tests/integration/pipelex/pipes/test_bracket_notation_operators.py
+++ b/tests/integration/pipelex/pipes/test_bracket_notation_operators.py
@@ -1,6 +1,9 @@
"""Integration tests for bracket notation in operator pipe factories."""
from pipelex.core.concepts.concept_native import NativeConceptCode
+from pipelex.core.memory.working_memory import WorkingMemory
+from pipelex.core.stuffs.list_content import ListContent
+from pipelex.core.stuffs.text_content import TextContent
from pipelex.pipe_operators.compose.pipe_compose_blueprint import PipeComposeBlueprint
from pipelex.pipe_operators.compose.pipe_compose_factory import PipeComposeFactory
from pipelex.pipe_operators.extract.pipe_extract_blueprint import PipeExtractBlueprint
@@ -11,6 +14,18 @@ from pipelex.pipe_operators.img_gen.pipe_img_gen_blueprint import PipeImgGenBlue
from pipelex.pipe_operators.img_gen.pipe_img_gen_factory import PipeImgGenFactory
from pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprint
from pipelex.pipe_operators.llm.pipe_llm_factory import PipeLLMFactory
+from pipelex.system.registries.func_registry import pipe_func
+
+
+# Test function for PipeFunc bracket notation test
+@pipe_func(name="process_function")
+async def process_function(working_memory: WorkingMemory) -> ListContent[TextContent]:
+ """Test function that processes items and returns a list."""
+ items = working_memory.get_stuff_as_list(name="two_texts", item_type=TextContent).items
+ # Process items and return as list
+ # result_items = [TextContent(text=f"processed: {item.text}") for item in items.content.items]
+ processed_items = [TextContent(text=f"processed: {item.text}") for item in items]
+ return ListContent(items=processed_items)
class TestBracketNotationInOperators:
@@ -93,7 +108,7 @@ class TestBracketNotationInOperators:
"""Test PipeFunc factory with bracket notation."""
blueprint = PipeFuncBlueprint(
description="Process items",
- inputs={"items": f"{NativeConceptCode.TEXT}[2]"},
+ inputs={"two_texts": f"{NativeConceptCode.TEXT}[2]"},
output=f"{NativeConceptCode.TEXT}[]",
function_name="process_function",
)
@@ -104,7 +119,7 @@ class TestBracketNotationInOperators:
blueprint=blueprint,
)
- assert pipe.inputs.root["items"].multiplicity == 2
+ assert pipe.inputs.root["two_texts"].multiplicity == 2
assert pipe.output.code == "Text"
def test_pipe_compose_with_bracket_notation(self):
diff --git a/tests/integration/pipelex/test_data.py b/tests/integration/pipelex/test_data.py
index b1189ed1e..b3738ca6b 100644
--- a/tests/integration/pipelex/test_data.py
+++ b/tests/integration/pipelex/test_data.py
@@ -10,7 +10,7 @@ from pipelex.core.stuffs.structured_content import StructuredContent
from pipelex.core.stuffs.stuff import Stuff
from pipelex.core.stuffs.stuff_factory import StuffBlueprint, StuffFactory
from pipelex.core.stuffs.text_content import TextContent
-from pipelex.exceptions import PipeStackOverflowError
+from pipelex.exceptions import PipeRouterError
from tests.cases import ImageTestCases, PDFTestCases
@@ -155,7 +155,7 @@ class PipeTestCases:
FAILURE_PIPES: ClassVar[list[tuple[str, type[Exception], str]]] = [
(
"infinite_loop_1",
- PipeStackOverflowError,
+ PipeRouterError,
"Exceeded pipe stack limit",
),
]
diff --git a/tests/unit/pipelex/builder/concept/test_concept_blueprint.py b/tests/unit/builder/concept/test_concept_blueprint.py
similarity index 92%
rename from tests/unit/pipelex/builder/concept/test_concept_blueprint.py
rename to tests/unit/builder/concept/test_concept_blueprint.py
index 4f3323bbd..3d5b6b7b2 100644
--- a/tests/unit/pipelex/builder/concept/test_concept_blueprint.py
+++ b/tests/unit/builder/concept/test_concept_blueprint.py
@@ -3,7 +3,7 @@ import pytest
from pipelex import log
from pipelex.builder.concept.concept_spec import ConceptSpec
from pipelex.core.concepts.concept_blueprint import ConceptBlueprint
-from tests.unit.pipelex.builder.concept.test_data import ConceptBlueprintTestCases, ConceptCodeValidationTestCases
+from tests.unit.builder.concept.test_data import ConceptBlueprintTestCases, ConceptCodeValidationTestCases
class TestConceptBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/concept/test_data.py b/tests/unit/builder/concept/test_data.py
similarity index 100%
rename from tests/unit/pipelex/builder/concept/test_data.py
rename to tests/unit/builder/concept/test_data.py
diff --git a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_batch/test_data.py b/tests/unit/builder/pipe/pipe_controller/pipe_batch/test_data.py
similarity index 100%
rename from tests/unit/pipelex/builder/pipe/pipe_controller/pipe_batch/test_data.py
rename to tests/unit/builder/pipe/pipe_controller/pipe_batch/test_data.py
diff --git a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_batch/test_pipe_batch.py b/tests/unit/builder/pipe/pipe_controller/pipe_batch/test_pipe_batch.py
similarity index 85%
rename from tests/unit/pipelex/builder/pipe/pipe_controller/pipe_batch/test_pipe_batch.py
rename to tests/unit/builder/pipe/pipe_controller/pipe_batch/test_pipe_batch.py
index 804a78db4..d39d2848a 100644
--- a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_batch/test_pipe_batch.py
+++ b/tests/unit/builder/pipe/pipe_controller/pipe_batch/test_pipe_batch.py
@@ -2,7 +2,7 @@ import pytest
from pipelex.builder.pipe.pipe_batch_spec import PipeBatchSpec
from pipelex.pipe_controllers.batch.pipe_batch_blueprint import PipeBatchBlueprint
-from tests.unit.pipelex.builder.pipe.pipe_controller.pipe_batch.test_data import PipeBatchTestCases
+from tests.unit.builder.pipe.pipe_controller.pipe_batch.test_data import PipeBatchTestCases
class TestPipeBatchBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_condition/test_data.py b/tests/unit/builder/pipe/pipe_controller/pipe_condition/test_data.py
similarity index 100%
rename from tests/unit/pipelex/builder/pipe/pipe_controller/pipe_condition/test_data.py
rename to tests/unit/builder/pipe/pipe_controller/pipe_condition/test_data.py
diff --git a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_condition/test_pipe_condition.py b/tests/unit/builder/pipe/pipe_controller/pipe_condition/test_pipe_condition.py
similarity index 85%
rename from tests/unit/pipelex/builder/pipe/pipe_controller/pipe_condition/test_pipe_condition.py
rename to tests/unit/builder/pipe/pipe_controller/pipe_condition/test_pipe_condition.py
index 4fece994d..ae5ffea8c 100644
--- a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_condition/test_pipe_condition.py
+++ b/tests/unit/builder/pipe/pipe_controller/pipe_condition/test_pipe_condition.py
@@ -2,7 +2,7 @@ import pytest
from pipelex.builder.pipe.pipe_condition_spec import PipeConditionSpec
from pipelex.pipe_controllers.condition.pipe_condition_blueprint import PipeConditionBlueprint
-from tests.unit.pipelex.builder.pipe.pipe_controller.pipe_condition.test_data import PipeConditionTestCases
+from tests.unit.builder.pipe.pipe_controller.pipe_condition.test_data import PipeConditionTestCases
class TestPipeConditionBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_parallel/test_data.py b/tests/unit/builder/pipe/pipe_controller/pipe_parallel/test_data.py
similarity index 100%
rename from tests/unit/pipelex/builder/pipe/pipe_controller/pipe_parallel/test_data.py
rename to tests/unit/builder/pipe/pipe_controller/pipe_parallel/test_data.py
diff --git a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_parallel/test_pipe_parallel.py b/tests/unit/builder/pipe/pipe_controller/pipe_parallel/test_pipe_parallel.py
similarity index 87%
rename from tests/unit/pipelex/builder/pipe/pipe_controller/pipe_parallel/test_pipe_parallel.py
rename to tests/unit/builder/pipe/pipe_controller/pipe_parallel/test_pipe_parallel.py
index 23750cb39..c92be6cd4 100644
--- a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_parallel/test_pipe_parallel.py
+++ b/tests/unit/builder/pipe/pipe_controller/pipe_parallel/test_pipe_parallel.py
@@ -3,7 +3,7 @@ import pytest
from pipelex import log
from pipelex.builder.pipe.pipe_parallel_spec import PipeParallelSpec
from pipelex.pipe_controllers.parallel.pipe_parallel_blueprint import PipeParallelBlueprint
-from tests.unit.pipelex.builder.pipe.pipe_controller.pipe_parallel.test_data import PipeParallelTestCases
+from tests.unit.builder.pipe.pipe_controller.pipe_parallel.test_data import PipeParallelTestCases
class TestPipeParallelBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_sequence/test_data.py b/tests/unit/builder/pipe/pipe_controller/pipe_sequence/test_data.py
similarity index 100%
rename from tests/unit/pipelex/builder/pipe/pipe_controller/pipe_sequence/test_data.py
rename to tests/unit/builder/pipe/pipe_controller/pipe_sequence/test_data.py
diff --git a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_sequence/test_pipe_sequence.py b/tests/unit/builder/pipe/pipe_controller/pipe_sequence/test_pipe_sequence.py
similarity index 85%
rename from tests/unit/pipelex/builder/pipe/pipe_controller/pipe_sequence/test_pipe_sequence.py
rename to tests/unit/builder/pipe/pipe_controller/pipe_sequence/test_pipe_sequence.py
index 6cd1fee7e..83adea8fe 100644
--- a/tests/unit/pipelex/builder/pipe/pipe_controller/pipe_sequence/test_pipe_sequence.py
+++ b/tests/unit/builder/pipe/pipe_controller/pipe_sequence/test_pipe_sequence.py
@@ -2,7 +2,7 @@ import pytest
from pipelex.builder.pipe.pipe_sequence_spec import PipeSequenceSpec
from pipelex.pipe_controllers.sequence.pipe_sequence_blueprint import PipeSequenceBlueprint
-from tests.unit.pipelex.builder.pipe.pipe_controller.pipe_sequence.test_data import PipeSequenceTestCases
+from tests.unit.builder.pipe.pipe_controller.pipe_sequence.test_data import PipeSequenceTestCases
class TestPipeSequenceBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_compose/test_data.py b/tests/unit/builder/pipe/pipe_operator/pipe_compose/test_data.py
similarity index 100%
rename from tests/unit/pipelex/builder/pipe/pipe_operator/pipe_compose/test_data.py
rename to tests/unit/builder/pipe/pipe_operator/pipe_compose/test_data.py
diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_compose/test_pipe_compose.py b/tests/unit/builder/pipe/pipe_operator/pipe_compose/test_pipe_compose.py
similarity index 85%
rename from tests/unit/pipelex/builder/pipe/pipe_operator/pipe_compose/test_pipe_compose.py
rename to tests/unit/builder/pipe/pipe_operator/pipe_compose/test_pipe_compose.py
index 8af557694..f868e7bdc 100644
--- a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_compose/test_pipe_compose.py
+++ b/tests/unit/builder/pipe/pipe_operator/pipe_compose/test_pipe_compose.py
@@ -2,7 +2,7 @@ import pytest
from pipelex.builder.pipe.pipe_compose_spec import PipeComposeSpec
from pipelex.pipe_operators.compose.pipe_compose_blueprint import PipeComposeBlueprint
-from tests.unit.pipelex.builder.pipe.pipe_operator.pipe_compose.test_data import PipeComposeTestCases
+from tests.unit.builder.pipe.pipe_operator.pipe_compose.test_data import PipeComposeTestCases
class TestPipeComposeBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_extract/test_data.py b/tests/unit/builder/pipe/pipe_operator/pipe_extract/test_data.py
similarity index 100%
rename from tests/unit/pipelex/builder/pipe/pipe_operator/pipe_extract/test_data.py
rename to tests/unit/builder/pipe/pipe_operator/pipe_extract/test_data.py
diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_extract/test_pipe_extract.py b/tests/unit/builder/pipe/pipe_operator/pipe_extract/test_pipe_extract.py
similarity index 86%
rename from tests/unit/pipelex/builder/pipe/pipe_operator/pipe_extract/test_pipe_extract.py
rename to tests/unit/builder/pipe/pipe_operator/pipe_extract/test_pipe_extract.py
index 3b7b96198..f59c58043 100644
--- a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_extract/test_pipe_extract.py
+++ b/tests/unit/builder/pipe/pipe_operator/pipe_extract/test_pipe_extract.py
@@ -3,7 +3,7 @@ import pytest
from pipelex import log
from pipelex.builder.pipe.pipe_extract_spec import PipeExtractSpec
from pipelex.pipe_operators.extract.pipe_extract_blueprint import PipeExtractBlueprint
-from tests.unit.pipelex.builder.pipe.pipe_operator.pipe_extract.test_data import PipeExtractTestCases
+from tests.unit.builder.pipe.pipe_operator.pipe_extract.test_data import PipeExtractTestCases
class TestPipeExtractBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_func/test_data.py b/tests/unit/builder/pipe/pipe_operator/pipe_func/test_data.py
similarity index 100%
rename from tests/unit/pipelex/builder/pipe/pipe_operator/pipe_func/test_data.py
rename to tests/unit/builder/pipe/pipe_operator/pipe_func/test_data.py
diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_func/test_pipe_func.py b/tests/unit/builder/pipe/pipe_operator/pipe_func/test_pipe_func.py
similarity index 86%
rename from tests/unit/pipelex/builder/pipe/pipe_operator/pipe_func/test_pipe_func.py
rename to tests/unit/builder/pipe/pipe_operator/pipe_func/test_pipe_func.py
index 59496b93f..b4315ef1d 100644
--- a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_func/test_pipe_func.py
+++ b/tests/unit/builder/pipe/pipe_operator/pipe_func/test_pipe_func.py
@@ -2,7 +2,7 @@ import pytest
from pipelex.builder.pipe.pipe_func_spec import PipeFuncSpec
from pipelex.pipe_operators.func.pipe_func_blueprint import PipeFuncBlueprint
-from tests.unit.pipelex.builder.pipe.pipe_operator.pipe_func.test_data import PipeFuncTestCases
+from tests.unit.builder.pipe.pipe_operator.pipe_func.test_data import PipeFuncTestCases
class TestPipeFuncBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_img_gen/test_data.py b/tests/unit/builder/pipe/pipe_operator/pipe_img_gen/test_data.py
similarity index 100%
rename from tests/unit/pipelex/builder/pipe/pipe_operator/pipe_img_gen/test_data.py
rename to tests/unit/builder/pipe/pipe_operator/pipe_img_gen/test_data.py
diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_img_gen/test_pipe_img_gen.py b/tests/unit/builder/pipe/pipe_operator/pipe_img_gen/test_pipe_img_gen.py
similarity index 85%
rename from tests/unit/pipelex/builder/pipe/pipe_operator/pipe_img_gen/test_pipe_img_gen.py
rename to tests/unit/builder/pipe/pipe_operator/pipe_img_gen/test_pipe_img_gen.py
index e29dbf9d2..934d93915 100644
--- a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_img_gen/test_pipe_img_gen.py
+++ b/tests/unit/builder/pipe/pipe_operator/pipe_img_gen/test_pipe_img_gen.py
@@ -2,7 +2,7 @@ import pytest
from pipelex.builder.pipe.pipe_img_gen_spec import PipeImgGenSpec
from pipelex.pipe_operators.img_gen.pipe_img_gen_blueprint import PipeImgGenBlueprint
-from tests.unit.pipelex.builder.pipe.pipe_operator.pipe_img_gen.test_data import PipeImgGenTestCases
+from tests.unit.builder.pipe.pipe_operator.pipe_img_gen.test_data import PipeImgGenTestCases
class TestPipeImgGenBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_llm/test_data.py b/tests/unit/builder/pipe/pipe_operator/pipe_llm/test_data.py
similarity index 100%
rename from tests/unit/pipelex/builder/pipe/pipe_operator/pipe_llm/test_data.py
rename to tests/unit/builder/pipe/pipe_operator/pipe_llm/test_data.py
diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_llm/test_pipe_llm.py b/tests/unit/builder/pipe/pipe_operator/pipe_llm/test_pipe_llm.py
similarity index 90%
rename from tests/unit/pipelex/builder/pipe/pipe_operator/pipe_llm/test_pipe_llm.py
rename to tests/unit/builder/pipe/pipe_operator/pipe_llm/test_pipe_llm.py
index 4f7b9b9e0..c240fd1af 100644
--- a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_llm/test_pipe_llm.py
+++ b/tests/unit/builder/pipe/pipe_operator/pipe_llm/test_pipe_llm.py
@@ -4,7 +4,7 @@ from pipelex import pretty_print
from pipelex.builder.pipe.pipe_llm_spec import PipeLLMSpec
from pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprint
from pipelex.pipe_operators.llm.pipe_llm_factory import PipeLLMFactory
-from tests.unit.pipelex.builder.pipe.pipe_operator.pipe_llm.test_data import PipeLLMTestCases
+from tests.unit.builder.pipe.pipe_operator.pipe_llm.test_data import PipeLLMTestCases
class TestPipeLLMBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/pipe/test_data_inputs.py b/tests/unit/builder/pipe/test_data_inputs.py
similarity index 100%
rename from tests/unit/pipelex/builder/pipe/test_data_inputs.py
rename to tests/unit/builder/pipe/test_data_inputs.py
diff --git a/tests/unit/pipelex/builder/pipe/test_data_pipe.py b/tests/unit/builder/pipe/test_data_pipe.py
similarity index 100%
rename from tests/unit/pipelex/builder/pipe/test_data_pipe.py
rename to tests/unit/builder/pipe/test_data_pipe.py
diff --git a/tests/unit/pipelex/builder/pipe/test_data_sub_pipe.py b/tests/unit/builder/pipe/test_data_sub_pipe.py
similarity index 100%
rename from tests/unit/pipelex/builder/pipe/test_data_sub_pipe.py
rename to tests/unit/builder/pipe/test_data_sub_pipe.py
diff --git a/tests/unit/pipelex/builder/pipe/test_inputs_blueprint.py b/tests/unit/builder/pipe/test_inputs_blueprint.py
similarity index 84%
rename from tests/unit/pipelex/builder/pipe/test_inputs_blueprint.py
rename to tests/unit/builder/pipe/test_inputs_blueprint.py
index 57fcba7a7..c8dd48f7d 100644
--- a/tests/unit/pipelex/builder/pipe/test_inputs_blueprint.py
+++ b/tests/unit/builder/pipe/test_inputs_blueprint.py
@@ -1,6 +1,6 @@
import pytest
-from tests.unit.pipelex.builder.pipe.test_data_inputs import InputRequirementTestCases
+from tests.unit.builder.pipe.test_data_inputs import InputRequirementTestCases
class TestInputRequirementBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/pipe/test_pipe_blueprint.py b/tests/unit/builder/pipe/test_pipe_blueprint.py
similarity index 87%
rename from tests/unit/pipelex/builder/pipe/test_pipe_blueprint.py
rename to tests/unit/builder/pipe/test_pipe_blueprint.py
index d1f1ccf6c..0b90f17fc 100644
--- a/tests/unit/pipelex/builder/pipe/test_pipe_blueprint.py
+++ b/tests/unit/builder/pipe/test_pipe_blueprint.py
@@ -2,7 +2,7 @@ import pytest
from pipelex.builder.pipe.pipe_spec import PipeSpec
from pipelex.core.pipes.pipe_blueprint import PipeBlueprint
-from tests.unit.pipelex.builder.pipe.test_data_pipe import PipeBlueprintTestCases
+from tests.unit.builder.pipe.test_data_pipe import PipeBlueprintTestCases
class TestPipeBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/pipe/test_sub_pipe_blueprint.py b/tests/unit/builder/pipe/test_sub_pipe_blueprint.py
similarity index 87%
rename from tests/unit/pipelex/builder/pipe/test_sub_pipe_blueprint.py
rename to tests/unit/builder/pipe/test_sub_pipe_blueprint.py
index 5b21da5fb..ab8912edd 100644
--- a/tests/unit/pipelex/builder/pipe/test_sub_pipe_blueprint.py
+++ b/tests/unit/builder/pipe/test_sub_pipe_blueprint.py
@@ -2,7 +2,7 @@ import pytest
from pipelex.builder.pipe.sub_pipe_spec import SubPipeSpec
from pipelex.pipe_controllers.sub_pipe_blueprint import SubPipeBlueprint
-from tests.unit.pipelex.builder.pipe.test_data_sub_pipe import SubPipeTestCases
+from tests.unit.builder.pipe.test_data_sub_pipe import SubPipeTestCases
class TestSubPipeBlueprintConversion:
diff --git a/tests/unit/pipelex/builder/test_pipelex_bundle_blueprint.py b/tests/unit/builder/test_pipelex_bundle_blueprint.py
similarity index 100%
rename from tests/unit/pipelex/builder/test_pipelex_bundle_blueprint.py
rename to tests/unit/builder/test_pipelex_bundle_blueprint.py
diff --git a/tests/unit/pipelex/builder/test_runner_generator.py b/tests/unit/builder/test_runner_generator.py
similarity index 100%
rename from tests/unit/pipelex/builder/test_runner_generator.py
rename to tests/unit/builder/test_runner_generator.py
diff --git a/tests/unit/pipelex/cli/commands/test_init_cmd.py b/tests/unit/cli/commands/test_init_cmd.py
similarity index 100%
rename from tests/unit/pipelex/cli/commands/test_init_cmd.py
rename to tests/unit/cli/commands/test_init_cmd.py
diff --git a/tests/unit/pipelex/client/test_api_serialization.py b/tests/unit/client/test_api_serialization.py
similarity index 100%
rename from tests/unit/pipelex/client/test_api_serialization.py
rename to tests/unit/client/test_api_serialization.py
diff --git a/tests/unit/pipelex/cogt/models/test_model_deck.py b/tests/unit/cogt/models/test_model_deck.py
similarity index 100%
rename from tests/unit/pipelex/cogt/models/test_model_deck.py
rename to tests/unit/cogt/models/test_model_deck.py
diff --git a/tests/unit/pipelex/cogt/templating/test_template_preprocessor.py b/tests/unit/cogt/templating/test_template_preprocessor.py
similarity index 100%
rename from tests/unit/pipelex/cogt/templating/test_template_preprocessor.py
rename to tests/unit/cogt/templating/test_template_preprocessor.py
diff --git a/tests/unit/pipelex/cogt/usage/test_cost_registry.py b/tests/unit/cogt/usage/test_cost_registry.py
similarity index 100%
rename from tests/unit/pipelex/cogt/usage/test_cost_registry.py
rename to tests/unit/cogt/usage/test_cost_registry.py
diff --git a/tests/unit/pipelex/core/bundles/test_data_pipe_sorter.py b/tests/unit/core/bundles/test_data_pipe_sorter.py
similarity index 100%
rename from tests/unit/pipelex/core/bundles/test_data_pipe_sorter.py
rename to tests/unit/core/bundles/test_data_pipe_sorter.py
diff --git a/tests/unit/pipelex/core/bundles/test_pipe_sorter.py b/tests/unit/core/bundles/test_pipe_sorter.py
similarity index 97%
rename from tests/unit/pipelex/core/bundles/test_pipe_sorter.py
rename to tests/unit/core/bundles/test_pipe_sorter.py
index 9f8718aaf..2c72fbe22 100644
--- a/tests/unit/pipelex/core/bundles/test_pipe_sorter.py
+++ b/tests/unit/core/bundles/test_pipe_sorter.py
@@ -4,7 +4,7 @@ import pytest
from pipelex.core.bundles.pipe_sorter import sort_pipes_by_dependencies
from pipelex.core.bundles.pipelex_bundle_blueprint import PipeBlueprintUnion
-from tests.unit.pipelex.core.bundles.test_data_pipe_sorter import PipeSorterTestCases
+from tests.unit.core.bundles.test_data_pipe_sorter import PipeSorterTestCases
class TestSortPipesByDependencies:
diff --git a/tests/unit/pipelex/core/test_data/complex/__init__.py b/tests/unit/core/concepts/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/complex/__init__.py
rename to tests/unit/core/concepts/__init__.py
diff --git a/tests/unit/pipelex/core/concepts/concept_factory/data.py b/tests/unit/core/concepts/concept_factory/data.py
similarity index 100%
rename from tests/unit/pipelex/core/concepts/concept_factory/data.py
rename to tests/unit/core/concepts/concept_factory/data.py
diff --git a/tests/unit/pipelex/core/concepts/concept_factory/test_concept_factory.py b/tests/unit/core/concepts/concept_factory/test_concept_factory.py
similarity index 98%
rename from tests/unit/pipelex/core/concepts/concept_factory/test_concept_factory.py
rename to tests/unit/core/concepts/concept_factory/test_concept_factory.py
index f64ffd299..005e2a25c 100644
--- a/tests/unit/pipelex/core/concepts/concept_factory/test_concept_factory.py
+++ b/tests/unit/core/concepts/concept_factory/test_concept_factory.py
@@ -8,7 +8,7 @@ from pipelex.core.concepts.concept_blueprint import (
)
from pipelex.core.concepts.concept_factory import ConceptFactory
from pipelex.exceptions import StructureClassError
-from tests.unit.pipelex.core.concepts.concept_factory.data import TestCases
+from tests.unit.core.concepts.concept_factory.data import TestCases
class TestConceptFactory:
diff --git a/tests/unit/pipelex/core/concepts/concept_library/test_concept_library.py b/tests/unit/core/concepts/concept_library/test_concept_library.py
similarity index 100%
rename from tests/unit/pipelex/core/concepts/concept_library/test_concept_library.py
rename to tests/unit/core/concepts/concept_library/test_concept_library.py
diff --git a/tests/unit/pipelex/core/concepts/data.py b/tests/unit/core/concepts/data.py
similarity index 100%
rename from tests/unit/pipelex/core/concepts/data.py
rename to tests/unit/core/concepts/data.py
diff --git a/tests/unit/pipelex/core/concepts/test_concept.py b/tests/unit/core/concepts/test_concept.py
similarity index 100%
rename from tests/unit/pipelex/core/concepts/test_concept.py
rename to tests/unit/core/concepts/test_concept.py
diff --git a/tests/unit/pipelex/core/concepts/test_concept_blueprint.py b/tests/unit/core/concepts/test_concept_blueprint.py
similarity index 100%
rename from tests/unit/pipelex/core/concepts/test_concept_blueprint.py
rename to tests/unit/core/concepts/test_concept_blueprint.py
diff --git a/tests/unit/pipelex/core/concepts/test_concept_compact_memory.py b/tests/unit/core/concepts/test_concept_compact_memory.py
similarity index 100%
rename from tests/unit/pipelex/core/concepts/test_concept_compact_memory.py
rename to tests/unit/core/concepts/test_concept_compact_memory.py
diff --git a/tests/unit/pipelex/core/concepts/test_concept_find_image_field_paths.py b/tests/unit/core/concepts/test_concept_find_image_field_paths.py
similarity index 98%
rename from tests/unit/pipelex/core/concepts/test_concept_find_image_field_paths.py
rename to tests/unit/core/concepts/test_concept_find_image_field_paths.py
index 16822aaff..80631cde7 100644
--- a/tests/unit/pipelex/core/concepts/test_concept_find_image_field_paths.py
+++ b/tests/unit/core/concepts/test_concept_find_image_field_paths.py
@@ -7,8 +7,8 @@ from pipelex.core.concepts.concept_native import NativeConceptCode
from pipelex.core.stuffs.structured_content import StructuredContent
from pipelex.hub import get_concept_library, get_native_concept, get_required_concept
from pipelex.system.registries.class_registry_utils import ClassRegistryUtils
-from tests.unit.pipelex.core.concepts import data
-from tests.unit.pipelex.core.concepts.data import TestData
+from tests.unit.core.concepts import data
+from tests.unit.core.concepts.data import TestData
if TYPE_CHECKING:
from pipelex.core.concepts.concept import Concept
diff --git a/tests/unit/pipelex/core/concepts/test_structure_generator_escaping.py b/tests/unit/core/concepts/test_structure_generator_escaping.py
similarity index 100%
rename from tests/unit/pipelex/core/concepts/test_structure_generator_escaping.py
rename to tests/unit/core/concepts/test_structure_generator_escaping.py
diff --git a/tests/unit/pipelex/core/concepts/test_structured_output_generator.py b/tests/unit/core/concepts/test_structured_output_generator.py
similarity index 100%
rename from tests/unit/pipelex/core/concepts/test_structured_output_generator.py
rename to tests/unit/core/concepts/test_structured_output_generator.py
diff --git a/tests/unit/pipelex/core/interpreter/test_interpreter.py b/tests/unit/core/interpreter/test_interpreter.py
similarity index 96%
rename from tests/unit/pipelex/core/interpreter/test_interpreter.py
rename to tests/unit/core/interpreter/test_interpreter.py
index 32073c02a..f6eeea9c5 100644
--- a/tests/unit/pipelex/core/interpreter/test_interpreter.py
+++ b/tests/unit/core/interpreter/test_interpreter.py
@@ -5,7 +5,7 @@ import pytest
from pipelex import log, pretty_print
from pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprint
from pipelex.core.interpreter import PipelexInterpreter
-from tests.unit.pipelex.core.test_data import InterpreterTestCases
+from tests.unit.core.test_data import InterpreterTestCases
class TestPipelexInterpreter:
diff --git a/tests/unit/pipelex/core/memory/conftest.py b/tests/unit/core/memory/conftest.py
similarity index 100%
rename from tests/unit/pipelex/core/memory/conftest.py
rename to tests/unit/core/memory/conftest.py
diff --git a/tests/unit/pipelex/core/memory/test_dry_working_memory.py b/tests/unit/core/memory/test_dry_working_memory.py
similarity index 100%
rename from tests/unit/pipelex/core/memory/test_dry_working_memory.py
rename to tests/unit/core/memory/test_dry_working_memory.py
diff --git a/tests/unit/pipelex/core/memory/test_working_memory_basic.py b/tests/unit/core/memory/test_working_memory_basic.py
similarity index 96%
rename from tests/unit/pipelex/core/memory/test_working_memory_basic.py
rename to tests/unit/core/memory/test_working_memory_basic.py
index de907a377..7ce7c3a7a 100644
--- a/tests/unit/pipelex/core/memory/test_working_memory_basic.py
+++ b/tests/unit/core/memory/test_working_memory_basic.py
@@ -2,7 +2,7 @@ from pipelex.core.concepts.concept_native import NativeConceptCode
from pipelex.core.memory.working_memory import MAIN_STUFF_NAME, WorkingMemory
from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory
from pipelex.core.stuffs.text_content import TextContent
-from tests.unit.pipelex.core.memory.conftest import TestWorkingMemoryData
+from tests.unit.core.memory.conftest import TestWorkingMemoryData
class TestWorkingMemoryBasic:
diff --git a/tests/unit/pipelex/core/memory/test_working_memory_generate_context.py b/tests/unit/core/memory/test_working_memory_generate_context.py
similarity index 99%
rename from tests/unit/pipelex/core/memory/test_working_memory_generate_context.py
rename to tests/unit/core/memory/test_working_memory_generate_context.py
index 4a895b892..af219a722 100644
--- a/tests/unit/pipelex/core/memory/test_working_memory_generate_context.py
+++ b/tests/unit/core/memory/test_working_memory_generate_context.py
@@ -7,7 +7,7 @@ from pipelex.core.stuffs.number_content import NumberContent
from pipelex.core.stuffs.stuff_artefact import StuffArtefact
from pipelex.core.stuffs.text_and_images_content import TextAndImagesContent
from pipelex.core.stuffs.text_content import TextContent
-from tests.unit.pipelex.core.memory.conftest import TestWorkingMemoryData
+from tests.unit.core.memory.conftest import TestWorkingMemoryData
class TestWorkingMemoryGenerateContext:
diff --git a/tests/unit/pipelex/core/memory/test_working_memory_typed_access.py b/tests/unit/core/memory/test_working_memory_typed_access.py
similarity index 99%
rename from tests/unit/pipelex/core/memory/test_working_memory_typed_access.py
rename to tests/unit/core/memory/test_working_memory_typed_access.py
index 4c1af32ef..393ced263 100644
--- a/tests/unit/pipelex/core/memory/test_working_memory_typed_access.py
+++ b/tests/unit/core/memory/test_working_memory_typed_access.py
@@ -14,7 +14,7 @@ from pipelex.core.stuffs.stuff_factory import StuffFactory
from pipelex.core.stuffs.text_and_images_content import TextAndImagesContent
from pipelex.core.stuffs.text_content import TextContent
from pipelex.exceptions import WorkingMemoryStuffAttributeNotFoundError, WorkingMemoryTypeError
-from tests.unit.pipelex.core.memory.conftest import TestWorkingMemoryData
+from tests.unit.core.memory.conftest import TestWorkingMemoryData
@pytest.fixture
diff --git a/tests/unit/pipelex/core/pipes/data.py b/tests/unit/core/pipes/data.py
similarity index 100%
rename from tests/unit/pipelex/core/pipes/data.py
rename to tests/unit/core/pipes/data.py
diff --git a/tests/unit/pipelex/core/pipes/test_input_requirements_factory.py b/tests/unit/core/pipes/test_input_requirements_factory.py
similarity index 99%
rename from tests/unit/pipelex/core/pipes/test_input_requirements_factory.py
rename to tests/unit/core/pipes/test_input_requirements_factory.py
index 7058b5d5a..07e55b44c 100644
--- a/tests/unit/pipelex/core/pipes/test_input_requirements_factory.py
+++ b/tests/unit/core/pipes/test_input_requirements_factory.py
@@ -5,7 +5,7 @@ from pipelex.core.domains.exceptions import DomainError
from pipelex.core.pipes.input_requirements import InputRequirement
from pipelex.core.pipes.input_requirements_factory import InputRequirementsFactory, InputRequirementsFactorySyntaxError
from pipelex.exceptions import ConceptLibraryConceptNotFoundError
-from tests.unit.pipelex.core.pipes.data import (
+from tests.unit.core.pipes.data import (
CONCEPT_CODE_RESOLUTION_TEST_CASES,
DIFFERENT_CONCEPT_CODES_TEST_CASES,
EXPLICIT_DOMAIN_IN_STRING_TEST_CASES,
diff --git a/tests/unit/pipelex/core/pipes/test_make_variable_multiplicity.py b/tests/unit/core/pipes/test_make_variable_multiplicity.py
similarity index 98%
rename from tests/unit/pipelex/core/pipes/test_make_variable_multiplicity.py
rename to tests/unit/core/pipes/test_make_variable_multiplicity.py
index a1dc65b65..4de9b9eb9 100644
--- a/tests/unit/pipelex/core/pipes/test_make_variable_multiplicity.py
+++ b/tests/unit/core/pipes/test_make_variable_multiplicity.py
@@ -1,7 +1,7 @@
import pytest
from pipelex.core.pipes.variable_multiplicity import VariableMultiplicity, make_variable_multiplicity
-from tests.unit.pipelex.core.pipes.data import MAKE_VARIABLE_MULTIPLICITY_TEST_CASES
+from tests.unit.core.pipes.data import MAKE_VARIABLE_MULTIPLICITY_TEST_CASES
class TestMakeVariableMultiplicity:
diff --git a/tests/unit/pipelex/core/pipes/test_parse_concept_with_multiplicity.py b/tests/unit/core/pipes/test_parse_concept_with_multiplicity.py
similarity index 100%
rename from tests/unit/pipelex/core/pipes/test_parse_concept_with_multiplicity.py
rename to tests/unit/core/pipes/test_parse_concept_with_multiplicity.py
diff --git a/tests/unit/pipelex/core/stuffs/test_stuff_content_factory.py b/tests/unit/core/stuffs/test_stuff_content_factory.py
similarity index 100%
rename from tests/unit/pipelex/core/stuffs/test_stuff_content_factory.py
rename to tests/unit/core/stuffs/test_stuff_content_factory.py
diff --git a/tests/unit/core/test_data/__init__.py b/tests/unit/core/test_data/__init__.py
new file mode 100644
index 000000000..ed37e33e4
--- /dev/null
+++ b/tests/unit/core/test_data/__init__.py
@@ -0,0 +1,48 @@
+from typing import ClassVar
+
+from pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprint
+from tests.unit.core.test_data.complex.multi_feature import COMPLEX_TEST_CASES
+from tests.unit.core.test_data.concepts.refining_concepts import REFINING_CONCEPT_TEST_CASES
+from tests.unit.core.test_data.concepts.simple_concepts import SIMPLE_CONCEPT_TEST_CASES
+from tests.unit.core.test_data.concepts.structured_concepts import STRUCTURED_CONCEPT_TEST_CASES
+from tests.unit.core.test_data.domain.simple_domains import DOMAIN_TEST_CASES
+from tests.unit.core.test_data.errors.invalid_plx import ERROR_TEST_CASES
+from tests.unit.core.test_data.pipes.controllers.batch.pipe_batch import PIPE_BATCH_TEST_CASES
+from tests.unit.core.test_data.pipes.controllers.condition.pipe_condition import PIPE_CONDITION_TEST_CASES
+from tests.unit.core.test_data.pipes.controllers.parallel.pipe_parallel import PIPE_PARALLEL_TEST_CASES
+from tests.unit.core.test_data.pipes.controllers.sequence.pipe_sequence import PIPE_SEQUENCE_TEST_CASES
+from tests.unit.core.test_data.pipes.operators.compose.pipe_compose import PIPE_COMPOSE_TEST_CASES
+from tests.unit.core.test_data.pipes.operators.extract.pipe_extract import PIPE_EXTRACT_TEST_CASES
+from tests.unit.core.test_data.pipes.operators.func.pipe_func import PIPE_FUNC_TEST_CASES
+from tests.unit.core.test_data.pipes.operators.img_gen.pipe_img_gen import PIPE_IMG_GEN_TEST_CASES
+from tests.unit.core.test_data.pipes.operators.llm.pipe_llm import PIPE_LLM_TEST_CASES
+
+
+class InterpreterTestCases:
+ """Test cases for PipelexInterpreter with PLX content and expected blueprints."""
+
+ # Aggregate all valid test cases from organized modules
+ VALID_TEST_CASES: ClassVar[list[tuple[str, str, PipelexBundleBlueprint]]] = [ # test_name,plx_content,blueprint
+ # Domain tests
+ *DOMAIN_TEST_CASES,
+ # Concept tests
+ *STRUCTURED_CONCEPT_TEST_CASES,
+ *REFINING_CONCEPT_TEST_CASES,
+ *SIMPLE_CONCEPT_TEST_CASES,
+ # Pipe operator tests
+ *PIPE_LLM_TEST_CASES,
+ *PIPE_EXTRACT_TEST_CASES,
+ *PIPE_FUNC_TEST_CASES,
+ *PIPE_IMG_GEN_TEST_CASES,
+ *PIPE_COMPOSE_TEST_CASES,
+ # Pipe controller tests
+ *PIPE_SEQUENCE_TEST_CASES,
+ *PIPE_CONDITION_TEST_CASES,
+ *PIPE_PARALLEL_TEST_CASES,
+ *PIPE_BATCH_TEST_CASES,
+ # Complex tests
+ *COMPLEX_TEST_CASES,
+ ]
+
+ # Error test cases
+ ERROR_TEST_CASES: ClassVar[list[tuple[str, str, type[Exception] | tuple[type[Exception], ...]]]] = ERROR_TEST_CASES
diff --git a/tests/unit/pipelex/core/test_data/domain/__init__.py b/tests/unit/core/test_data/complex/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/domain/__init__.py
rename to tests/unit/core/test_data/complex/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/complex/multi_feature.py b/tests/unit/core/test_data/complex/multi_feature.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/complex/multi_feature.py
rename to tests/unit/core/test_data/complex/multi_feature.py
diff --git a/tests/unit/pipelex/core/test_data/concepts/__init__.py b/tests/unit/core/test_data/concepts/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/concepts/__init__.py
rename to tests/unit/core/test_data/concepts/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/concepts/refining_concepts.py b/tests/unit/core/test_data/concepts/refining_concepts.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/concepts/refining_concepts.py
rename to tests/unit/core/test_data/concepts/refining_concepts.py
diff --git a/tests/unit/pipelex/core/test_data/concepts/simple_concepts.py b/tests/unit/core/test_data/concepts/simple_concepts.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/concepts/simple_concepts.py
rename to tests/unit/core/test_data/concepts/simple_concepts.py
diff --git a/tests/unit/pipelex/core/test_data/concepts/structured_concepts.py b/tests/unit/core/test_data/concepts/structured_concepts.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/concepts/structured_concepts.py
rename to tests/unit/core/test_data/concepts/structured_concepts.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/operators/compose/__init__.py b/tests/unit/core/test_data/domain/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/operators/compose/__init__.py
rename to tests/unit/core/test_data/domain/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/domain/simple_domains.py b/tests/unit/core/test_data/domain/simple_domains.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/domain/simple_domains.py
rename to tests/unit/core/test_data/domain/simple_domains.py
diff --git a/tests/unit/pipelex/core/test_data/errors/__init__.py b/tests/unit/core/test_data/errors/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/errors/__init__.py
rename to tests/unit/core/test_data/errors/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/errors/invalid_plx.py b/tests/unit/core/test_data/errors/invalid_plx.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/errors/invalid_plx.py
rename to tests/unit/core/test_data/errors/invalid_plx.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/__init__.py b/tests/unit/core/test_data/pipes/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/__init__.py
rename to tests/unit/core/test_data/pipes/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/controllers/__init__.py b/tests/unit/core/test_data/pipes/controllers/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/controllers/__init__.py
rename to tests/unit/core/test_data/pipes/controllers/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/controllers/batch/__init__.py b/tests/unit/core/test_data/pipes/controllers/batch/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/controllers/batch/__init__.py
rename to tests/unit/core/test_data/pipes/controllers/batch/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/controllers/batch/pipe_batch.py b/tests/unit/core/test_data/pipes/controllers/batch/pipe_batch.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/controllers/batch/pipe_batch.py
rename to tests/unit/core/test_data/pipes/controllers/batch/pipe_batch.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/controllers/condition/__init__.py b/tests/unit/core/test_data/pipes/controllers/condition/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/controllers/condition/__init__.py
rename to tests/unit/core/test_data/pipes/controllers/condition/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/controllers/condition/pipe_condition.py b/tests/unit/core/test_data/pipes/controllers/condition/pipe_condition.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/controllers/condition/pipe_condition.py
rename to tests/unit/core/test_data/pipes/controllers/condition/pipe_condition.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/controllers/parallel/__init__.py b/tests/unit/core/test_data/pipes/controllers/parallel/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/controllers/parallel/__init__.py
rename to tests/unit/core/test_data/pipes/controllers/parallel/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/controllers/parallel/pipe_parallel.py b/tests/unit/core/test_data/pipes/controllers/parallel/pipe_parallel.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/controllers/parallel/pipe_parallel.py
rename to tests/unit/core/test_data/pipes/controllers/parallel/pipe_parallel.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/controllers/sequence/__init__.py b/tests/unit/core/test_data/pipes/controllers/sequence/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/controllers/sequence/__init__.py
rename to tests/unit/core/test_data/pipes/controllers/sequence/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/controllers/sequence/pipe_sequence.py b/tests/unit/core/test_data/pipes/controllers/sequence/pipe_sequence.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/controllers/sequence/pipe_sequence.py
rename to tests/unit/core/test_data/pipes/controllers/sequence/pipe_sequence.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/operators/__init__.py b/tests/unit/core/test_data/pipes/operators/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/operators/__init__.py
rename to tests/unit/core/test_data/pipes/operators/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/operators/img_gen/__init__.py b/tests/unit/core/test_data/pipes/operators/compose/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/operators/img_gen/__init__.py
rename to tests/unit/core/test_data/pipes/operators/compose/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/operators/compose/pipe_compose.py b/tests/unit/core/test_data/pipes/operators/compose/pipe_compose.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/operators/compose/pipe_compose.py
rename to tests/unit/core/test_data/pipes/operators/compose/pipe_compose.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/operators/extract/__init__.py b/tests/unit/core/test_data/pipes/operators/extract/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/operators/extract/__init__.py
rename to tests/unit/core/test_data/pipes/operators/extract/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/operators/extract/pipe_extract.py b/tests/unit/core/test_data/pipes/operators/extract/pipe_extract.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/operators/extract/pipe_extract.py
rename to tests/unit/core/test_data/pipes/operators/extract/pipe_extract.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/operators/func/__init__.py b/tests/unit/core/test_data/pipes/operators/func/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/operators/func/__init__.py
rename to tests/unit/core/test_data/pipes/operators/func/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/operators/func/pipe_func.py b/tests/unit/core/test_data/pipes/operators/func/pipe_func.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/operators/func/pipe_func.py
rename to tests/unit/core/test_data/pipes/operators/func/pipe_func.py
diff --git a/tests/unit/core/test_data/pipes/operators/img_gen/__init__.py b/tests/unit/core/test_data/pipes/operators/img_gen/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/unit/pipelex/core/test_data/pipes/operators/img_gen/pipe_img_gen.py b/tests/unit/core/test_data/pipes/operators/img_gen/pipe_img_gen.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/operators/img_gen/pipe_img_gen.py
rename to tests/unit/core/test_data/pipes/operators/img_gen/pipe_img_gen.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/operators/llm/__init__.py b/tests/unit/core/test_data/pipes/operators/llm/__init__.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/operators/llm/__init__.py
rename to tests/unit/core/test_data/pipes/operators/llm/__init__.py
diff --git a/tests/unit/pipelex/core/test_data/pipes/operators/llm/pipe_llm.py b/tests/unit/core/test_data/pipes/operators/llm/pipe_llm.py
similarity index 100%
rename from tests/unit/pipelex/core/test_data/pipes/operators/llm/pipe_llm.py
rename to tests/unit/core/test_data/pipes/operators/llm/pipe_llm.py
diff --git a/tests/unit/pipelex/kit/test_index_loader.py b/tests/unit/kit/test_index_loader.py
similarity index 100%
rename from tests/unit/pipelex/kit/test_index_loader.py
rename to tests/unit/kit/test_index_loader.py
diff --git a/tests/unit/pipelex/kit/test_markers.py b/tests/unit/kit/test_markers.py
similarity index 100%
rename from tests/unit/pipelex/kit/test_markers.py
rename to tests/unit/kit/test_markers.py
diff --git a/tests/unit/pipelex/kit/test_paths.py b/tests/unit/kit/test_paths.py
similarity index 100%
rename from tests/unit/pipelex/kit/test_paths.py
rename to tests/unit/kit/test_paths.py
diff --git a/tests/unit/pipelex/language/test_plx_factory.py b/tests/unit/language/test_plx_factory.py
similarity index 100%
rename from tests/unit/pipelex/language/test_plx_factory.py
rename to tests/unit/language/test_plx_factory.py
diff --git a/tests/unit/pipelex/pipe_controllers/batch/data.py b/tests/unit/pipe_controllers/batch/data.py
similarity index 100%
rename from tests/unit/pipelex/pipe_controllers/batch/data.py
rename to tests/unit/pipe_controllers/batch/data.py
diff --git a/tests/unit/pipelex/pipe_controllers/batch/test_pipe_batch_input.py b/tests/unit/pipe_controllers/batch/test_pipe_batch_input.py
similarity index 91%
rename from tests/unit/pipelex/pipe_controllers/batch/test_pipe_batch_input.py
rename to tests/unit/pipe_controllers/batch/test_pipe_batch_input.py
index 653cfe705..2bc0fab43 100644
--- a/tests/unit/pipelex/pipe_controllers/batch/test_pipe_batch_input.py
+++ b/tests/unit/pipe_controllers/batch/test_pipe_batch_input.py
@@ -3,7 +3,7 @@ import pytest
from pipelex import log
from pipelex.pipe_controllers.batch.pipe_batch_blueprint import PipeBatchBlueprint
from pipelex.pipe_controllers.batch.pipe_batch_factory import PipeBatchFactory
-from tests.unit.pipelex.pipe_controllers.batch.data import PipeBatchInputTestCases
+from tests.unit.pipe_controllers.batch.data import PipeBatchInputTestCases
class TestPipeBatchValidateInputs:
diff --git a/tests/unit/pipelex/pipe_controllers/condition/data.py b/tests/unit/pipe_controllers/condition/data.py
similarity index 100%
rename from tests/unit/pipelex/pipe_controllers/condition/data.py
rename to tests/unit/pipe_controllers/condition/data.py
diff --git a/tests/unit/pipelex/pipe_controllers/condition/test_pipe_condition_input.py b/tests/unit/pipe_controllers/condition/test_pipe_condition_input.py
similarity index 96%
rename from tests/unit/pipelex/pipe_controllers/condition/test_pipe_condition_input.py
rename to tests/unit/pipe_controllers/condition/test_pipe_condition_input.py
index 5f009620d..8968314d5 100644
--- a/tests/unit/pipelex/pipe_controllers/condition/test_pipe_condition_input.py
+++ b/tests/unit/pipe_controllers/condition/test_pipe_condition_input.py
@@ -7,7 +7,7 @@ from pipelex.core.pipe_errors import PipeDefinitionError
from pipelex.exceptions import StaticValidationError
from pipelex.pipe_controllers.condition.pipe_condition_blueprint import PipeConditionBlueprint
from pipelex.pipe_controllers.condition.pipe_condition_factory import PipeConditionFactory
-from tests.unit.pipelex.pipe_controllers.condition.data import PipeConditionInputTestCases
+from tests.unit.pipe_controllers.condition.data import PipeConditionInputTestCases
class TestPipeConditionValidateInputs:
diff --git a/tests/unit/pipelex/pipe_controllers/parallel/data.py b/tests/unit/pipe_controllers/parallel/data.py
similarity index 100%
rename from tests/unit/pipelex/pipe_controllers/parallel/data.py
rename to tests/unit/pipe_controllers/parallel/data.py
diff --git a/tests/unit/pipelex/pipe_controllers/parallel/test_pipe_parallel_input.py b/tests/unit/pipe_controllers/parallel/test_pipe_parallel_input.py
similarity index 96%
rename from tests/unit/pipelex/pipe_controllers/parallel/test_pipe_parallel_input.py
rename to tests/unit/pipe_controllers/parallel/test_pipe_parallel_input.py
index 1ee423b11..dd55c4085 100644
--- a/tests/unit/pipelex/pipe_controllers/parallel/test_pipe_parallel_input.py
+++ b/tests/unit/pipe_controllers/parallel/test_pipe_parallel_input.py
@@ -7,7 +7,7 @@ from pipelex.core.pipe_errors import PipeDefinitionError
from pipelex.exceptions import StaticValidationError
from pipelex.pipe_controllers.parallel.pipe_parallel_blueprint import PipeParallelBlueprint
from pipelex.pipe_controllers.parallel.pipe_parallel_factory import PipeParallelFactory
-from tests.unit.pipelex.pipe_controllers.parallel.data import PipeParallelInputTestCases
+from tests.unit.pipe_controllers.parallel.data import PipeParallelInputTestCases
class TestPipeParallelValidateInputs:
diff --git a/tests/unit/pipelex/pipe_controllers/sequence/data.py b/tests/unit/pipe_controllers/sequence/data.py
similarity index 100%
rename from tests/unit/pipelex/pipe_controllers/sequence/data.py
rename to tests/unit/pipe_controllers/sequence/data.py
diff --git a/tests/unit/pipelex/pipe_controllers/sequence/test_pipe_sequence_input.py b/tests/unit/pipe_controllers/sequence/test_pipe_sequence_input.py
similarity index 96%
rename from tests/unit/pipelex/pipe_controllers/sequence/test_pipe_sequence_input.py
rename to tests/unit/pipe_controllers/sequence/test_pipe_sequence_input.py
index 99e29ce00..2574fd191 100644
--- a/tests/unit/pipelex/pipe_controllers/sequence/test_pipe_sequence_input.py
+++ b/tests/unit/pipe_controllers/sequence/test_pipe_sequence_input.py
@@ -7,7 +7,7 @@ from pipelex.core.pipe_errors import PipeDefinitionError
from pipelex.exceptions import StaticValidationError
from pipelex.pipe_controllers.sequence.pipe_sequence_blueprint import PipeSequenceBlueprint
from pipelex.pipe_controllers.sequence.pipe_sequence_factory import PipeSequenceFactory
-from tests.unit.pipelex.pipe_controllers.sequence.data import PipeSequenceInputTestCases
+from tests.unit.pipe_controllers.sequence.data import PipeSequenceInputTestCases
class TestPipeSequenceValidateInputs:
diff --git a/tests/unit/pipelex/pipe_operators/pipe_compose/data.py b/tests/unit/pipe_operators/pipe_compose/data.py
similarity index 100%
rename from tests/unit/pipelex/pipe_operators/pipe_compose/data.py
rename to tests/unit/pipe_operators/pipe_compose/data.py
diff --git a/tests/unit/pipelex/pipe_operators/pipe_compose/test_pipe_compose_input.py b/tests/unit/pipe_operators/pipe_compose/test_pipe_compose_input.py
similarity index 95%
rename from tests/unit/pipelex/pipe_operators/pipe_compose/test_pipe_compose_input.py
rename to tests/unit/pipe_operators/pipe_compose/test_pipe_compose_input.py
index be758053a..89419f376 100644
--- a/tests/unit/pipelex/pipe_operators/pipe_compose/test_pipe_compose_input.py
+++ b/tests/unit/pipe_operators/pipe_compose/test_pipe_compose_input.py
@@ -3,7 +3,7 @@ import pytest
from pipelex import log
from pipelex.pipe_operators.compose.pipe_compose_blueprint import PipeComposeBlueprint
from pipelex.pipe_operators.compose.pipe_compose_factory import PipeComposeFactory
-from tests.unit.pipelex.pipe_operators.pipe_compose.data import PipeComposeInputTestCases
+from tests.unit.pipe_operators.pipe_compose.data import PipeComposeInputTestCases
class TestPipeComposeValidateInputs:
diff --git a/tests/unit/pipelex/pipe_operators/pipe_extract/data.py b/tests/unit/pipe_operators/pipe_extract/data.py
similarity index 100%
rename from tests/unit/pipelex/pipe_operators/pipe_extract/data.py
rename to tests/unit/pipe_operators/pipe_extract/data.py
diff --git a/tests/unit/pipelex/pipe_operators/pipe_extract/test_pipe_extract_input.py b/tests/unit/pipe_operators/pipe_extract/test_pipe_extract_input.py
similarity index 95%
rename from tests/unit/pipelex/pipe_operators/pipe_extract/test_pipe_extract_input.py
rename to tests/unit/pipe_operators/pipe_extract/test_pipe_extract_input.py
index 39540d5f7..f6ed2d000 100644
--- a/tests/unit/pipelex/pipe_operators/pipe_extract/test_pipe_extract_input.py
+++ b/tests/unit/pipe_operators/pipe_extract/test_pipe_extract_input.py
@@ -4,7 +4,7 @@ from pipelex import log
from pipelex.exceptions import StaticValidationError
from pipelex.pipe_operators.extract.pipe_extract_blueprint import PipeExtractBlueprint
from pipelex.pipe_operators.extract.pipe_extract_factory import PipeExtractFactory
-from tests.unit.pipelex.pipe_operators.pipe_extract.data import PipeExtractInputTestCases
+from tests.unit.pipe_operators.pipe_extract.data import PipeExtractInputTestCases
class TestPipeExtractValidateInputs:
diff --git a/tests/unit/pipe_operators/pipe_func/data.py b/tests/unit/pipe_operators/pipe_func/data.py
new file mode 100644
index 000000000..8aaef4cda
--- /dev/null
+++ b/tests/unit/pipe_operators/pipe_func/data.py
@@ -0,0 +1,166 @@
+from typing import ClassVar
+
+from pipelex.core.memory.working_memory import WorkingMemory
+from pipelex.core.stuffs.text_content import TextContent
+from pipelex.pipe_operators.func.pipe_func_blueprint import PipeFuncBlueprint
+from pipelex.system.registries.func_registry import pipe_func
+
+
+# Register test functions for validation tests
+@pipe_func(name="my_function")
+async def my_function(working_memory: WorkingMemory) -> TextContent: # noqa: ARG001 # pyright: ignore[reportUnusedParameter]
+ """Test function with no inputs."""
+ return TextContent(text="test output")
+
+
+@pipe_func(name="process_text")
+async def process_text(working_memory: WorkingMemory) -> TextContent:
+ """Test function with single text input."""
+ input_data = working_memory.get_stuff_as_str("input_data")
+ return TextContent(text=f"processed: {input_data}")
+
+
+@pipe_func(name="combine_data")
+async def combine_data(working_memory: WorkingMemory) -> TextContent:
+ """Test function with multiple inputs."""
+ text_input = working_memory.get_stuff_as_str("text_input")
+ number_input = working_memory.get_stuff_as_number("number_input")
+ return TextContent(text=f"combined: {text_input} and {number_input}")
+
+
+@pipe_func(name="process_image")
+async def process_image(working_memory: WorkingMemory) -> TextContent:
+ """Test function with image input."""
+ image = working_memory.get_stuff_as_image("image")
+ return TextContent(text=f"processed image: {image.url}")
+
+
+@pipe_func(name="process_all")
+async def process_all(working_memory: WorkingMemory) -> TextContent:
+ """Test function with mixed inputs."""
+ text = working_memory.get_stuff_as_str("text")
+ image = working_memory.get_stuff_as_image("image")
+ number = working_memory.get_stuff_as_number("number")
+ return TextContent(text=f"processed all: {text}, {image.url}, {number}")
+
+
+# Error test functions - these have validation issues
+# NOT registered automatically - must be registered in test fixtures
+async def no_return_type_func(working_memory: WorkingMemory): # noqa: ARG001 # pyright: ignore[reportUnusedParameter]
+ """Test function with no return type annotation."""
+ return TextContent(text="no return type")
+
+
+async def wrong_return_type_func(working_memory: WorkingMemory) -> str: # noqa: ARG001 # pyright: ignore[reportUnusedParameter]
+ """Test function with wrong return type (not StuffContent)."""
+ return "wrong type"
+
+
+# Map of error function names to actual functions (for test fixtures)
+ERROR_TEST_FUNCTIONS = {
+ "no_return_type": no_return_type_func,
+ "wrong_return_type": wrong_return_type_func,
+}
+
+
+class PipeFuncInputTestCases:
+ """Test cases for PipeFunc input validation."""
+
+ # Valid test cases: (test_id, blueprint)
+ VALID_NO_INPUTS: ClassVar[tuple[str, PipeFuncBlueprint]] = (
+ "valid_no_inputs",
+ PipeFuncBlueprint(
+ description="Test case: valid_no_inputs",
+ inputs={},
+ output="native.Text",
+ function_name="my_function",
+ ),
+ )
+
+ VALID_SINGLE_INPUT: ClassVar[tuple[str, PipeFuncBlueprint]] = (
+ "valid_single_input",
+ PipeFuncBlueprint(
+ description="Test case: valid_single_input",
+ inputs={"input_data": "native.Text"},
+ output="native.Text",
+ function_name="process_text",
+ ),
+ )
+
+ VALID_MULTIPLE_INPUTS: ClassVar[tuple[str, PipeFuncBlueprint]] = (
+ "valid_multiple_inputs",
+ PipeFuncBlueprint(
+ description="Test case: valid_multiple_inputs",
+ inputs={"text_input": "native.Text", "number_input": "native.Number"},
+ output="native.Text",
+ function_name="combine_data",
+ ),
+ )
+
+ VALID_IMAGE_INPUT: ClassVar[tuple[str, PipeFuncBlueprint]] = (
+ "valid_image_input",
+ PipeFuncBlueprint(
+ description="Test case: valid_image_input",
+ inputs={"image": "native.Image"},
+ output="native.Text",
+ function_name="process_image",
+ ),
+ )
+
+ VALID_MIXED_INPUTS: ClassVar[tuple[str, PipeFuncBlueprint]] = (
+ "valid_mixed_inputs",
+ PipeFuncBlueprint(
+ description="Test case: valid_mixed_inputs",
+ inputs={"text": "native.Text", "image": "native.Image", "number": "native.Number"},
+ output="native.Text",
+ function_name="process_all",
+ ),
+ )
+
+ VALID_CASES: ClassVar[list[tuple[str, PipeFuncBlueprint]]] = [
+ VALID_NO_INPUTS,
+ VALID_SINGLE_INPUT,
+ VALID_MULTIPLE_INPUTS,
+ VALID_IMAGE_INPUT,
+ VALID_MIXED_INPUTS,
+ ]
+
+ # Error test cases: (test_id, blueprint, expected_error_message_substring)
+ ERROR_FUNCTION_NOT_FOUND: ClassVar[tuple[str, PipeFuncBlueprint, str]] = (
+ "function_not_found",
+ PipeFuncBlueprint(
+ description="Test case: function_not_found",
+ inputs={},
+ output="native.Text",
+ function_name="nonexistent_function",
+ ),
+ "not found in registry",
+ )
+
+ ERROR_NO_RETURN_TYPE: ClassVar[tuple[str, PipeFuncBlueprint, str]] = (
+ "no_return_type",
+ PipeFuncBlueprint(
+ description="Test case: no_return_type",
+ inputs={},
+ output="native.Text",
+ function_name="no_return_type",
+ ),
+ "has no return type annotation",
+ )
+
+ ERROR_WRONG_RETURN_TYPE: ClassVar[tuple[str, PipeFuncBlueprint, str]] = (
+ "wrong_return_type",
+ PipeFuncBlueprint(
+ description="Test case: wrong_return_type",
+ inputs={},
+ output="native.Text",
+ function_name="wrong_return_type",
+ ),
+ "is not a subclass of StuffContent",
+ )
+
+ ERROR_CASES: ClassVar[list[tuple[str, PipeFuncBlueprint, str]]] = [
+ ERROR_FUNCTION_NOT_FOUND,
+ ERROR_NO_RETURN_TYPE,
+ ERROR_WRONG_RETURN_TYPE,
+ ]
diff --git a/tests/unit/pipe_operators/pipe_func/test_pipe_func_input.py b/tests/unit/pipe_operators/pipe_func/test_pipe_func_input.py
new file mode 100644
index 000000000..afe4f4c0c
--- /dev/null
+++ b/tests/unit/pipe_operators/pipe_func/test_pipe_func_input.py
@@ -0,0 +1,89 @@
+import pytest
+
+from pipelex import log
+from pipelex.core.pipe_errors import PipeDefinitionError
+from pipelex.pipe_operators.func.pipe_func_blueprint import PipeFuncBlueprint
+from pipelex.pipe_operators.func.pipe_func_factory import PipeFuncFactory
+from pipelex.system.registries.func_registry import func_registry
+from tests.unit.pipe_operators.pipe_func.data import ERROR_TEST_FUNCTIONS, PipeFuncInputTestCases
+
+
[email protected](scope="class")
+def register_error_test_functions():
+ """Register error test functions that have validation issues.
+
+ These functions have intentional validation issues (no return type, wrong return type)
+ and need to be registered bypassing normal eligibility checks to test validation logic.
+ They are properly cleaned up after the test class completes.
+ """
+ registered_names: list[str] = []
+
+ # Register each error test function
+ # Note: We use register_function first (which will skip ineligible functions),
+ # then manually add if needed for testing validation
+ for func_name, func in ERROR_TEST_FUNCTIONS.items():
+ # Try normal registration first
+ func_registry.register_function(func, name=func_name)
+
+ # If not registered (due to eligibility check), manually add for testing
+ if not func_registry.has_function(func_name):
+ # Directly add to registry for testing validation (intentionally bypassing checks)
+ func_registry.root[func_name] = func
+
+ registered_names.append(func_name)
+
+ yield registered_names
+
+ # Cleanup: use proper accessor to unregister all error test functions
+ for func_name in registered_names:
+ if func_registry.has_function(func_name):
+ func_registry.unregister_function_by_name(func_name)
+
+
[email protected]("register_error_test_functions")
+class TestPipeFuncValidation:
+ @pytest.mark.parametrize(
+ ("test_id", "blueprint"),
+ PipeFuncInputTestCases.VALID_CASES,
+ )
+ def test_pipe_func_validate_valid_cases(
+ self,
+ test_id: str,
+ blueprint: PipeFuncBlueprint,
+ ):
+ log.verbose(f"Testing valid case: {test_id}")
+
+ pipe_func = PipeFuncFactory.make_from_blueprint(
+ domain="test_domain",
+ pipe_code=f"test_pipe_{test_id}",
+ blueprint=blueprint,
+ )
+
+ # Assert that the pipe was created successfully
+ assert pipe_func is not None
+ assert pipe_func.code == f"test_pipe_{test_id}"
+ assert pipe_func.function_name == blueprint.function_name
+
+ @pytest.mark.parametrize(
+ ("test_id", "blueprint", "expected_error_substring"),
+ PipeFuncInputTestCases.ERROR_CASES,
+ )
+ def test_pipe_func_validate_error_cases(
+ self,
+ test_id: str,
+ blueprint: PipeFuncBlueprint,
+ expected_error_substring: str,
+ ):
+ log.verbose(f"Testing error case: {test_id}")
+
+ # Assert that creating the pipe raises PipeDefinitionError
+ with pytest.raises(PipeDefinitionError) as exc_info:
+ PipeFuncFactory.make_from_blueprint(
+ domain="test_domain",
+ pipe_code=f"test_pipe_{test_id}",
+ blueprint=blueprint,
+ )
+
+ # Assert that the error message contains the expected substring
+ error_message = str(exc_info.value)
+ assert expected_error_substring in error_message, f"Expected error message to contain '{expected_error_substring}', but got: {error_message}"
diff --git a/tests/unit/pipelex/pipe_operators/pipe_img_gen/data.py b/tests/unit/pipe_operators/pipe_img_gen/data.py
similarity index 100%
rename from tests/unit/pipelex/pipe_operators/pipe_img_gen/data.py
rename to tests/unit/pipe_operators/pipe_img_gen/data.py
diff --git a/tests/unit/pipelex/pipe_operators/pipe_img_gen/test_pipe_img_gen_input.py b/tests/unit/pipe_operators/pipe_img_gen/test_pipe_img_gen_input.py
similarity index 95%
rename from tests/unit/pipelex/pipe_operators/pipe_img_gen/test_pipe_img_gen_input.py
rename to tests/unit/pipe_operators/pipe_img_gen/test_pipe_img_gen_input.py
index 6ccd8da83..3492daf08 100644
--- a/tests/unit/pipelex/pipe_operators/pipe_img_gen/test_pipe_img_gen_input.py
+++ b/tests/unit/pipe_operators/pipe_img_gen/test_pipe_img_gen_input.py
@@ -5,7 +5,7 @@ from pipelex.core.pipe_errors import PipeDefinitionError
from pipelex.exceptions import StaticValidationError
from pipelex.pipe_operators.img_gen.pipe_img_gen_blueprint import PipeImgGenBlueprint
from pipelex.pipe_operators.img_gen.pipe_img_gen_factory import PipeImgGenFactory
-from tests.unit.pipelex.pipe_operators.pipe_img_gen.data import PipeImgGenInputTestCases
+from tests.unit.pipe_operators.pipe_img_gen.data import PipeImgGenInputTestCases
class TestPipeImgGenValidateInputs:
diff --git a/tests/unit/pipelex/pipe_operators/pipe_llm/data.py b/tests/unit/pipe_operators/pipe_llm/data.py
similarity index 100%
rename from tests/unit/pipelex/pipe_operators/pipe_llm/data.py
rename to tests/unit/pipe_operators/pipe_llm/data.py
diff --git a/tests/unit/pipelex/pipe_operators/pipe_llm/test_pipe_llm_input.py b/tests/unit/pipe_operators/pipe_llm/test_pipe_llm_input.py
similarity index 95%
rename from tests/unit/pipelex/pipe_operators/pipe_llm/test_pipe_llm_input.py
rename to tests/unit/pipe_operators/pipe_llm/test_pipe_llm_input.py
index 466dd9dbf..1522a85f9 100644
--- a/tests/unit/pipelex/pipe_operators/pipe_llm/test_pipe_llm_input.py
+++ b/tests/unit/pipe_operators/pipe_llm/test_pipe_llm_input.py
@@ -4,7 +4,7 @@ from pipelex import log
from pipelex.exceptions import StaticValidationError
from pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprint
from pipelex.pipe_operators.llm.pipe_llm_factory import PipeLLMFactory
-from tests.unit.pipelex.pipe_operators.pipe_llm.data import PipeLLMInputTestCases
+from tests.unit.pipe_operators.pipe_llm.data import PipeLLMInputTestCases
class TestPipeLLMValidateInputs:
diff --git a/tests/unit/pipelex/pipe_run/data.py b/tests/unit/pipe_run/data.py
similarity index 100%
rename from tests/unit/pipelex/pipe_run/data.py
rename to tests/unit/pipe_run/data.py
diff --git a/tests/unit/pipelex/pipe_run/test_pipe_run_params.py b/tests/unit/pipe_run/test_pipe_run_params.py
similarity index 99%
rename from tests/unit/pipelex/pipe_run/test_pipe_run_params.py
rename to tests/unit/pipe_run/test_pipe_run_params.py
index f3839a84e..a98658a77 100644
--- a/tests/unit/pipelex/pipe_run/test_pipe_run_params.py
+++ b/tests/unit/pipe_run/test_pipe_run_params.py
@@ -4,7 +4,7 @@ from pipelex.core.pipes.variable_multiplicity import VariableMultiplicity, Varia
from pipelex.pipe_run.pipe_run_params import (
output_multiplicity_to_apply,
)
-from tests.unit.pipelex.pipe_run.data import OUTPUT_MULTIPLICITY_TO_APPLY_TEST_CASES
+from tests.unit.pipe_run.data import OUTPUT_MULTIPLICITY_TO_APPLY_TEST_CASES
class TestOutputMultiplicityToApply:
diff --git a/tests/unit/pipelex/core/test_data/__init__.py b/tests/unit/pipelex/core/test_data/__init__.py
deleted file mode 100644
index 663094fea..000000000
--- a/tests/unit/pipelex/core/test_data/__init__.py
+++ /dev/null
@@ -1,48 +0,0 @@
-from typing import ClassVar
-
-from pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprint
-from tests.unit.pipelex.core.test_data.complex.multi_feature import COMPLEX_TEST_CASES
-from tests.unit.pipelex.core.test_data.concepts.refining_concepts import REFINING_CONCEPT_TEST_CASES
-from tests.unit.pipelex.core.test_data.concepts.simple_concepts import SIMPLE_CONCEPT_TEST_CASES
-from tests.unit.pipelex.core.test_data.concepts.structured_concepts import STRUCTURED_CONCEPT_TEST_CASES
-from tests.unit.pipelex.core.test_data.domain.simple_domains import DOMAIN_TEST_CASES
-from tests.unit.pipelex.core.test_data.errors.invalid_plx import ERROR_TEST_CASES
-from tests.unit.pipelex.core.test_data.pipes.controllers.batch.pipe_batch import PIPE_BATCH_TEST_CASES
-from tests.unit.pipelex.core.test_data.pipes.controllers.condition.pipe_condition import PIPE_CONDITION_TEST_CASES
-from tests.unit.pipelex.core.test_data.pipes.controllers.parallel.pipe_parallel import PIPE_PARALLEL_TEST_CASES
-from tests.unit.pipelex.core.test_data.pipes.controllers.sequence.pipe_sequence import PIPE_SEQUENCE_TEST_CASES
-from tests.unit.pipelex.core.test_data.pipes.operators.compose.pipe_compose import PIPE_COMPOSE_TEST_CASES
-from tests.unit.pipelex.core.test_data.pipes.operators.extract.pipe_extract import PIPE_EXTRACT_TEST_CASES
-from tests.unit.pipelex.core.test_data.pipes.operators.func.pipe_func import PIPE_FUNC_TEST_CASES
-from tests.unit.pipelex.core.test_data.pipes.operators.img_gen.pipe_img_gen import PIPE_IMG_GEN_TEST_CASES
-from tests.unit.pipelex.core.test_data.pipes.operators.llm.pipe_llm import PIPE_LLM_TEST_CASES
-
-
-class InterpreterTestCases:
- """Test cases for PipelexInterpreter with PLX content and expected blueprints."""
-
- # Aggregate all valid test cases from organized modules
- VALID_TEST_CASES: ClassVar[list[tuple[str, str, PipelexBundleBlueprint]]] = [ # test_name,plx_content,blueprint
- # Domain tests
- *DOMAIN_TEST_CASES,
- # Concept tests
- *STRUCTURED_CONCEPT_TEST_CASES,
- *REFINING_CONCEPT_TEST_CASES,
- *SIMPLE_CONCEPT_TEST_CASES,
- # Pipe operator tests
- *PIPE_LLM_TEST_CASES,
- *PIPE_EXTRACT_TEST_CASES,
- *PIPE_FUNC_TEST_CASES,
- *PIPE_IMG_GEN_TEST_CASES,
- *PIPE_COMPOSE_TEST_CASES,
- # Pipe controller tests
- *PIPE_SEQUENCE_TEST_CASES,
- *PIPE_CONDITION_TEST_CASES,
- *PIPE_PARALLEL_TEST_CASES,
- *PIPE_BATCH_TEST_CASES,
- # Complex tests
- *COMPLEX_TEST_CASES,
- ]
-
- # Error test cases
- ERROR_TEST_CASES: ClassVar[list[tuple[str, str, type[Exception] | tuple[type[Exception], ...]]]] = ERROR_TEST_CASES
diff --git a/tests/unit/pipelex/pipe_operators/pipe_func/data.py b/tests/unit/pipelex/pipe_operators/pipe_func/data.py
deleted file mode 100644
index 6572cff4b..000000000
--- a/tests/unit/pipelex/pipe_operators/pipe_func/data.py
+++ /dev/null
@@ -1,71 +0,0 @@
-from typing import ClassVar
-
-from pipelex.pipe_operators.func.pipe_func_blueprint import PipeFuncBlueprint
-
-
-class PipeFuncInputTestCases:
- """Test cases for PipeFunc input validation."""
-
- # Valid test cases: (test_id, blueprint)
- VALID_NO_INPUTS: ClassVar[tuple[str, PipeFuncBlueprint]] = (
- "valid_no_inputs",
- PipeFuncBlueprint(
- description="Test case: valid_no_inputs",
- inputs={},
- output="native.Text",
- function_name="my_function",
- ),
- )
-
- VALID_SINGLE_INPUT: ClassVar[tuple[str, PipeFuncBlueprint]] = (
- "valid_single_input",
- PipeFuncBlueprint(
- description="Test case: valid_single_input",
- inputs={"input_data": "native.Text"},
- output="native.Text",
- function_name="process_text",
- ),
- )
-
- VALID_MULTIPLE_INPUTS: ClassVar[tuple[str, PipeFuncBlueprint]] = (
- "valid_multiple_inputs",
- PipeFuncBlueprint(
- description="Test case: valid_multiple_inputs",
- inputs={"text_input": "native.Text", "number_input": "native.Number"},
- output="native.Text",
- function_name="combine_data",
- ),
- )
-
- VALID_IMAGE_INPUT: ClassVar[tuple[str, PipeFuncBlueprint]] = (
- "valid_image_input",
- PipeFuncBlueprint(
- description="Test case: valid_image_input",
- inputs={"image": "native.Image"},
- output="native.Text",
- function_name="process_image",
- ),
- )
-
- VALID_MIXED_INPUTS: ClassVar[tuple[str, PipeFuncBlueprint]] = (
- "valid_mixed_inputs",
- PipeFuncBlueprint(
- description="Test case: valid_mixed_inputs",
- inputs={"text": "native.Text", "image": "native.Image", "number": "native.Number"},
- output="native.Text",
- function_name="process_all",
- ),
- )
-
- VALID_CASES: ClassVar[list[tuple[str, PipeFuncBlueprint]]] = [
- VALID_NO_INPUTS,
- VALID_SINGLE_INPUT,
- VALID_MULTIPLE_INPUTS,
- VALID_IMAGE_INPUT,
- VALID_MIXED_INPUTS,
- ]
-
- # Note: PipeFunc has minimal validation since it's very flexible
- # The main validation is that function_name is required (enforced by Pydantic)
- # We don't have error cases for inputs since any input configuration is valid
- ERROR_CASES: ClassVar[list[tuple[str, PipeFuncBlueprint, str]]] = []
diff --git a/tests/unit/pipelex/pipe_operators/pipe_func/test_pipe_func_input.py b/tests/unit/pipelex/pipe_operators/pipe_func/test_pipe_func_input.py
deleted file mode 100644
index 6c799c372..000000000
--- a/tests/unit/pipelex/pipe_operators/pipe_func/test_pipe_func_input.py
+++ /dev/null
@@ -1,30 +0,0 @@
-import pytest
-
-from pipelex import log
-from pipelex.pipe_operators.func.pipe_func_blueprint import PipeFuncBlueprint
-from pipelex.pipe_operators.func.pipe_func_factory import PipeFuncFactory
-from tests.unit.pipelex.pipe_operators.pipe_func.data import PipeFuncInputTestCases
-
-
-class TestPipeFuncValidateInputs:
- @pytest.mark.parametrize(
- ("test_id", "blueprint"),
- PipeFuncInputTestCases.VALID_CASES,
- )
- def test_validate_inputs_valid_cases(
- self,
- test_id: str,
- blueprint: PipeFuncBlueprint,
- ):
- log.verbose(f"Testing valid case: {test_id}")
-
- pipe_func = PipeFuncFactory.make_from_blueprint(
- domain="test_domain",
- pipe_code=f"test_pipe_{test_id}",
- blueprint=blueprint,
- )
-
- # Assert that the pipe was created successfully
- assert pipe_func is not None
- assert pipe_func.code == f"test_pipe_{test_id}"
- assert pipe_func.function_name == blueprint.function_name
diff --git a/tests/unit/pipelex/tools/config/test_load_config.py b/tests/unit/tools/config/test_load_config.py
similarity index 100%
rename from tests/unit/pipelex/tools/config/test_load_config.py
rename to tests/unit/tools/config/test_load_config.py
diff --git a/tests/unit/pipelex/tools/misc/test_base_64_utils.py b/tests/unit/tools/misc/test_base_64_utils.py
similarity index 100%
rename from tests/unit/pipelex/tools/misc/test_base_64_utils.py
rename to tests/unit/tools/misc/test_base_64_utils.py
diff --git a/tests/unit/pipelex/tools/misc/test_dict_utils.py b/tests/unit/tools/misc/test_dict_utils.py
similarity index 100%
rename from tests/unit/pipelex/tools/misc/test_dict_utils.py
rename to tests/unit/tools/misc/test_dict_utils.py
diff --git a/tests/unit/pipelex/tools/misc/test_filetype_utils.py b/tests/unit/tools/misc/test_filetype_utils.py
similarity index 100%
rename from tests/unit/pipelex/tools/misc/test_filetype_utils.py
rename to tests/unit/tools/misc/test_filetype_utils.py
diff --git a/tests/unit/pipelex/tools/misc/test_find_files_in_dir.py b/tests/unit/tools/misc/test_find_files_in_dir.py
similarity index 100%
rename from tests/unit/pipelex/tools/misc/test_find_files_in_dir.py
rename to tests/unit/tools/misc/test_find_files_in_dir.py
diff --git a/tests/unit/pipelex/tools/misc/test_markdown.py b/tests/unit/tools/misc/test_markdown.py
similarity index 100%
rename from tests/unit/pipelex/tools/misc/test_markdown.py
rename to tests/unit/tools/misc/test_markdown.py
diff --git a/tests/unit/pipelex/tools/misc/test_path_utils.py b/tests/unit/tools/misc/test_path_utils.py
similarity index 100%
rename from tests/unit/pipelex/tools/misc/test_path_utils.py
rename to tests/unit/tools/misc/test_path_utils.py
diff --git a/tests/unit/pipelex/tools/misc/test_placeholder.py b/tests/unit/tools/misc/test_placeholder.py
similarity index 100%
rename from tests/unit/pipelex/tools/misc/test_placeholder.py
rename to tests/unit/tools/misc/test_placeholder.py
diff --git a/tests/unit/pipelex/tools/misc/test_pretty.py b/tests/unit/tools/misc/test_pretty.py
similarity index 100%
rename from tests/unit/pipelex/tools/misc/test_pretty.py
rename to tests/unit/tools/misc/test_pretty.py
diff --git a/tests/unit/pipelex/tools/misc/test_string_utils.py b/tests/unit/tools/misc/test_string_utils.py
similarity index 100%
rename from tests/unit/pipelex/tools/misc/test_string_utils.py
rename to tests/unit/tools/misc/test_string_utils.py
diff --git a/tests/unit/pipelex/tools/misc/test_text.py b/tests/unit/tools/misc/test_text.py
similarity index 100%
rename from tests/unit/pipelex/tools/misc/test_text.py
rename to tests/unit/tools/misc/test_text.py
diff --git a/tests/unit/pipelex/tools/misc/test_toml_utils.py b/tests/unit/tools/misc/test_toml_utils.py
similarity index 100%
rename from tests/unit/pipelex/tools/misc/test_toml_utils.py
rename to tests/unit/tools/misc/test_toml_utils.py
diff --git a/tests/unit/pipelex/tools/secrets/test_secrets_utils.py b/tests/unit/tools/secrets/test_secrets_utils.py
similarity index 100%
rename from tests/unit/pipelex/tools/secrets/test_secrets_utils.py
rename to tests/unit/tools/secrets/test_secrets_utils.py
diff --git a/tests/unit/pipelex/tools/test_class_registry_utils.py b/tests/unit/tools/test_class_registry_utils.py
similarity index 100%
rename from tests/unit/pipelex/tools/test_class_registry_utils.py
rename to tests/unit/tools/test_class_registry_utils.py
diff --git a/tests/unit/pipelex/tools/test_environment.py b/tests/unit/tools/test_environment.py
similarity index 100%
rename from tests/unit/pipelex/tools/test_environment.py
rename to tests/unit/tools/test_environment.py
diff --git a/tests/unit/pipelex/tools/test_func_registry.py b/tests/unit/tools/test_func_registry.py
similarity index 100%
rename from tests/unit/pipelex/tools/test_func_registry.py
rename to tests/unit/tools/test_func_registry.py
diff --git a/tests/unit/pipelex/tools/test_func_registry_utils.py b/tests/unit/tools/test_func_registry_utils.py
similarity index 100%
rename from tests/unit/pipelex/tools/test_func_registry_utils.py
rename to tests/unit/tools/test_func_registry_utils.py
diff --git a/tests/unit/pipelex/tools/test_jinja2.py b/tests/unit/tools/test_jinja2.py
similarity index 100%
rename from tests/unit/pipelex/tools/test_jinja2.py
rename to tests/unit/tools/test_jinja2.py
diff --git a/tests/unit/pipelex/tools/test_testing.py b/tests/unit/tools/test_testing.py
similarity index 100%
rename from tests/unit/pipelex/tools/test_testing.py
rename to tests/unit/tools/test_testing.py
diff --git a/tests/unit/pipelex/tools/typing/test_convert_file_path_to_module_path.py b/tests/unit/tools/typing/test_convert_file_path_to_module_path.py
similarity index 100%
rename from tests/unit/pipelex/tools/typing/test_convert_file_path_to_module_path.py
rename to tests/unit/tools/typing/test_convert_file_path_to_module_path.py
diff --git a/tests/unit/pipelex/tools/typing/test_find_class_names_in_file.py b/tests/unit/tools/typing/test_find_class_names_in_file.py
similarity index 100%
rename from tests/unit/pipelex/tools/typing/test_find_class_names_in_file.py
rename to tests/unit/tools/typing/test_find_class_names_in_file.py
diff --git a/tests/unit/pipelex/tools/typing/test_find_classes_in_module.py b/tests/unit/tools/typing/test_find_classes_in_module.py
similarity index 100%
rename from tests/unit/pipelex/tools/typing/test_find_classes_in_module.py
rename to tests/unit/tools/typing/test_find_classes_in_module.py
diff --git a/tests/unit/pipelex/tools/typing/test_import_module_from_file.py b/tests/unit/tools/typing/test_import_module_from_file.py
similarity index 100%
rename from tests/unit/pipelex/tools/typing/test_import_module_from_file.py
rename to tests/unit/tools/typing/test_import_module_from_file.py
diff --git a/tests/unit/pipelex/tools/typing/test_import_module_from_file_if_has_classes.py b/tests/unit/tools/typing/test_import_module_from_file_if_has_classes.py
similarity index 100%
rename from tests/unit/pipelex/tools/typing/test_import_module_from_file_if_has_classes.py
rename to tests/unit/tools/typing/test_import_module_from_file_if_has_classes.py
diff --git a/tests/unit/pipelex/tools/typing/test_module_file_error.py b/tests/unit/tools/typing/test_module_file_error.py
similarity index 100%
rename from tests/unit/pipelex/tools/typing/test_module_file_error.py
rename to tests/unit/tools/typing/test_module_file_error.py
diff --git a/tests/unit/pipelex/tools/typing/test_pydantic_utils.py b/tests/unit/tools/typing/test_pydantic_utils.py
similarity index 100%
rename from tests/unit/pipelex/tools/typing/test_pydantic_utils.py
rename to tests/unit/tools/typing/test_pydantic_utils.py
diff --git a/tests/unit/pipelex/tools/typing/test_structure_printer.py b/tests/unit/tools/typing/test_structure_printer.py
similarity index 100%
rename from tests/unit/pipelex/tools/typing/test_structure_printer.py
rename to tests/unit/tools/typing/test_structure_printer.py
diff --git a/uv.lock b/uv.lock
index c78f11aec..2b19d373e 100644
--- a/uv.lock
+++ b/uv.lock
@@ -287,6 +287,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/b7/b8/3fe70c75fe32afc4bb507f75563d39bc5642255d1d94f1f23604725780bf/babel-2.17.0-py3-none-any.whl", hash = "sha256:4d0b53093fdfb4b21c92b5213dba5a1b23885afa8383709427046b21c366e5f2", size = 10182537, upload-time = "2025-02-01T15:17:37.39Z" },
]
+[[package]]
+name = "backoff"
+version = "2.2.1"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/47/d7/5bbeb12c44d7c4f2fb5b56abce497eb5ed9f34d85701de869acedd602619/backoff-2.2.1.tar.gz", hash = "sha256:03f829f5bb1923180821643f8753b0502c3b682293992485b0eef2807afa5cba", size = 17001, upload-time = "2022-10-05T19:19:32.061Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/df/73/b6e24bd22e6720ca8ee9a85a0c4a2971af8497d8f3193fa05390cbd46e09/backoff-2.2.1-py3-none-any.whl", hash = "sha256:63579f9a0628e06278f7e47b7d7d5b6ce20dc65c5e96a6f3ca99a6adca0396e8", size = 15148, upload-time = "2022-10-05T19:19:30.546Z" },
+]
+
[[package]]
name = "backports-asyncio-runner"
version = "1.2.0"
@@ -1891,7 +1900,7 @@ wheels = [
[[package]]
name = "pipelex"
-version = "0.13.1"
+version = "0.13.2"
source = { editable = "." }
dependencies = [
{ name = "aiofiles" },
@@ -1908,6 +1917,7 @@ dependencies = [
{ name = "openai" },
{ name = "pillow" },
{ name = "polyfactory" },
+ { name = "posthog" },
{ name = "pydantic" },
{ name = "pypdfium2" },
{ name = "python-dotenv" },
@@ -1996,6 +2006,7 @@ requires-dist = [
{ name = "openai", specifier = ">=1.60.1" },
{ name = "pillow", specifier = ">=11.2.1" },
{ name = "polyfactory", specifier = ">=2.21.0" },
+ { name = "posthog", specifier = ">=6.7.0" },
{ name = "pydantic", specifier = ">=2.10.6,<3.0.0" },
{ name = "pylint", marker = "extra == 'dev'", specifier = ">=3.3.8" },
{ name = "pypdfium2", specifier = ">=4.30.0,!=4.30.1" },
@@ -2055,6 +2066,23 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/e7/fe/d52c90e07c458f38b26f9972a25cb011b2744813f76fcd6121dde64744fa/polyfactory-2.22.2-py3-none-any.whl", hash = "sha256:9bea58ac9a80375b4153cd60820f75e558b863e567e058794d28c6a52b84118a", size = 63715, upload-time = "2025-08-15T06:23:19.664Z" },
]
+[[package]]
+name = "posthog"
+version = "6.7.9"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "backoff" },
+ { name = "distro" },
+ { name = "python-dateutil" },
+ { name = "requests" },
+ { name = "six" },
+ { name = "typing-extensions" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/88/f8/9118197ff1113b957fa3b5d206c0e41d8885afdbb9c590bc5274602e5e62/posthog-6.7.9.tar.gz", hash = "sha256:506fd31a6a4a1a6ca207df5a05ec9bef10b64bbe148d983d8d6956bffad195c3", size = 120171, upload-time = "2025-10-22T20:53:40.099Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/07/9c/72705369b4b8bbefebe60d5bc00ad04a76a91b1a437e8ef758cd17d12acb/posthog-6.7.9-py3-none-any.whl", hash = "sha256:1415c20fed34f4be2ed4fb910516637a28a18bdfa461ee6a41588baa2f4fa64a", size = 138472, upload-time = "2025-10-22T20:53:38.749Z" },
+]
+
[[package]]
name = "propcache"
version = "0.4.1"