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.

make cc

thomashebrard38e25acd5d43
diff --git a/pipelex/libraries/pipelines/builder/pipe/pipe_design.plx b/pipelex/libraries/pipelines/builder/pipe/pipe_design.plx
index 1406894ef..92f3dc2ab 100644
--- a/pipelex/libraries/pipelines/builder/pipe/pipe_design.plx
+++ b/pipelex/libraries/pipelines/builder/pipe/pipe_design.plx
@@ -155,13 +155,6 @@ llm = "llm_to_engineer"
prompt_template = """
Your job is to design a PipeComposeSpec to render a jinja2 template.
-For now, the only 2 jinja2 filters that are supported are:
-- `tag`
-- `format`
-
-The `tag` filter is used to add tags to the output.
-The `format` filter is used to format the output.
-
This PipeCompose is part of a larger pipeline:
@plan_draft
diff --git a/pipelex/pipe_controllers/sub_pipe.py b/pipelex/pipe_controllers/sub_pipe.py
index 1ddff16f8..6e52855dd 100644
--- a/pipelex/pipe_controllers/sub_pipe.py
+++ b/pipelex/pipe_controllers/sub_pipe.py
@@ -122,7 +122,6 @@ class SubPipe(BaseModel):
log.verbose(required_stuffs, title=f"Required stuffs for {self.pipe_code}")
# This is the only line that changes between run and dry_run
if sub_pipe_run_params.run_mode == PipeRunMode.DRY:
- sub_pipe_run_params.run_mode = PipeRunMode.DRY
pipe_output = await sub_pipe.run_pipe(
job_metadata=job_metadata,
working_memory=working_memory,
diff --git a/pipelex/tools/templating/jinja2_filters.py b/pipelex/tools/templating/jinja2_filters.py
index c798c5293..da0341de1 100644
--- a/pipelex/tools/templating/jinja2_filters.py
+++ b/pipelex/tools/templating/jinja2_filters.py
@@ -12,7 +12,7 @@ from pipelex.types import StrEnum
# Jinja2 filters
########################################################################################
-ALLOWED_FILTERS = ["tag", "format"]
+ALLOWED_FILTERS = ["tag", "format", "default"]
# Filter to format some Stuff or any object with the appropriate text formatting methods
diff --git a/pipelex/tools/templating/template_preprocessor.py b/pipelex/tools/templating/template_preprocessor.py
index 7cfdadc5b..1db627b24 100644
--- a/pipelex/tools/templating/template_preprocessor.py
+++ b/pipelex/tools/templating/template_preprocessor.py
@@ -1,38 +1,34 @@
import re
from re import Match
-from pipelex.tools.templating.jinja2_errors import Jinja2TemplateError
-from pipelex.tools.templating.jinja2_filters import ALLOWED_FILTERS
+# def _detect_non_existent_filters(template_str: str) -> None:
+# """Check a template string for non-existent Jinja2 filters.
+# Args:
+# template_str: The template string to check
-def _detect_non_existent_filters(template_str: str) -> None:
- """Check a template string for non-existent Jinja2 filters.
+# Raises:
+# Jinja2TemplateError: If any non-allowed filters are found
- Args:
- template_str: The template string to check
+# """
+# # Pattern to match Jinja2 filter syntax: {{ variable|filter() }} or {{ variable|filter(param) }}
+# # This handles:
+# # - {{ variable|filter }}
+# # - {{ variable|filter() }}
+# # - {{ variable|filter(param) }}
+# # - {{ variable|filter(param1, param2) }}
+# filter_pattern = r"\{\{\s*[^|}]+\|\s*([a-zA-Z0-9_]+)(?:\([^)]*\))?\s*\}\}"
+# matches = re.finditer(filter_pattern, template_str)
- Raises:
- Jinja2TemplateError: If any non-allowed filters are found
+# invalid_filters: list[str] = []
+# for match in matches:
+# filter_name = match.group(1)
+# if filter_name not in ALLOWED_FILTERS:
+# invalid_filters.append(filter_name)
- """
- # Pattern to match Jinja2 filter syntax: {{ variable|filter() }} or {{ variable|filter(param) }}
- # This handles:
- # - {{ variable|filter }}
- # - {{ variable|filter() }}
- # - {{ variable|filter(param) }}
- # - {{ variable|filter(param1, param2) }}
- filter_pattern = r"\{\{\s*[^|}]+\|\s*([a-zA-Z0-9_]+)(?:\([^)]*\))?\s*\}\}"
- matches = re.finditer(filter_pattern, template_str)
-
- invalid_filters: list[str] = []
- for match in matches:
- filter_name = match.group(1)
- if filter_name not in ALLOWED_FILTERS:
- invalid_filters.append(filter_name)
-
- if invalid_filters:
- msg = f"Invalid Jinja2 filters found: {invalid_filters}. Only the following filters are allowed: {ALLOWED_FILTERS}"
- raise Jinja2TemplateError(msg)
+# if invalid_filters:
+# msg = f"Invalid Jinja2 filters found: {invalid_filters}. Only the following filters are allowed: {ALLOWED_FILTERS}"
+# raise Jinja2TemplateError(msg)
# Handle @variable patterns
@@ -69,7 +65,7 @@ def preprocess_template(template: str) -> str:
"""Preprocess a template string to interpret our syntax patterns and convert them to Jinja2 syntax.
Also, detect the use of non-existent filters.
"""
- _detect_non_existent_filters(template_str=template)
+ # _detect_non_existent_filters(template_str=template)
processed_template = template
changes_made = False