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.
Merge branch 'refactor/EPIC-3-Improving-builder-pipeline' into refactor/EPIC-4
Louis Choquel4d5d4bd9604f
diff --cc pipelex/core/interpreter.pyindex 4c5ceafed,036e550f3..65cd9321c--- a/pipelex/core/interpreter.py+++ b/pipelex/core/interpreter.py@@@ -120,8 -100,6 +100,8 @@@ class PipelexInterpreter(BaseModel)def make_pipelex_bundle_blueprint(self) -> PipelexBundleBlueprint:"""Make a PipelexBundleBlueprint from the file_path or file_content"""- file_content = self._read_and_reformat()+ file_content = self._get_content()- plx_data = self._parse_plx_content(file_content)- return PipelexBundleBlueprint.model_validate(plx_data)+ blueprint_dict = self._parse_plx_content(file_content)+ if self.file_path:+ blueprint_dict.update(source=str(self.file_path))+ return PipelexBundleBlueprint.model_validate(blueprint_dict)diff --cc pipelex/libraries/pipelines/builder/pipe/pipe_design.plxindex 308dad3d0,7d761ddbb..488628f00--- a/pipelex/libraries/pipelines/builder/pipe/pipe_design.plx+++ b/pipelex/libraries/pipelines/builder/pipe/pipe_design.plx@@@ -160,276 -160,4 +160,59 @@@ This PipeCompose is part of a larger piYou will specifically generate the PipeCompose related to this signature:@pipe_signature++You can ONLY USE THE INPUTS IN THIS PIPE SIGNATURE.++Here are the Jinja2 filters that are supported:+abs — Returns the absolute value of a number.+attr — Gets an attribute from an object, returning undefined if missing.+batch — Groups items into sublists of a given size, optionally filling blanks.+capitalize — Uppercases the first character and lowercases the rest.+center — Centers a string within a given width.+default — Returns a fallback value if the input is undefined (or falsey if enabled).+dictsort — Sorts a dict and yields (key, value) pairs by key or value.+escape — HTML-escapes &, <, >, ' and ".+filesizeformat — Formats bytes as human-readable sizes (kB/MB or KiB/MiB).+first — Returns the first item of a sequence.+float — Converts a value to float with an optional default.+forceescape — Forces HTML escaping even if marked safe.+format — Applies printf-style string formatting.+groupby — Groups items by an attribute (sorted first).+indent — Indents each line of a string by a given width.+int — Converts a value to int with base and default support.+items — Iterates over a mapping’s items, empty if undefined.+join — Concatenates sequence items with an optional separator or attribute.+last — Returns the last item of a sequence.+length — Returns the number of items (alias: count).+list — Converts the value to a list (strings become lists of characters).+lower — Converts a string to lowercase.+map — Extracts an attribute or applies a filter across a sequence.+max — Returns the largest item, optionally by attribute.+min — Returns the smallest item, optionally by attribute.+pprint — Pretty-prints a value for debugging.+random — Returns a random item from a sequence.+reject — Filters out items where a test passes.+rejectattr — Filters out items based on an attribute test.+replace — Replaces occurrences of a substring with another.+reverse — Reverses a string or iterable.+round — Rounds a number with precision and method (common/ceil/floor).+safe — Marks a string as safe and prevents auto-escaping.+select — Keeps only items where a test passes.+selectattr — Keeps only items whose attribute passes a test.+slice — Slices items into N columns (lists of lists), with optional fill.+sort — Sorts an iterable, with reverse, case, and attribute options.+string — Converts to string while preserving Markup safety.+striptags — Removes HTML/XML tags and collapses whitespace.+sum — Sums numbers or an attribute across items, with a start value.+title — Title-cases the string (each word capitalized).+tojson — Serializes a value to JSON and marks it safe for HTML.+trim — Strips leading and trailing characters (default: whitespace).+truncate — Shortens text to a length with optional word-safe ellipsis.+unique — Yields unique items in first-seen order, optional attribute.+upper — Converts a string to uppercase.+urlencode — URL-encodes a string or builds a query string from pairs.+urlize — Converts URLs/emails in text into clickable links.+wordcount — Counts words in a string.+wordwrap — Wraps text to a given width with options for breaks.+xmlattr — Builds safe HTML/XML attributes from a dict."""-- # ────────────────────────────────────────────────────────────────────────────────- # PIPE FIXERS — one per pipe type, all fixing specific pipe type issues- # ────────────────────────────────────────────────────────────────────────────────-- # [pipe.fix_failing_pipe]- # type = "PipeCondition"- # definition = "Route to specific pipe fixer based on the failing pipe type."- # inputs = { pipelex_bundle_spec = "PipelexBundleSpec", pipe_failure = "PipeFailure" }- # output = "Dynamic"- # expression = "pipe_failure.pipe.type"-- # [pipe.fix_failing_pipe.pipe_map]- # PipeLLM = "fix_failing_llm_pipe"- # PipeImgGen = "fix_failing_imggen_pipe"- # PipeOcr = "fix_failing_ocr_pipe"- # PipeFunc = "fix_failing_func_pipe"- # PipeCompose = "fix_failing_jinja2_pipe"- # PipeSequence = "fix_failing_sequence_pipe"- # PipeParallel = "fix_failing_parallel_pipe"- # PipeCondition = "fix_failing_condition_pipe"- # PipeBatch = "fix_failing_batch_pipe"-- # [pipe.fix_failing_llm_pipe]- # type = "PipeLLM"- # definition = "Fix a failing PipeLLM spec based on its specific error."- # inputs = { pipelex_bundle_spec = "PipelexBundleSpec", pipe_failure = "PipeFailure" }- # output = "PipeLLMSpec"- # llm = "llm_to_engineer"- # prompt_template = """- # Fix this failing PipeLLM spec.-- # Failing pipe:- # @pipe_failure.pipe_spec-- # Error message:- # @pipe_failure.error_message-- # Please provide only the corrected PipeLLMSpec. Common LLM pipe issues to fix:- # - Missing input variables in the pipe inputs that are referenced in prompt_template- # - Incorrect variable names in prompt templates (use $ for inline, @ for blocks)- # - Wrong concept types for inputs/outputs- # - Missing llm configuration- # - Invalid prompt template syntax- # """-- # [pipe.fix_failing_imggen_pipe]- # type = "PipeLLM"- # definition = "Fix a failing PipeImgGen spec based on its specific error."- # inputs = { pipelex_bundle_spec = "PipelexBundleSpec", pipe_failure = "PipeFailure" }- # output = "PipeImgGenSpec"- # llm = "llm_to_engineer"- # prompt_template = """- # Fix this failing PipeImgGen spec.-- # Failing pipe:- # @pipe_failure.pipe_spec-- # Error message:- # @pipe_failure.error_message-- # Please provide only the corrected PipeImgGenSpec. Common ImgGen pipe issues to fix:- # - Missing or incorrect prompt input (should be text concept)- # - Invalid img_gen- # - Missing required inputs for dynamic prompt generation- # """-- # [pipe.fix_failing_ocr_pipe]- # type = "PipeLLM"- # definition = "Fix a failing PipeOcr spec based on its specific error."- # inputs = { pipelex_bundle_spec = "PipelexBundleSpec", pipe_failure = "PipeFailure" }- # output = "PipeOcrSpec"- # llm = "llm_to_engineer"- # prompt_template = """- # Fix this failing PipeOcr spec.-- # VERY IMPORTANT: THE INPUT OF THE PIPEOCR must be either an image or a pdf or a concept which refines one of them.- # Failing pipe:- # @pipe_failure.pipe_spec-- # Error message:- # @pipe_failure.error_message-- # Please provide only the corrected PipeOcrSpec. Common OCR pipe issues to fix:- # - Input must be of type Image or PDF- # - Output should typically be Page (native concept)- # - Missing or incorrect input concept types- # """-- # [pipe.fix_failing_func_pipe]- # type = "PipeLLM"- # definition = "Fix a failing PipeFunc spec based on its specific error."- # inputs = { pipelex_bundle_spec = "PipelexBundleSpec", pipe_failure = "PipeFailure" }- # output = "PipeFuncSpec"- # llm = "llm_to_engineer"- # prompt_template = """- # Fix this failing PipeFunc spec.-- # Failing pipe:- # @pipe_failure.pipe_spec-- # Error message:- # @pipe_failure.error_message-- # Please provide only the corrected PipeFuncSpec. Common Func pipe issues to fix:- # - Missing or incorrect function_name- # - Wrong input/output concept types for the function- # - Function not available in registry- # """-- # [pipe.fix_failing_jinja2_pipe]- # type = "PipeLLM"- # definition = "Fix a failing PipeCompose spec based on its specific error."- # inputs = { pipelex_bundle_spec = "PipelexBundleSpec", pipe_failure = "PipeFailure" }- # output = "PipeComposeSpec"- # llm = "llm_to_engineer"- # prompt_template = """- # Fix this failing PipeCompose spec.-- # Failing pipe:- # @pipe_failure.pipe_spec-- # Error message:- # @pipe_failure.error_message-- # Please provide only the corrected PipeComposeSpec. Common Jinja2 pipe issues to fix:- # - Invalid Jinja2 template syntax- # - Missing input variables referenced in template- # - Wrong concept types for inputs/outputs- # """-- # [pipe.fix_failing_sequence_pipe]- # type = "PipeLLM"- # definition = "Fix a failing PipeSequence spec based on its specific error."- # inputs = { pipelex_bundle_spec = "PipelexBundleSpec", pipe_failure = "PipeFailure" }- # output = "PipeSequenceSpec"- # llm = "llm_to_engineer"- # prompt_template = """- # Fix this failing PipeSequence spec.-- # Failing pipe:- # @pipe_failure.pipe_spec-- # Error message:- # @pipe_failure.error_message-- # Please provide only the corrected PipeSequenceSpec. Common Sequence pipe issues to fix:- # - Missing input variables needed by sub-pipes in steps- # - Referenced pipe codes in steps that don't exist- # - Circular dependencies in step order- # - Wrong result names in steps- # """-- # [pipe.fix_failing_parallel_pipe]- # type = "PipeLLM"- # definition = "Fix a failing PipeParallel spec based on its specific error."- # inputs = { pipelex_bundle_spec = "PipelexBundleSpec", pipe_failure = "PipeFailure" }- # output = "PipeParallelSpec"- # llm = "llm_to_engineer"- # prompt_template = """- # Fix this failing PipeParallel spec.-- # Failing pipe:- # @pipe_failure.pipe_spec-- # Error message:- # @pipe_failure.error_message-- # Please provide only the corrected PipeParallelSpec. Common Parallel pipe issues to fix:- # - Missing input variables needed by parallel sub-pipes- # - Referenced pipe codes that don't exist- # - Incompatible output types from parallel branches- # """-- # [pipe.fix_failing_condition_pipe]- # type = "PipeLLM"- # definition = "Fix a failing PipeCondition spec based on its specific error."- # inputs = { pipelex_bundle_spec = "PipelexBundleSpec", pipe_failure = "PipeFailure" }- # output = "PipeConditionSpec"- # llm = "llm_to_engineer"- # prompt_template = """- # Fix this failing PipeCondition spec.-- # Failing pipe:- # @pipe_failure.pipe_spec-- # Error message:- # @pipe_failure.error_message-- # Please provide only the corrected PipeConditionSpec. Common Condition pipe issues to fix:- # - Invalid expression or expression_template syntax- # - Referenced pipe codes in pipe_map that don't exist- # - Missing input variables referenced in expression- # - Incompatible output types from different condition branches- # """-- # [pipe.fix_failing_batch_pipe]- # type = "PipeLLM"- # definition = "Fix a failing PipeBatch spec based on its specific error."- # inputs = { pipelex_bundle_spec = "PipelexBundleSpec", pipe_failure = "PipeFailure" }- # output = "PipeBatchSpec"- # llm = "llm_to_engineer"- # prompt_template = """- # Fix this failing PipeBatch spec.-- # Failing pipe:- # @pipe_failure.pipe_spec-- # Error message:- # @pipe_failure.error_message-- # Please provide only the corrected PipeBatchSpec. Common Batch pipe issues to fix:- # - Missing branch_pipe_code or referenced pipe that doesn't exist- # - Wrong input types for batch processing (should be ListContent)- # - Missing batch parameters configuration- # """-