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.
output pipeline as json too
Louis Choqueld9c96e9178d8
diff --git a/pipelex/create/build_blueprint.py b/pipelex/create/build_blueprint.pyindex f786b6d4f..16af23a27 100644--- a/pipelex/create/build_blueprint.py+++ b/pipelex/create/build_blueprint.py@@ -1,6 +1,7 @@from __future__ import annotationsimport asyncio+from pathlib import Pathfrom typing import Annotated, Any, Dict, Optional, castimport typer@@ -17,6 +18,8 @@ from pipelex.pipe_works.pipe_dry import dry_run_pipe_codesfrom pipelex.pipelex import Pipelexfrom pipelex.pipeline.execute import execute_pipelinefrom pipelex.tools.misc.file_utils import load_text_from_path+from pipelex.tools.misc.json_utils import save_as_json_to_path+from pipelex.tools.misc.toml_utils import dict_to_toml_string, save_toml_to_pathfrom pipelex.tools.typing.pydantic_utils import format_pydantic_validation_error@@ -36,11 +39,12 @@ async def do_build_blueprint()blueprint = pipe_output.main_stuff_as(content_type=PipelineLibraryBlueprint)pretty_print(blueprint, title="Pipeline Blueprint")- pretty_print(blueprint.to_toml_dict(), title="Pipeline Blueprint (TOML)")# Save or display resultoutput_path = output_path or "pipelex/libraries/pipelines/temp/generated_blueprint.toml"- blueprint.save_to_file(output_path)+ save_toml_to_path(blueprint.smart_dump(), output_path)+ json_path = output_path.replace(Path(output_path).suffix, ".json")+ save_as_json_to_path(blueprint.smart_dump(), json_path)typer.echo(f"✅ Blueprint saved to '{output_path}'")if validate:diff --git a/pipelex/libraries/pipeline_blueprint.py b/pipelex/libraries/pipeline_blueprint.pyindex 6a5149baa..dab7a7e5b 100644--- a/pipelex/libraries/pipeline_blueprint.py+++ b/pipelex/libraries/pipeline_blueprint.py@@ -51,37 +51,3 @@ class PipelineLibraryBlueprint(StructuredContent):# Pipes section - pipe_name -> blueprint dictpipe: Dict[str, Dict[str, Any]] = Field(default_factory=dict)-- def to_toml_dict(self) -> Dict[str, Any]:- """Convert blueprint back to TOML-compatible dictionary structure."""- result: Dict[str, Any] = {"domain": self.domain}-- # Add optional domain-level fields- if self.definition:- result["definition"] = self.definition- if self.system_prompt:- result["system_prompt"] = self.system_prompt- if self.system_prompt_to_structure:- result["system_prompt_to_structure"] = self.system_prompt_to_structure- if self.prompt_template_to_structure:- result["prompt_template_to_structure"] = self.prompt_template_to_structure-- # Add concepts section if not empty- if self.concept:- result["concept"] = self.concept-- # Add pipes section if not empty- if self.pipe:- result["pipe"] = self.pipe-- return result-- def to_toml_string(self) -> str:- """Convert blueprint to TOML string format."""- return dict_to_toml_string(self.to_toml_dict())-- def save_to_file(self, file_path: Union[str, Path]) -> None:- """Save blueprint to a TOML file."""- path = Path(file_path)- path.parent.mkdir(parents=True, exist_ok=True)- save_toml_to_path(data=self.to_toml_dict(), path=str(path))