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.

Cleanup

Louis Choquel37edcfe89c05
diff --git a/pipelex/create/build_blueprint.py b/pipelex/create/build_blueprint.py
index 32722b91e..946f167ee 100644
--- a/pipelex/create/build_blueprint.py
+++ b/pipelex/create/build_blueprint.py
@@ -8,7 +8,7 @@ import typer
from pipelex import log, pretty_print
from pipelex.create.helpers import get_support_file
from pipelex.create.pipeline_toml import save_pipeline_blueprint_toml_to_path
-from pipelex.create.validate_blueprint import load_pipes_from_generated_blueprint, validate_loaded_blueprint
+from pipelex.create.validate_blueprint import load_pipes_from_generated_blueprint, validate_blueprint
from pipelex.exceptions import PipelexCLIError, StaticValidationError, StaticValidationErrorType
from pipelex.hub import get_library_manager, get_required_pipe
from pipelex.libraries.pipeline_blueprint import PipelineBlueprint
@@ -55,26 +55,4 @@ async def do_build_blueprint(
log.info("✅ Pipes loaded from blueprint")
if validate:
- try:
- await validate_loaded_blueprint(blueprint=blueprint)
- except StaticValidationError as static_validation_error:
- match static_validation_error.error_type:
- case StaticValidationErrorType.MISSING_INPUT_VARIABLE:
- pipe_code = static_validation_error.pipe_code
- if not pipe_code:
- raise PipelexCLIError(f"No pipe code found for static validation error: {static_validation_error}")
- pipe = get_required_pipe(pipe_code=pipe_code)
- if isinstance(pipe, PipeController):
- log.error(f"❌ Validation failed:\n{static_validation_error}")
- log.error(f"❌ Missing input variable: {static_validation_error.variable_names}")
- log.error(f"❌ Provided concept code: {static_validation_error.provided_concept_code}")
- log.error(f"❌ File path: {static_validation_error.file_path}")
- case _:
- raise static_validation_error
-
-
-# def recap_inputs_for_controller_pipes(blueprint: PipelineBlueprint) -> None:
-# pipe_codes = list(blueprint.pipe.keys())
-# for pipe_code in pipe_codes:
-# pipe = get_required_pipe(pipe_code=pipe_code)
-# if isinstance(pipe, PipeController):
+ await validate_blueprint(blueprint=blueprint, is_error_fixing_enabled=True)
diff --git a/pipelex/create/validate_blueprint.py b/pipelex/create/validate_blueprint.py
index be7144207..6b7be0a8d 100644
--- a/pipelex/create/validate_blueprint.py
+++ b/pipelex/create/validate_blueprint.py
@@ -19,12 +19,6 @@ async def validate_blueprint(blueprint: PipelineBlueprint, is_error_fixing_enabl
except PipeDefinitionError as exc:
raise PipelexCLIError(f"Failed to load pipes from blueprint for domain '{blueprint.desc}': {exc}") from exc
- # try:
- # await validate_loaded_blueprint(blueprint=blueprint)
- # except StaticValidationError as exc:
- # # raise PipelexCLIError(f"Validation failed:\n{exc}") from exc
- # log.error(f"❌ Validation failed:\n{exc}")
-
try:
await validate_loaded_blueprint(blueprint=blueprint)
except StaticValidationError as static_validation_error:
@@ -36,8 +30,6 @@ async def validate_blueprint(blueprint: PipelineBlueprint, is_error_fixing_enabl
raise PipelexCLIError(f"No pipe code found for static validation error: {static_validation_error}")
pipe = get_required_pipe(pipe_code=pipe_code)
if isinstance(pipe, PipeController):
- # log.error(f"❌ Validation failed:\n{static_validation_error}")
- # log.error(f"❌ Missing input variable: {static_validation_error.variable_names}")
variable_names = static_validation_error.variable_names
required_concept_codes = static_validation_error.required_concept_codes
if not variable_names:
@@ -55,7 +47,11 @@ async def validate_blueprint(blueprint: PipelineBlueprint, is_error_fixing_enabl
raise PipelexCLIError(f"Unexpected validation error:\n{static_validation_error}") from static_validation_error
else:
raise static_validation_error
- case _:
+ case (
+ StaticValidationErrorType.EXTRANEOUS_INPUT_VARIABLE
+ | StaticValidationErrorType.INADEQUATE_INPUT_CONCEPT
+ | StaticValidationErrorType.TOO_MANY_CANDIDATE_INPUTS
+ ):
raise static_validation_error
log.info("✅ Validation passed")
@@ -84,16 +80,6 @@ def load_pipes_from_generated_blueprint(blueprint: PipelineBlueprint, updates_al
for pipe_code, details in blueprint.pipe.items():
details_dict: Dict[str, Any] = details.copy()
- # Build the concrete PipeBlueprint via LibraryManager helper
- # try:
- # pipe_blueprint = LibraryManager.make_pipe_blueprint_from_details(
- # domain_code=domain_code,
- # details_dict=details_dict,
- # )
- # except ValidationError as exc:
- # error_msg = format_pydantic_validation_error(exc=exc)
- # raise PipeDefinitionError(f"Failed to build pipe blueprint for pipe '{pipe_code}': {error_msg}\n{exc}") from exc
-
pipe_blueprint = LibraryManager.make_pipe_blueprint_from_details(
domain_code=domain_code,
details_dict=details_dict,