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.
Fix/validation error (#432)
Thomas Hebrardd52bc19ddfcc
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 19d87e547..cebc7dd15 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,13 @@# Changelog+## Unreleased -++### Refactor++- Organized all exceptions specific folders.+- Added Value error to blueprints.+- Removed usedless exceptions.+## [v0.15.3] - 2025-11-07### Fixeddiff --git a/pipelex/base_exceptions.py b/pipelex/base_exceptions.pynew file mode 100644index 000000000..17992f133--- /dev/null+++ b/pipelex/base_exceptions.py@@ -0,0 +1,20 @@+class RootException(Exception):+ def __init__(self, message: str):+ super().__init__(message)+ self.message = message+++class PipelexException(RootException):+ pass+++class PipelexUnexpectedError(PipelexException):+ pass+++class PipelexConfigError(PipelexException):+ pass+++class PipelexSetupError(PipelexException):+ passdiff --git a/pipelex/builder/builder.py b/pipelex/builder/builder.pyindex 7d4412a18..c27013430 100644--- a/pipelex/builder/builder.py+++ b/pipelex/builder/builder.py@@ -5,13 +5,13 @@ from pydantic import ValidationErrorfrom pipelex import pretty_printfrom pipelex.builder.builder_errors import (PipeBuilderError,- PipelexBundleError,PipelexBundleUnexpectedError,)from pipelex.builder.builder_validation import validate_dry_run_bundle_blueprintfrom pipelex.builder.bundle_header_spec import BundleHeaderSpecfrom pipelex.builder.bundle_spec import PipelexBundleSpecfrom pipelex.builder.concept.concept_spec import ConceptSpec+from pipelex.builder.exceptions import PipelexBundleErrorfrom pipelex.builder.pipe.pipe_batch_spec import PipeBatchSpecfrom pipelex.builder.pipe.pipe_compose_spec import PipeComposeSpecfrom pipelex.builder.pipe.pipe_condition_spec import PipeConditionSpec@@ -27,9 +27,9 @@ from pipelex.builder.pipe.pipe_spec_union import PipeSpecUnionfrom pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprintfrom pipelex.core.interpreter import PipelexInterpreterfrom pipelex.core.memory.working_memory import WorkingMemory+from pipelex.core.stuffs.exceptions import StuffContentTypeErrorfrom pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.structured_content import StructuredContent-from pipelex.exceptions import StuffContentTypeErrorfrom pipelex.system.registries.func_registry import pipe_funcfrom pipelex.tools.typing.pydantic_utils import format_pydantic_validation_error@@ -135,33 +135,6 @@ def reconstruct_bundle_with_pipe_fixes(pipelex_bundle_spec: PipelexBundleSpec, freturn pipelex_bundle_spec-async def reconstruct_bundle_with_all_fixes(working_memory: WorkingMemory) -> PipelexBundleSpec:- pipelex_bundle_spec = working_memory.get_stuff_as(name="pipelex_bundle_spec", content_type=PipelexBundleSpec)- if fixed_pipes := working_memory.get_optional_stuff(name="fixed_pipes"):- fixed_pipes_list = cast("ListContent[PipeSpecUnion]", fixed_pipes.content)-- if not pipelex_bundle_spec.pipe:- msg = "No pipes section found in bundle spec"- raise PipeBuilderError(msg)-- for fixed_pipe_blueprint in fixed_pipes_list.items:- pipe_code = fixed_pipe_blueprint.pipe_code- pipelex_bundle_spec.pipe[pipe_code] = fixed_pipe_blueprint-- if fixed_concepts := working_memory.get_optional_stuff(name="fixed_concepts"):- fixed_concepts_list = cast("ListContent[ConceptSpec]", fixed_concepts.content)-- if not pipelex_bundle_spec.concept:- msg = "No concepts section found in bundle spec"- raise PipeBuilderError(msg)-- for fixed_concept_blueprint in fixed_concepts_list.items:- concept_code = fixed_concept_blueprint.the_concept_code- pipelex_bundle_spec.concept[concept_code] = fixed_concept_blueprint-- return pipelex_bundle_spec--async def load_and_validate_bundle(bundle_path: str) -> PipelexBundleBlueprint:"""Load a bundle file and extract its main_pipe.diff --git a/pipelex/builder/builder_errors.py b/pipelex/builder/builder_errors.pyindex 79457e77d..186538b9a 100644--- a/pipelex/builder/builder_errors.py+++ b/pipelex/builder/builder_errors.py@@ -1,42 +1,11 @@-from typing_extensions import override--from pipelex.builder.pipe.pipe_batch_spec import PipeBatchSpec-from pipelex.builder.pipe.pipe_compose_spec import PipeComposeSpec-from pipelex.builder.pipe.pipe_condition_spec import PipeConditionSpec-from pipelex.builder.pipe.pipe_extract_spec import PipeExtractSpec-from pipelex.builder.pipe.pipe_func_spec import PipeFuncSpec-from pipelex.builder.pipe.pipe_img_gen_spec import PipeImgGenSpec-from pipelex.builder.pipe.pipe_llm_spec import PipeLLMSpec-from pipelex.builder.pipe.pipe_parallel_spec import PipeParallelSpec-from pipelex.builder.pipe.pipe_sequence_spec import PipeSequenceSpec+from pipelex.base_exceptions import PipelexExceptionfrom pipelex.builder.validation_error_data import (- ConceptDefinitionErrorData,ConceptFailure,- DomainFailure,- PipeDefinitionErrorData,PipeFailure,- PipeInputErrorData,- PipelexBundleErrorData,- StaticValidationErrorData,)from pipelex.core.memory.working_memory import WorkingMemory-from pipelex.core.validation_errors import PipelexValidationExceptionAbstract-from pipelex.exceptions import PipelexExceptionfrom pipelex.types import Self-# Type alias for pipe spec union-PipeSpecUnion = (- PipeFuncSpec- | PipeImgGenSpec- | PipeComposeSpec- | PipeLLMSpec- | PipeExtractSpec- | PipeBatchSpec- | PipeConditionSpec- | PipeParallelSpec- | PipeSequenceSpec-)-class PipeBuilderError(Exception):def __init__(self: Self, message: str, working_memory: WorkingMemory | None = None) -> None:@@ -51,10 +20,6 @@ class ConceptSpecError(PipelexException):self.concept_failure = concept_failuresuper().__init__(message)- def as_structured_content(self: Self) -> ConceptFailure:- """Return the concept failure as structured content."""- return self.concept_failure-class PipeSpecError(PipelexException):"""Details of a single pipe failure during dry run."""@@ -63,57 +28,11 @@ class PipeSpecError(PipelexException):self.pipe_failure = pipe_failuresuper().__init__(message)- def as_structured_content(self: Self) -> PipeFailure:- """Return the pipe failure as structured content."""- return self.pipe_failure-class ValidateDryRunError(Exception):"""Raised when validating the dry run of a pipe."""-class PipelexBundleError(PipelexException, PipelexValidationExceptionAbstract):- """Main bundle error that aggregates multiple types of errors."""-- def __init__(- self: Self,- message: str,- static_validation_error: StaticValidationErrorData | None = None,- domain_failures: list[DomainFailure] | None = None,- pipe_failures: list[PipeFailure] | None = None,- concept_failures: list[ConceptFailure] | None = None,- concept_definition_errors: list[ConceptDefinitionErrorData] | None = None,- pipe_definition_errors: list[PipeDefinitionErrorData] | None = None,- pipe_input_errors: list[PipeInputErrorData] | None = None,- ) -> None:- self.static_validation_error = static_validation_error- self.domain_failures = domain_failures- self.pipe_input_errors = pipe_input_errors- self.pipe_failures = pipe_failures- self.concept_failures = concept_failures- self.concept_definition_errors = concept_definition_errors- self.pipe_definition_errors = pipe_definition_errors- super().__init__(message)-- @override- def get_concept_definition_errors(self: Self) -> list[ConceptDefinitionErrorData]:- """Get concept definition errors."""- return self.concept_definition_errors or []-- def as_structured_content(self: Self) -> PipelexBundleErrorData:- """Convert the error to structured content."""- return PipelexBundleErrorData(- message=str(self),- static_validation_error=self.static_validation_error,- domain_failures=self.domain_failures,- pipe_input_errors=self.pipe_input_errors,- pipe_failures=self.pipe_failures,- concept_failures=self.concept_failures,- concept_definition_errors=self.concept_definition_errors,- pipe_definition_errors=self.pipe_definition_errors,- )--class PipelexBundleNoFixForError(PipelexException):"""Raised when no fix is found for a static validation error."""diff --git a/pipelex/builder/builder_loop.py b/pipelex/builder/builder_loop.pyindex cd7318a71..29e69128f 100644--- a/pipelex/builder/builder_loop.py+++ b/pipelex/builder/builder_loop.py@@ -8,16 +8,18 @@ from pipelex.builder.builder import ()from pipelex.builder.builder_errors import (PipeBuilderError,- PipelexBundleError,PipelexBundleNoFixForError,PipelexBundleUnexpectedError,)from pipelex.builder.builder_validation import fix_inputs_consistency, validate_bundle_spec+from pipelex.builder.exceptions import PipelexBundleErrorfrom pipelex.client.protocol import PipelineInputs+from pipelex.core.memory.exceptions import WorkingMemoryStuffNotFoundError+from pipelex.core.pipes.exceptions import StaticValidationErrorTypefrom pipelex.core.pipes.pipe_blueprint import AllowedPipeCategories-from pipelex.exceptions import PipelineExecutionError, StaticValidationErrorType, WorkingMemoryStuffNotFoundErrorfrom pipelex.hub import get_required_pipefrom pipelex.language.plx_factory import PlxFactory+from pipelex.pipeline.exceptions import PipelineExecutionErrorfrom pipelex.pipeline.execute import execute_pipelinefrom pipelex.tools.misc.file_utils import get_incremental_file_path, save_text_to_pathfrom pipelex.tools.misc.json_utils import save_as_json_to_path@@ -73,7 +75,6 @@ class BuilderLoop:pipelex_bundle_spec = fix_inputs_consistency(bundle_spec=pipelex_bundle_spec)except PipelexBundleError as bundle_error:# Let the error fall through to the existing error handling- pretty_print(bundle_error.as_structured_content(), title="Pipelex Bundle Error (during input fix)")pipelex_bundle_spec = self._fix_bundle_error(bundle_error=bundle_error,pipelex_bundle_spec=pipelex_bundle_spec,@@ -93,7 +94,6 @@ class BuilderLoop:try:await validate_bundle_spec(bundle_spec=pipelex_bundle_spec)except PipelexBundleError as bundle_error:- pretty_print(bundle_error.as_structured_content(), title="Pipelex Bundle Error")pipelex_bundle_spec = self._fix_bundle_error(bundle_error=bundle_error,pipelex_bundle_spec=pipelex_bundle_spec,diff --git a/pipelex/builder/builder_validation.py b/pipelex/builder/builder_validation.pyindex a2e25ae3c..fdf383416 100644--- a/pipelex/builder/builder_validation.py+++ b/pipelex/builder/builder_validation.py@@ -1,38 +1,32 @@from pipelex import logfrom pipelex.builder.builder_errors import (- ConceptDefinitionErrorData,ConceptSpecError,- DomainFailure,- PipeDefinitionErrorData,PipeFailure,- PipeInputErrorData,- PipelexBundleError,PipelexBundleUnexpectedError,PipeSpecError,- StaticValidationErrorData,ValidateDryRunError,)from pipelex.builder.bundle_spec import PipelexBundleSpec+from pipelex.builder.exceptions import PipelexBundleErrorfrom pipelex.builder.pipe.pipe_spec_map import pipe_type_to_spec_class+from pipelex.builder.validation_error_data import DomainFailure, PipeInputErrorData, StaticValidationErrorDatafrom pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprint-from pipelex.core.memory.working_memory import WorkingMemory+from pipelex.core.concepts.exceptions import (+ ConceptDefinitionErrorData,+)+from pipelex.core.exceptions import StaticValidationError+from pipelex.core.pipes.exceptions import PipeInputErrorfrom pipelex.core.pipes.pipe_blueprint import AllowedPipeCategories-from pipelex.exceptions import (+from pipelex.hub import get_library_manager, get_required_pipe+from pipelex.libraries.exceptions import (ConceptLoadingError,DomainLoadingError,- PipeInputError,+ PipeDefinitionErrorData,PipeLoadingError,- StaticValidationError,)-from pipelex.hub import get_library_manager, get_required_pipefrom pipelex.pipe_run.dry_run import DryRunOutput, dry_run_pipes-async def validate_bundle_spec_from_memory(working_memory: WorkingMemory):- pipelex_bundle_spec = working_memory.get_stuff_as(name="pipelex_bundle_spec", content_type=PipelexBundleSpec)- await validate_bundle_spec(bundle_spec=pipelex_bundle_spec)--def fix_inputs_consistency(bundle_spec: PipelexBundleSpec) -> PipelexBundleSpec:"""Proactively fix input declarations for all PipeController pipes.diff --git a/pipelex/builder/bundle_spec.py b/pipelex/builder/bundle_spec.pyindex f0dc950c0..a198c5a59 100644--- a/pipelex/builder/bundle_spec.py+++ b/pipelex/builder/bundle_spec.py@@ -9,15 +9,16 @@ from pipelex.builder.builder_errors import (ConceptSpecError,PipeBuilderError,PipeFailure,- PipelexBundleError,PipeSpecError,)from pipelex.builder.concept.concept_spec import ConceptSpec+from pipelex.builder.exceptions import PipelexBundleError, PipelexBundleSpecValueErrorfrom pipelex.builder.pipe.pipe_spec_union import PipeSpecUnionfrom pipelex.core.bundles.pipe_sorter import sort_pipes_by_dependenciesfrom pipelex.core.bundles.pipelex_bundle_blueprint import PipeBlueprintUnion, PipelexBundleBlueprintfrom pipelex.core.concepts.concept_blueprint import ConceptBlueprint-from pipelex.core.domains.domain_blueprint import DomainBlueprint+from pipelex.core.domains.exceptions import DomainCodeError+from pipelex.core.domains.validation import validate_domain_codefrom pipelex.core.stuffs.structured_content import StructuredContentfrom pipelex.tools.misc.pretty import PrettyPrintablefrom pipelex.tools.typing.pydantic_utils import format_pydantic_validation_error@@ -67,7 +68,11 @@ class PipelexBundleSpec(StructuredContent):@field_validator("domain", mode="before")@classmethoddef validate_domain_syntax(cls, domain: str) -> str:- DomainBlueprint.validate_domain_code(code=domain)+ try:+ validate_domain_code(code=domain)+ except DomainCodeError as exc:+ msg = f"Error when trying to validate pipelex bundle spec: domain '{domain}' is not a valid domain code: {exc}"+ raise PipelexBundleSpecValueError(msg) from excreturn domain@model_validator(mode="after")diff --git a/pipelex/builder/concept/concept_spec.py b/pipelex/builder/concept/concept_spec.pyindex 2fbd7f1d0..0a4f9f272 100644--- a/pipelex/builder/concept/concept_spec.py+++ b/pipelex/builder/concept/concept_spec.py@@ -1,4 +1,3 @@-import refrom datetime import datetimefrom typing import Any@@ -9,16 +8,10 @@ from rich.text import Textfrom typing_extensions import overridefrom pipelex import log-from pipelex.core.concepts.concept_blueprint import (- ConceptBlueprint,- ConceptBlueprintError,- ConceptStructureBlueprint,- ConceptStructureBlueprintError,- ConceptStructureBlueprintFieldType,-)+from pipelex.core.concepts.concept_blueprint import ConceptBlueprint, ConceptStructureBlueprintfrom pipelex.core.concepts.concept_native import NativeConceptCode-from pipelex.core.concepts.exceptions import ConceptCodeError, ConceptStringOrConceptCodeError-from pipelex.core.domains.domain_blueprint import DomainBlueprint+from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprintFieldType+from pipelex.core.concepts.exceptions import ConceptBlueprintValueError, ConceptStructureBlueprintValueErrorfrom pipelex.core.stuffs.structured_content import StructuredContentfrom pipelex.tools.misc.pretty import PrettyPrintablefrom pipelex.tools.misc.string_utils import is_pascal_case, normalize_to_ascii, snake_to_pascal_case@@ -101,7 +94,7 @@ class ConceptStructureSpec(StructuredContent):def _raise_type_mismatch_error(self, expected_type_name: str, actual_type_name: str) -> None:msg = f"default_value type mismatch: expected {expected_type_name} for type '{self.type}', but got {actual_type_name}"- raise ConceptStructureBlueprintError(msg)+ raise ConceptStructureBlueprintValueError(msg)def to_blueprint(self) -> ConceptStructureBlueprint:# Convert the type enum value - self.type is already a ConceptStructureBlueprintFieldType enum@@ -202,7 +195,7 @@ class ConceptSpec(StructuredContent):if refines is not None:if not NativeConceptCode.get_validated_native_concept_string(concept_string_or_code=refines):msg = f"Forbidden to refine a non-native concept: '{refines}'. Refining non-native concepts will come soon."- raise ConceptBlueprintError(msg)+ raise ConceptBlueprintValueError(msg)return refines@model_validator(mode="before")@@ -216,43 +209,6 @@ class ConceptSpec(StructuredContent):raise ConceptSpecError(msg)return values- @classmethod- def _post_validate_concept_code(cls, concept_code: str) -> None:- if not is_pascal_case(concept_code):- msg = (- f"ConceptSpec _post_validate_concept_code: Concept code '{concept_code}' must be PascalCase "- f"(letters and numbers only, starting with uppercase, without `.`)"- )- raise ConceptCodeError(msg)-- @classmethod- def validate_concept_string_or_code(cls, concept_string_or_code: str) -> None:- # Strip multiplicity brackets if present (e.g., 'Text[]' or 'Text[2]' -> 'Text')-- multiplicity_pattern = r"^(.+?)(?:\[\d*\])?$"- match = re.match(multiplicity_pattern, concept_string_or_code)- if not match:- msg = f"Invalid concept string format: '{concept_string_or_code}'"- raise ConceptStringOrConceptCodeError(msg)-- concept_without_multiplicity = match.group(1)-- if concept_without_multiplicity.count(".") > 1:- msg = (- f"concept_string_or_code '{concept_without_multiplicity}' is invalid. "- "It should either contain a domain in snake_case and a concept code in PascalCase separated by one dot, "- "or be a concept code in PascalCase."- )- raise ConceptStringOrConceptCodeError(msg)-- if concept_without_multiplicity.count(".") == 1:- domain, concept_code = concept_without_multiplicity.split(".")- # Validate domain code- DomainBlueprint.validate_domain_code(code=domain)- cls._post_validate_concept_code(concept_code=concept_code)- else:- cls._post_validate_concept_code(concept_code=concept_without_multiplicity)-def to_blueprint(self) -> ConceptBlueprint:"""Convert this ConceptBlueprint to the original core ConceptBlueprint."""# TODO: Clarify concept structure blueprintdiff --git a/pipelex/builder/exceptions.py b/pipelex/builder/exceptions.pynew file mode 100644index 000000000..c1313b375--- /dev/null+++ b/pipelex/builder/exceptions.py@@ -0,0 +1,43 @@+from typing_extensions import Self, override++from pipelex.builder.validation_error_data import (+ ConceptFailure,+ DomainFailure,+ PipeFailure,+ PipeInputErrorData,+ StaticValidationErrorData,+)+from pipelex.core.concepts.exceptions import ConceptDefinitionErrorData, PipelexValidationExceptionAbstract+from pipelex.core.pipes.exceptions import PipeDefinitionErrorData+++class PipelexBundleSpecValueError(ValueError):+ pass+++class PipelexBundleError(PipelexValidationExceptionAbstract):+ """Main bundle error that aggregates multiple types of errors."""++ def __init__(+ self: Self,+ message: str,+ static_validation_error: StaticValidationErrorData | None = None,+ domain_failures: list[DomainFailure] | None = None,+ pipe_failures: list[PipeFailure] | None = None,+ concept_failures: list[ConceptFailure] | None = None,+ concept_definition_errors: list[ConceptDefinitionErrorData] | None = None,+ pipe_definition_errors: list[PipeDefinitionErrorData] | None = None,+ pipe_input_errors: list[PipeInputErrorData] | None = None,+ ) -> None:+ self.static_validation_error = static_validation_error+ self.domain_failures = domain_failures+ self.pipe_input_errors = pipe_input_errors+ self.pipe_failures = pipe_failures+ self.concept_failures = concept_failures+ self.concept_definition_errors = concept_definition_errors+ self.pipe_definition_errors = pipe_definition_errors+ super().__init__(message)++ @override+ def get_concept_definition_errors(self) -> list[ConceptDefinitionErrorData]:+ return self.concept_definition_errors or []diff --git a/pipelex/builder/flow.py b/pipelex/builder/flow.pyindex 688217492..b6d04d4c9 100644--- a/pipelex/builder/flow.py+++ b/pipelex/builder/flow.py@@ -1,8 +1,8 @@from pydantic import ConfigDict, Field, model_validator+from pipelex.base_exceptions import PipelexExceptionfrom pipelex.builder.pipe.pipe_signature import PipeSignaturefrom pipelex.core.stuffs.structured_content import StructuredContent-from pipelex.exceptions import PipelexExceptionfrom pipelex.pipe_controllers.batch.pipe_batch_blueprint import PipeBatchBlueprintfrom pipelex.pipe_controllers.condition.pipe_condition_blueprint import PipeConditionBlueprintfrom pipelex.pipe_controllers.parallel.pipe_parallel_blueprint import PipeParallelBlueprintdiff --git a/pipelex/builder/flow_factory.py b/pipelex/builder/flow_factory.pyindex ceea24421..dfcc43503 100644--- a/pipelex/builder/flow_factory.py+++ b/pipelex/builder/flow_factory.py@@ -2,13 +2,13 @@ from pathlib import Pathfrom typing import Anyfrom pipelex import log+from pipelex.base_exceptions import PipelexExceptionfrom pipelex.builder.builder import PipelexBundleSpecfrom pipelex.builder.flow import Flow, FlowElementfrom pipelex.builder.pipe.pipe_signature import PipeSignaturefrom pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprintfrom pipelex.core.interpreter import PipelexInterpreterfrom pipelex.core.pipes.pipe_blueprint import AllowedPipeCategories-from pipelex.exceptions import PipelexExceptionfrom pipelex.pipe_controllers.batch.pipe_batch_blueprint import PipeBatchBlueprintfrom pipelex.pipe_controllers.condition.pipe_condition_blueprint import PipeConditionBlueprintfrom pipelex.pipe_controllers.parallel.pipe_parallel_blueprint import PipeParallelBlueprintdiff --git a/pipelex/builder/pipe/pipe_parallel_spec.py b/pipelex/builder/pipe/pipe_parallel_spec.pyindex 7f0cf570f..5fff49735 100644--- a/pipelex/builder/pipe/pipe_parallel_spec.py+++ b/pipelex/builder/pipe/pipe_parallel_spec.py@@ -6,10 +6,10 @@ from rich.table import Tablefrom rich.text import Textfrom typing_extensions import override-from pipelex.builder.concept.concept_spec import ConceptSpecfrom pipelex.builder.pipe.pipe_spec import PipeSpecfrom pipelex.builder.pipe.pipe_spec_exceptions import PipeParallelSpecErrorfrom pipelex.builder.pipe.sub_pipe_spec import SubPipeSpec+from pipelex.core.concepts.validation import validate_concept_string_or_codefrom pipelex.pipe_controllers.parallel.pipe_parallel_blueprint import PipeParallelBlueprintfrom pipelex.tools.misc.pretty import PrettyPrintablefrom pipelex.types import Self@@ -40,7 +40,7 @@ class PipeParallelSpec(PipeSpec):@classmethoddef validate_combined_output(cls, combined_output: str) -> str:if combined_output:- ConceptSpec.validate_concept_string_or_code(concept_string_or_code=combined_output)+ validate_concept_string_or_code(concept_string_or_code=combined_output)return combined_output@model_validator(mode="after")diff --git a/pipelex/builder/pipe/pipe_signature.py b/pipelex/builder/pipe/pipe_signature.pyindex 5f0f87f4a..9649f9361 100644--- a/pipelex/builder/pipe/pipe_signature.py+++ b/pipelex/builder/pipe/pipe_signature.py@@ -7,7 +7,7 @@ from rich.table import Tablefrom rich.text import Textfrom typing_extensions import override-from pipelex.core.pipes.exceptions import PipeBlueprintError+from pipelex.core.pipes.exceptions import PipeBlueprintValueErrorfrom pipelex.core.pipes.pipe_blueprint import AllowedPipeCategories, AllowedPipeTypesfrom pipelex.core.stuffs.structured_content import StructuredContentfrom pipelex.tools.misc.pretty import PrettyPrintable@@ -57,7 +57,7 @@ class PipeSignature(StructuredContent):type_str = values["type"]except TypeError as exc:msg = f"Invalid type for '{values}': could not get subscript, required for 'type'"- raise PipeBlueprintError(msg) from exc+ raise PipeBlueprintValueError(msg) from exc# we need to convert the type string to the AllowedPipeTypes enum because it arrives as a str implictly converted to enum but not yetthe_type = AllowedPipeTypes(type_str)values["pipe_category"] = the_type.categorydiff --git a/pipelex/builder/pipe/pipe_spec.py b/pipelex/builder/pipe/pipe_spec.pyindex f33f246b0..fab73d608 100644--- a/pipelex/builder/pipe/pipe_spec.py+++ b/pipelex/builder/pipe/pipe_spec.py@@ -8,10 +8,10 @@ from rich.text import Textfrom typing_extensions import overridefrom pipelex import log-from pipelex.builder.concept.concept_spec import ConceptSpec-from pipelex.core.pipes.exceptions import PipeBlueprintError+from pipelex.core.concepts.validation import validate_concept_string_or_code+from pipelex.core.pipes.exceptions import PipeBlueprintValueErrorfrom pipelex.core.pipes.pipe_blueprint import AllowedPipeCategories, AllowedPipeTypes, PipeBlueprint-from pipelex.core.pipes.variable_multiplicity import parse_concept_with_multiplicity+from pipelex.core.pipes.variable_multiplicity import MUTLIPLICITY_PATTERN, parse_concept_with_multiplicityfrom pipelex.core.stuffs.structured_content import StructuredContentfrom pipelex.tools.misc.pretty import PrettyPrintablefrom pipelex.tools.misc.string_utils import is_snake_case, normalize_to_ascii@@ -73,7 +73,7 @@ class PipeSpec(StructuredContent):def validate_pipe_type(cls, value: Any) -> Any:if value not in AllowedPipeTypes.value_list():msg = f"Invalid pipe type '{value}'. Must be one of: {AllowedPipeTypes.value_list()}"- raise PipeBlueprintError(msg)+ raise PipeBlueprintValueError(msg)return value@field_validator("output", mode="after")@@ -81,7 +81,7 @@ class PipeSpec(StructuredContent):def validate_output(cls, output: str) -> str:# Extract concept without multiplicity for validationparse_result = parse_concept_with_multiplicity(output)- ConceptSpec.validate_concept_string_or_code(concept_string_or_code=parse_result.concept)+ validate_concept_string_or_code(concept_string_or_code=parse_result.concept)return output # Return original with brackets intact@field_validator("inputs", mode="after")@@ -91,12 +91,12 @@ class PipeSpec(StructuredContent):return None# Pattern allows: ConceptName, domain.ConceptName, ConceptName[], ConceptName[N]- multiplicity_pattern = r"^([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)?)(?:\[(\d*)\])?$"+ multiplicity_pattern = MUTLIPLICITY_PATTERNfor input_name, concept_spec in inputs.items():if not is_snake_case(input_name):msg = f"Invalid input name syntax '{input_name}'. Must be in snake_case."- raise PipeBlueprintError(msg)+ raise PipeBlueprintValueError(msg)# Validate the concept spec format with optional multiplicity bracketsmatch = re.match(multiplicity_pattern, concept_spec)@@ -105,11 +105,11 @@ class PipeSpec(StructuredContent):f"Invalid input syntax for '{input_name}': '{concept_spec}'. "f"Expected format: 'ConceptName', 'ConceptName[]', or 'ConceptName[N]' where N is an integer.")- raise PipeBlueprintError(msg)+ raise PipeBlueprintValueError(msg)# Extract the concept part (without multiplicity) and validate itconcept_string_or_code = match.group(1)- ConceptSpec.validate_concept_string_or_code(concept_string_or_code=concept_string_or_code)+ validate_concept_string_or_code(concept_string_or_code=concept_string_or_code)return inputs@@ -123,7 +123,7 @@ class PipeSpec(StructuredContent):if not is_snake_case(normalized_pipe_code):msg = f"Invalid pipe code syntax '{normalized_pipe_code}'. Must be in snake_case."- raise PipeBlueprintError(msg)+ raise PipeBlueprintValueError(msg)return normalized_pipe_codedef to_blueprint(self) -> PipeBlueprint:diff --git a/pipelex/builder/validation_error_data.py b/pipelex/builder/validation_error_data.pyindex 01d17d2d8..05d14fcbc 100644--- a/pipelex/builder/validation_error_data.py+++ b/pipelex/builder/validation_error_data.py@@ -10,36 +10,8 @@ from pipelex.builder.pipe.pipe_img_gen_spec import PipeImgGenSpecfrom pipelex.builder.pipe.pipe_llm_spec import PipeLLMSpecfrom pipelex.builder.pipe.pipe_parallel_spec import PipeParallelSpecfrom pipelex.builder.pipe.pipe_sequence_spec import PipeSequenceSpec+from pipelex.core.pipes.exceptions import StaticValidationErrorTypefrom pipelex.core.stuffs.structured_content import StructuredContent-from pipelex.types import StrEnum---class StaticValidationErrorType(StrEnum):- MISSING_INPUT_VARIABLE = "missing_input_variable"- EXTRANEOUS_INPUT_VARIABLE = "extraneous_input_variable"- INADEQUATE_INPUT_CONCEPT = "inadequate_input_concept"- TOO_MANY_CANDIDATE_INPUTS = "too_many_candidate_inputs"---class SyntaxErrorData(StructuredContent):- message: str- lineno: int | None = None- offset: int | None = None- text: str | None = None- end_lineno: int | None = None- end_offset: int | None = None-- @classmethod- def from_syntax_error(cls, syntax_error: SyntaxError) -> "SyntaxErrorData":- return cls(- message=syntax_error.msg,- lineno=syntax_error.lineno,- offset=syntax_error.offset,- text=syntax_error.text,- end_lineno=syntax_error.end_lineno,- end_offset=syntax_error.end_offset,- )-# ============================================================================# BaseModel (StructuredContent) versions of error information@@ -59,28 +31,6 @@ class StaticValidationErrorData(StructuredContent):explanation: str | None = Field(None, description="Additional explanation of the error")-class ConceptDefinitionErrorData(StructuredContent):- """Structured data for ConceptDefinitionError."""-- message: str = Field(description="The error message")- domain_code: str = Field(description="The domain code")- concept_code: str = Field(description="The concept code")- description: str = Field(description="Description of the concept")- structure_class_python_code: str | None = Field(None, description="Python code for the structure class if available")- structure_class_syntax_error_data: SyntaxErrorData | None = Field(None, description="Syntax error data for the structure class if available")- source: str | None = Field(None, description="Source of the error")---class PipeDefinitionErrorData(StructuredContent):- """Structured data for PipeDefinitionError."""-- message: str = Field(description="The error message")- domain_code: str | None = Field(None, description="The domain code")- pipe_code: str | None = Field(None, description="The pipe code")- description: str | None = Field(None, description="Description of the pipe")- source: str | None = Field(None, description="Source of the error")--class PipeInputErrorData(StructuredContent):"""Structured data for PipeInputError."""@@ -119,24 +69,3 @@ class PipeFailure(StructuredContent):| PipeSequenceSpec) = Field(description="The failing pipe spec with pipe code")error_message: str = Field(description="The error message for this pipe")---class LibraryLoadingErrorData(StructuredContent):- """Structured data for LibraryLoadingError."""-- message: str = Field(description="The main error message")- concept_definition_errors: list[ConceptDefinitionErrorData] | None = Field(None, description="List of concept definition errors")- pipe_definition_errors: list[PipeDefinitionErrorData] | None = Field(None, description="List of pipe definition errors")---class PipelexBundleErrorData(StructuredContent):- """Structured data for PipelexBundleError."""-- message: str = Field(description="The main error message")- static_validation_error: StaticValidationErrorData | None = Field(None, description="Static validation error if present")- domain_failures: list[DomainFailure] | None = Field(None, description="List of domain failures")- pipe_input_errors: list[PipeInputErrorData] | None = Field(None, description="List of pipe input errors")- pipe_failures: list[PipeFailure] | None = Field(None, description="List of pipe failures")- concept_failures: list[ConceptFailure] | None = Field(None, description="List of concept failures")- concept_definition_errors: list[ConceptDefinitionErrorData] | None = Field(None, description="List of concept definition errors")- pipe_definition_errors: list[PipeDefinitionErrorData] | None = Field(None, description="List of pipe definition errors")diff --git a/pipelex/cli/commands/build_cmd.py b/pipelex/cli/commands/build_cmd.pyindex cbbed3f5c..921f30233 100644--- a/pipelex/cli/commands/build_cmd.py+++ b/pipelex/cli/commands/build_cmd.py@@ -9,8 +9,9 @@ from posthog import tagfrom pipelex import pretty_printfrom pipelex.builder.builder import PipelexBundleSpec, load_and_validate_bundle-from pipelex.builder.builder_errors import PipeBuilderError, PipelexBundleError+from pipelex.builder.builder_errors import PipeBuilderErrorfrom pipelex.builder.builder_loop import BuilderLoop+from pipelex.builder.exceptions import PipelexBundleErrorfrom pipelex.builder.runner_code import generate_input_memory_json_string, generate_runner_codefrom pipelex.cli.error_handlers import (ErrorContext,@@ -21,16 +22,13 @@ from pipelex.cli.error_handlers import ()from pipelex.cogt.exceptions import ModelDeckPresetValidatonErrorfrom pipelex.config import get_config-from pipelex.exceptions import (- LibraryLoadingError,- PipeInputError,- PipelineExecutionError,- PipeOperatorModelAvailabilityError,- PipeOperatorModelChoiceError,-)+from pipelex.core.pipes.exceptions import PipeInputError, PipeOperatorModelChoiceErrorfrom pipelex.hub import get_report_delegate, get_required_pipe, get_telemetry_managerfrom pipelex.language.plx_factory import PlxFactory+from pipelex.libraries.exceptions import LibraryLoadingError+from pipelex.pipe_operators.exceptions import PipeOperatorModelAvailabilityErrorfrom pipelex.pipelex import PACKAGE_VERSION, Pipelex+from pipelex.pipeline.exceptions import PipelineExecutionErrorfrom pipelex.pipeline.execute import execute_pipelinefrom pipelex.system.runtime import IntegrationModefrom pipelex.system.telemetry.events import EventPropertydiff --git a/pipelex/cli/commands/doctor_cmd.py b/pipelex/cli/commands/doctor_cmd.pyindex cc6daab43..753209446 100644--- a/pipelex/cli/commands/doctor_cmd.py+++ b/pipelex/cli/commands/doctor_cmd.py@@ -13,6 +13,7 @@ from rich.prompt import Confirmfrom rich.text import Textfrom pipelex import log+from pipelex.base_exceptions import PipelexConfigErrorfrom pipelex.cli.commands.init.command import init_cmdfrom pipelex.cli.commands.init.config_files import init_configfrom pipelex.cli.commands.init.ui.types import InitFocus@@ -20,7 +21,6 @@ from pipelex.cogt.model_backends.backend_library import BackendCredentialsReportfrom pipelex.cogt.models.model_manager import ModelManagerfrom pipelex.config import PipelexConfig, get_configfrom pipelex.core.validation import report_validation_error-from pipelex.exceptions import PipelexConfigErrorfrom pipelex.hub import PipelexHub, set_pipelex_hubfrom pipelex.system.configuration.config_loader import config_managerfrom pipelex.system.environment import get_optional_envdiff --git a/pipelex/cli/commands/init/config_files.py b/pipelex/cli/commands/init/config_files.pyindex 09794f620..16f439210 100644--- a/pipelex/cli/commands/init/config_files.py+++ b/pipelex/cli/commands/init/config_files.py@@ -5,7 +5,7 @@ import shutilimport typer-from pipelex.exceptions import PipelexCLIError+from pipelex.cli.exceptions import PipelexCLIErrorfrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.system.configuration.config_loader import config_managerfrom pipelex.system.telemetry.telemetry_config import TELEMETRY_CONFIG_FILE_NAMEdiff --git a/pipelex/cli/commands/kit_cmd.py b/pipelex/cli/commands/kit_cmd.pyindex de382318f..173c8286c 100644--- a/pipelex/cli/commands/kit_cmd.py+++ b/pipelex/cli/commands/kit_cmd.py@@ -5,7 +5,7 @@ from pathlib import Pathimport typerfrom typing_extensions import Annotated-from pipelex.exceptions import PipelexCLIError+from pipelex.cli.exceptions import PipelexCLIErrorfrom pipelex.kit.cursor_export import export_cursor_rules, remove_cursor_rulesfrom pipelex.kit.index_loader import load_indexfrom pipelex.kit.migrations_export import export_migration_instructionsdiff --git a/pipelex/cli/commands/run_cmd.py b/pipelex/cli/commands/run_cmd.pyindex f3e804054..04ce39a5d 100644--- a/pipelex/cli/commands/run_cmd.py+++ b/pipelex/cli/commands/run_cmd.py@@ -11,7 +11,7 @@ from rich.console import Consolefrom pipelex import log, pretty_print_mdfrom pipelex.builder.builder import load_and_validate_bundle-from pipelex.builder.builder_errors import PipelexBundleError+from pipelex.builder.exceptions import PipelexBundleErrorfrom pipelex.cli.error_handlers import (ErrorContext,handle_model_availability_error,@@ -20,15 +20,12 @@ from pipelex.cli.error_handlers import (handle_validation_error,)from pipelex.cogt.exceptions import ModelDeckPresetValidatonError-from pipelex.exceptions import (- LibraryLoadingError,- PipeInputError,- PipelineExecutionError,- PipeOperatorModelAvailabilityError,- PipeOperatorModelChoiceError,-)+from pipelex.core.pipes.exceptions import PipeInputError, PipeOperatorModelChoiceErrorfrom pipelex.hub import get_telemetry_manager+from pipelex.libraries.exceptions import LibraryLoadingError+from pipelex.pipe_operators.exceptions import PipeOperatorModelAvailabilityErrorfrom pipelex.pipelex import Pipelex+from pipelex.pipeline.exceptions import PipelineExecutionErrorfrom pipelex.pipeline.execute import execute_pipelinefrom pipelex.system.runtime import IntegrationModefrom pipelex.system.telemetry.events import EventPropertydiff --git a/pipelex/cli/commands/show_cmd.py b/pipelex/cli/commands/show_cmd.pyindex 63a45bb2c..db0f93d2a 100644--- a/pipelex/cli/commands/show_cmd.py+++ b/pipelex/cli/commands/show_cmd.py@@ -10,17 +10,19 @@ from rich.console import Consolefrom rich.table import Tablefrom pipelex import pretty_print+from pipelex.base_exceptions import PipelexConfigErrorfrom pipelex.cli.error_handlers import (ErrorContext,handle_model_deck_preset_error,handle_validation_error,)+from pipelex.cli.exceptions import PipelexCLIErrorfrom pipelex.cogt.exceptions import ModelDeckPresetValidatonErrorfrom pipelex.cogt.model_backends.backend_library import InferenceBackendLibraryfrom pipelex.cogt.model_backends.model_lists import ModelListerfrom pipelex.config import ConfigPaths-from pipelex.exceptions import LibraryLoadingError, PipelexCLIError, PipelexConfigErrorfrom pipelex.hub import get_models_manager, get_pipe_library, get_required_pipe, get_secrets_provider, get_telemetry_manager+from pipelex.libraries.exceptions import LibraryLoadingErrorfrom pipelex.pipelex import Pipelexfrom pipelex.system.configuration.config_loader import config_managerfrom pipelex.system.runtime import IntegrationModediff --git a/pipelex/cli/commands/validate_cmd.py b/pipelex/cli/commands/validate_cmd.pyindex 92c4d4b6e..c55051890 100644--- a/pipelex/cli/commands/validate_cmd.py+++ b/pipelex/cli/commands/validate_cmd.py@@ -11,8 +11,8 @@ from rich.console import Consolefrom rich.traceback import Tracebackfrom pipelex import log-from pipelex.builder.builder_errors import PipelexBundleErrorfrom pipelex.builder.builder_validation import validate_dry_run_bundle_blueprint+from pipelex.builder.exceptions import PipelexBundleErrorfrom pipelex.cli.error_handlers import (ErrorContext,handle_model_availability_error,@@ -22,8 +22,10 @@ from pipelex.cli.error_handlers import ()from pipelex.cogt.exceptions import ModelDeckPresetValidatonErrorfrom pipelex.core.interpreter import PipelexInterpreter-from pipelex.exceptions import LibraryLoadingError, PipeInputError, PipeOperatorModelAvailabilityError, PipeOperatorModelChoiceError+from pipelex.core.pipes.exceptions import PipeInputError, PipeOperatorModelChoiceErrorfrom pipelex.hub import get_library_manager, get_pipes, get_required_pipe, get_telemetry_manager+from pipelex.libraries.exceptions import LibraryLoadingError+from pipelex.pipe_operators.exceptions import PipeOperatorModelAvailabilityErrorfrom pipelex.pipe_run.dry_run import dry_run_pipe, dry_run_pipesfrom pipelex.pipelex import Pipelexfrom pipelex.system.runtime import IntegrationModediff --git a/pipelex/cli/error_handlers.py b/pipelex/cli/error_handlers.pyindex 8d214a8b3..b9327363f 100644--- a/pipelex/cli/error_handlers.py+++ b/pipelex/cli/error_handlers.py@@ -1,21 +1,16 @@-"""Helper functions for handling and displaying CLI errors."""--from __future__ import annotations--from typing import TYPE_CHECKING, NoReturn+from typing import NoReturnimport typerfrom rich.console import Consolefrom rich.syntax import Syntax+from pipelex.cogt.exceptions import ModelDeckPresetValidatonError+from pipelex.core.concepts.exceptions import PipelexValidationExceptionAbstract+from pipelex.core.pipes.exceptions import PipeOperatorModelChoiceError+from pipelex.pipe_operators.exceptions import PipeOperatorModelAvailabilityErrorfrom pipelex.types import StrEnumfrom pipelex.urls import URLs-if TYPE_CHECKING:- from pipelex.cogt.exceptions import ModelDeckPresetValidatonError- from pipelex.core.validation_errors import PipelexValidationExceptionAbstract- from pipelex.exceptions import PipeOperatorModelAvailabilityError, PipeOperatorModelChoiceError-class ErrorContext(StrEnum):"""Context for error messages in CLI commands."""diff --git a/pipelex/cli/exceptions.py b/pipelex/cli/exceptions.pynew file mode 100644index 000000000..a64c81904--- /dev/null+++ b/pipelex/cli/exceptions.py@@ -0,0 +1,11 @@+from click import ClickException++from pipelex.base_exceptions import PipelexException+++class PipelexCLIError(PipelexException, ClickException):+ """Raised when there's an error in CLI usage or operation."""+++class ReadinessCheckError(PipelexCLIError):+ """Raised when readiness checks fail (missing dependencies or dev mode without venv)."""diff --git a/pipelex/cli/readiness.py b/pipelex/cli/readiness.pyindex 509c01c63..c2a283c57 100644--- a/pipelex/cli/readiness.py+++ b/pipelex/cli/readiness.py@@ -9,7 +9,7 @@ from pathlib import Pathfrom rich.console import Consoleimport pipelex-from pipelex.exceptions import ReadinessCheckError+from pipelex.cli.exceptions import ReadinessCheckErrordef _is_in_virtual_environment() -> bool:diff --git a/pipelex/client/client.py b/pipelex/client/client.pyindex ea9184a38..7f01a2a1b 100644--- a/pipelex/client/client.py+++ b/pipelex/client/client.py@@ -3,13 +3,13 @@ from typing import Anyimport httpxfrom typing_extensions import override+from pipelex.client.exceptions import ClientAuthenticationErrorfrom pipelex.client.pipeline_request_factory import PipelineRequestFactoryfrom pipelex.client.pipeline_response_factory import PipelineResponseFactoryfrom pipelex.client.protocol import PipelexProtocol, PipelineInputs, PipelineRequest, PipelineRequestError, PipelineResponsefrom pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.memory.working_memory_factory import WorkingMemoryFactoryfrom pipelex.core.pipes.variable_multiplicity import VariableMultiplicity-from pipelex.exceptions import ClientAuthenticationErrorfrom pipelex.system.environment import get_required_envdiff --git a/pipelex/client/exceptions.py b/pipelex/client/exceptions.pynew file mode 100644index 000000000..36c9116a1--- /dev/null+++ b/pipelex/client/exceptions.py@@ -0,0 +1,5 @@+from pipelex.base_exceptions import PipelexException+++class ClientAuthenticationError(PipelexException):+ passdiff --git a/pipelex/client/protocol.py b/pipelex/client/protocol.pyindex 1f1e22fa4..a38dae88d 100644--- a/pipelex/client/protocol.py+++ b/pipelex/client/protocol.py@@ -5,12 +5,12 @@ from pydantic import BaseModel, model_validatorfrom pydantic.functional_validators import SkipValidationfrom typing_extensions import Annotated, runtime_checkable+from pipelex.base_exceptions import PipelexExceptionfrom pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.pipes.pipe_output import DictPipeOutputfrom pipelex.core.pipes.variable_multiplicity import VariableMultiplicityfrom pipelex.core.stuffs.stuff import DictStufffrom pipelex.core.stuffs.stuff_content import StuffContent-from pipelex.exceptions import PipelexExceptionfrom pipelex.types import StrEnum# StuffContentOrData represents all possible formats for pipeline inputs input:diff --git a/pipelex/cogt/exceptions.py b/pipelex/cogt/exceptions.pyindex ac170c6e4..bff7e13ec 100644--- a/pipelex/cogt/exceptions.py+++ b/pipelex/cogt/exceptions.py@@ -2,7 +2,7 @@ from pipelex.cogt.extract.extract_setting import ExtractModelChoicefrom pipelex.cogt.img_gen.img_gen_setting import ImgGenModelChoicefrom pipelex.cogt.llm.llm_setting import LLMModelChoicefrom pipelex.cogt.model_backends.model_type import ModelType-from pipelex.system.exceptions import FatalError, RootException+from pipelex.system.exceptions import RootExceptionfrom pipelex.types import StrEnum@@ -18,10 +18,6 @@ class ImageContentError(CogtError):pass-class InferenceManagerWorkerSetupError(CogtError, FatalError):- pass--class CostRegistryError(CogtError):pass@@ -34,14 +30,6 @@ class SdkTypeError(CogtError):pass-class SdkRegistryError(CogtError):- pass---class LLMWorkerError(CogtError):- pass--class ModelChoiceNotFoundError(CogtError):def __init__(self, message: str, model_type: ModelType, model_choice: LLMModelChoice | ExtractModelChoice | ImgGenModelChoice):self.model_type = model_type@@ -112,14 +100,6 @@ class ExtractHandleNotFoundError(CogtError):super().__init__(message)-class LLMModelPlatformError(ValueError, CogtError):- pass---class LLMModelDefinitionError(CogtError):- pass--class LLMModelNotFoundError(CogtError):pass@@ -140,10 +120,6 @@ class LLMPromptSpecError(CogtError):pass-class LLMPromptFactoryError(CogtError):- pass--class LLMPromptTemplateInputsError(CogtError):pass@@ -156,10 +132,6 @@ class PromptImageFactoryError(CogtError):pass-class PromptImageDefinitionError(CogtError):- pass--class PromptImageFormatError(CogtError):pass@@ -193,10 +165,6 @@ class MissingDependencyError(CogtError):super().__init__(error_msg)-class MissingPluginError(CogtError):- pass--class ExtractCapabilityError(CogtError):pass@@ -217,10 +185,6 @@ class InferenceModelSpecError(CogtError):pass-class InferenceBackendError(CogtError):- pass--class InferenceBackendLibraryNotFoundError(CogtError):passdiff --git a/pipelex/cogt/model_backends/model_lists.py b/pipelex/cogt/model_backends/model_lists.pyindex 7be68947f..e2c3b11b7 100644--- a/pipelex/cogt/model_backends/model_lists.py+++ b/pipelex/cogt/model_backends/model_lists.py@@ -16,7 +16,7 @@ if TYPE_CHECKING:from openai.types import Modelfrom pipelex.cogt.model_backends.backend import InferenceBackend-from pipelex.exceptions import PipelexCLIError+from pipelex.cli.exceptions import PipelexCLIErrorfrom pipelex.hub import get_models_managerfrom pipelex.plugins.openai.openai_llms import openai_list_available_modelsfrom pipelex.plugins.plugin_sdk_registry import Plugin@@ -42,6 +42,7 @@ class ModelLister:backend = get_models_manager().get_required_inference_backend(backend_name)except Exception as exc:msg = f"Backend '{backend_name}' not found: {exc}"+ # TODO: This should not raise this error in here.raise PipelexCLIError(msg) from excconsole = Console()@@ -49,6 +50,7 @@ class ModelLister:# Determine which SDKs are used in this backendif not backend.model_specs:msg = f"Backend '{backend_name}' has no model specifications"+ # TODO: This should not raise this error in here.raise PipelexCLIError(msg)# Group models by SDKdiff --git a/pipelex/cogt/models/model_deck.py b/pipelex/cogt/models/model_deck.pyindex 840db84f0..56817e35c 100644--- a/pipelex/cogt/models/model_deck.py+++ b/pipelex/cogt/models/model_deck.py@@ -379,8 +379,8 @@ class ModelDeck(ConfigModel):f"Model handle '{model_handle}' was not found in the model deck. ""Make sure it's defined in ond of the model decks '.pipelex/inference/deck/*.toml'. ""If the model handle is indeed in the deck, make sure the required backend for this model to run is enabled in "- "'.pipelex/inference/backends.toml' and that you have the necessary credentials."- "To find what backend is required for this model, look at the routing profile in .pipelex/inference/routing_profiles.toml. "+ "'.pipelex/inference/backends.toml' and that you have the necessary credentials. "+ "To find what backend is required for this model, look at the routing profile in '.pipelex/inference/routing_profiles.toml' ""Learn more about the inference backend system in the Pipelex documentation: "f"{URLs.backend_provider_docs}")diff --git a/pipelex/config.py b/pipelex/config.pyindex d2fed92d4..5e839adc3 100644--- a/pipelex/config.py+++ b/pipelex/config.py@@ -3,10 +3,11 @@ from typing import castimport shortuuidfrom pydantic import Field, field_validator+from pipelex.base_exceptions import PipelexConfigErrorfrom pipelex.cogt.config_cogt import Cogtfrom pipelex.cogt.model_backends.prompting_target import PromptingTargetfrom pipelex.cogt.templating.templating_style import TemplatingStyle-from pipelex.exceptions import PipelexConfigError, StaticValidationErrorType+from pipelex.core.pipes.exceptions import StaticValidationErrorTypefrom pipelex.hub import get_required_configfrom pipelex.language.plx_config import PlxConfigfrom pipelex.pipeline.track.tracker_config import TrackerConfigdiff --git a/pipelex/core/bundles/exceptions.py b/pipelex/core/bundles/exceptions.pyindex ed7a4b5cf..706687e36 100644--- a/pipelex/core/bundles/exceptions.py+++ b/pipelex/core/bundles/exceptions.py@@ -1,2 +1,2 @@-class PipelexBundleBlueprintError(Exception):+class PipelexBundleBlueprintValueError(ValueError):passdiff --git a/pipelex/core/bundles/pipelex_bundle_blueprint.py b/pipelex/core/bundles/pipelex_bundle_blueprint.pyindex 31cf0851c..3b0e494d4 100644--- a/pipelex/core/bundles/pipelex_bundle_blueprint.py+++ b/pipelex/core/bundles/pipelex_bundle_blueprint.py@@ -2,9 +2,10 @@ from typing import Annotatedfrom pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator-from pipelex.builder.builder_errors import PipelexBundleError+from pipelex.core.bundles.exceptions import PipelexBundleBlueprintValueErrorfrom pipelex.core.concepts.concept_blueprint import ConceptBlueprint-from pipelex.core.domains.domain_blueprint import DomainBlueprint+from pipelex.core.domains.exceptions import DomainCodeError+from pipelex.core.domains.validation import validate_domain_codefrom pipelex.pipe_controllers.batch.pipe_batch_blueprint import PipeBatchBlueprintfrom pipelex.pipe_controllers.condition.pipe_condition_blueprint import PipeConditionBlueprintfrom pipelex.pipe_controllers.parallel.pipe_parallel_blueprint import PipeParallelBlueprint@@ -45,14 +46,18 @@ class PipelexBundleBlueprint(BaseModel):@field_validator("domain", mode="before")@classmethoddef validate_domain_syntax(cls, domain: str) -> str:- DomainBlueprint.validate_domain_code(code=domain)+ try:+ validate_domain_code(code=domain)+ except DomainCodeError as exc:+ msg = f"Error when trying to validate the pipelex bundle at domain '{domain}': {exc}"+ raise PipelexBundleBlueprintValueError(msg) from excreturn domain@model_validator(mode="after")def validate_main_pipe(self) -> "PipelexBundleBlueprint":if self.main_pipe and (not self.pipe or (self.main_pipe not in self.pipe)):- msg = f"Main pipe '{self.main_pipe}' could not be found in bundle spec"- raise PipelexBundleError(message=msg)+ msg = f"Main pipe '{self.main_pipe}' could not be found in pipelex bundle at source '{self.source}' and domain '{self.domain}'"+ raise PipelexBundleBlueprintValueError(msg)return self@propertydiff --git a/pipelex/core/concepts/concept.py b/pipelex/core/concepts/concept.pyindex 832ee04df..bc8af884a 100644--- a/pipelex/core/concepts/concept.py+++ b/pipelex/core/concepts/concept.py@@ -5,13 +5,13 @@ from kajson.kajson_manager import KajsonManagerfrom pydantic import BaseModel, ConfigDict, field_validatorfrom pipelex import log-from pipelex.core.concepts.concept_blueprint import ConceptBlueprint+from pipelex.base_exceptions import PipelexUnexpectedErrorfrom pipelex.core.concepts.concept_native import NativeConceptCode+from pipelex.core.concepts.validation import validate_concept_code, validate_concept_stringfrom pipelex.core.domains.domain import SpecialDomain-from pipelex.core.domains.domain_blueprint import DomainBlueprint+from pipelex.core.domains.validation import validate_domain_codefrom pipelex.core.stuffs.image_field_search import search_for_nested_image_fieldsfrom pipelex.core.stuffs.stuff_content import StuffContent-from pipelex.exceptions import PipelexUnexpectedErrorfrom pipelex.tools.misc.string_utils import pascal_case_to_sentencefrom pipelex.tools.typing.class_utils import are_classes_equivalent, has_compatible_fieldfrom pipelex.types import StrEnum@@ -32,19 +32,19 @@ class Concept(BaseModel):@classmethoddef is_implicit_concept(cls, concept_string: str) -> bool:- ConceptBlueprint.validate_concept_string(concept_string=concept_string)+ validate_concept_string(concept_string=concept_string)return concept_string.startswith(SpecialDomain.IMPLICIT)@field_validator("code")@classmethoddef validate_code(cls, code: str) -> str:- ConceptBlueprint.validate_concept_code(concept_code=code)+ validate_concept_code(concept_code=code)return code@field_validator("domain")@classmethoddef validate_domain(cls, domain: str) -> str:- DomainBlueprint.validate_domain_code(code=domain)+ validate_domain_code(code=domain)return domain@field_validator("refines", mode="before")@@ -52,7 +52,7 @@ class Concept(BaseModel):def validate_refines(cls, refines: str | None) -> str | None:if refines is None:return None- ConceptBlueprint.validate_concept_string(concept_string=refines)+ validate_concept_string(concept_string=refines)return refines@classmethoddiff --git a/pipelex/core/concepts/concept_blueprint.py b/pipelex/core/concepts/concept_blueprint.pyindex 5f72a7d76..a9933bf17 100644--- a/pipelex/core/concepts/concept_blueprint.py+++ b/pipelex/core/concepts/concept_blueprint.py@@ -1,114 +1,10 @@-from datetime import datetimefrom typing import Any-from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator+from pydantic import BaseModel, ConfigDict, field_validator, model_validatorfrom pipelex.core.concepts.concept_native import NativeConceptCode-from pipelex.core.concepts.exceptions import ConceptCodeError, ConceptStringError, ConceptStringOrConceptCodeError-from pipelex.core.domains.domain import SpecialDomain-from pipelex.core.domains.domain_blueprint import DomainBlueprint-from pipelex.tools.misc.string_utils import is_pascal_case-from pipelex.types import Self, StrEnum---class ConceptBlueprintError(Exception):- pass---class ConceptStructureBlueprintError(Exception):- pass---class ConceptStructureBlueprintFieldType(StrEnum):- TEXT = "text"- LIST = "list"- DICT = "dict"- INTEGER = "integer"- BOOLEAN = "boolean"- NUMBER = "number"- DATE = "date"---class ConceptStructureBlueprint(BaseModel):- description: str- type: ConceptStructureBlueprintFieldType | None = None- item_type: str | None = None- key_type: str | None = None- value_type: str | None = None- choices: list[str] | None = Field(default=None)- required: bool | None = Field(default=False)- default_value: Any | None = None-- # TODO: date translator for default_value-- @model_validator(mode="after")- def validate_structure_blueprint(self) -> Self:- """Validate the structure blueprint according to type rules."""- # If type is None (array), choices must not be None- if self.type is None and not self.choices:- msg = f"When type is None (array), choices must not be empty. Actual type: {self.type}, choices: {self.choices}"- raise ConceptStructureBlueprintError(msg)-- # If type is "dict", key_type and value_type must not be empty- if self.type == ConceptStructureBlueprintFieldType.DICT:- if not self.key_type:- msg = f"When type is '{ConceptStructureBlueprintFieldType.DICT}', key_type must not be empty. Actual key_type: {self.key_type}"- raise ConceptStructureBlueprintError(msg)- if not self.value_type:- msg = f"When type is '{ConceptStructureBlueprintFieldType.DICT}', value_type must not be empty. Actual value_type: {self.value_type}"- raise ConceptStructureBlueprintError(msg)-- # Check when default_value is not None, type is not None (except for choice fields)- if self.default_value is not None and self.type is None and not self.choices:- msg = (- f"When default_value is not None, type must be specified (unless choices are provided). Actual type: {self.type},"- f"default_value: {self.default_value}, choices: {self.choices}"- )- raise ConceptStructureBlueprintError(msg)-- # Check default_value type is the same as type- if self.default_value is not None and self.type is not None:- self._validate_default_value_type()-- # Check default_value is valid for choice fields- if self.default_value is not None and self.type is None and self.choices:- if self.default_value not in self.choices:- msg = f"default_value must be one of the valid choices. Got '{self.default_value}', valid choices: {self.choices}"- raise ConceptStructureBlueprintError(msg)-- return self-- def _validate_default_value_type(self) -> None:- """Validate that default_value matches the specified type."""- if self.type is None or self.default_value is None:- return-- match self.type:- case ConceptStructureBlueprintFieldType.TEXT:- if not isinstance(self.default_value, str):- self._raise_type_mismatch_error("str", type(self.default_value).__name__)- case ConceptStructureBlueprintFieldType.INTEGER:- if not isinstance(self.default_value, int):- self._raise_type_mismatch_error("int", type(self.default_value).__name__)- case ConceptStructureBlueprintFieldType.BOOLEAN:- if not isinstance(self.default_value, bool):- self._raise_type_mismatch_error("bool", type(self.default_value).__name__)- case ConceptStructureBlueprintFieldType.NUMBER:- if not isinstance(self.default_value, (int, float)):- self._raise_type_mismatch_error("number (int or float)", type(self.default_value).__name__)- case ConceptStructureBlueprintFieldType.LIST:- if not isinstance(self.default_value, list):- self._raise_type_mismatch_error("list", type(self.default_value).__name__)- case ConceptStructureBlueprintFieldType.DICT:- if not isinstance(self.default_value, dict):- self._raise_type_mismatch_error("dict", type(self.default_value).__name__)- case ConceptStructureBlueprintFieldType.DATE:- if not isinstance(self.default_value, datetime):- self._raise_type_mismatch_error("date", type(self.default_value).__name__)-- def _raise_type_mismatch_error(self, expected_type_name: str, actual_type_name: str) -> None:- msg = f"default_value type mismatch: expected {expected_type_name} for type '{self.type}', but got {actual_type_name}"- raise ConceptStructureBlueprintError(msg)+from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprint+from pipelex.core.concepts.exceptions import ConceptBlueprintValueErrorclass ConceptBlueprint(BaseModel):@@ -121,93 +17,22 @@ class ConceptBlueprint(BaseModel):# TODO: restore possibility of multiple refilesrefines: str | None = None- @classmethod- def is_native_concept_code(cls, concept_code: str) -> bool:- ConceptBlueprint.validate_concept_code(concept_code=concept_code)- return NativeConceptCode.is_native_concept(concept_code=concept_code)-- @classmethod- def validate_concept_code(cls, concept_code: str) -> None:- if not is_pascal_case(concept_code):- msg = (- f"ConceptBlueprint validate_concept_code: Concept code '{concept_code}' must be PascalCase "- f"(letters and numbers only, starting with uppercase, without `.`)"- )- raise ConceptCodeError(msg)-- @classmethod- def validate_concept_string_or_code(cls, concept_string_or_code: str) -> None:- if concept_string_or_code.count(".") > 1:- msg = (- f"concept_string_or_code '{concept_string_or_code}' is invalid. "- "It should either contain a domain in snake_case and a concept code in PascalCase separated by one dot, "- "or be a concept code in PascalCase.",- )- raise ConceptStringOrConceptCodeError(msg)-- if concept_string_or_code.count(".") == 1:- domain, concept_code = concept_string_or_code.split(".")- DomainBlueprint.validate_domain_code(code=domain)- cls.validate_concept_code(concept_code=concept_code)- else:- cls.validate_concept_code(concept_code=concept_string_or_code)-- @staticmethod- def validate_concept_string(concept_string: str) -> None:- """Validate that a concept code follows PascalCase convention."""- if "." not in concept_string or concept_string.count(".") > 1:- msg = (- f"Concept string '{concept_string}' is invalid. It should contain a domain in snake_case "- "and a concept code in PascalCase separated by one dot."- )- raise ConceptStringError(msg)- domain, concept_code = concept_string.split(".", 1)-- # Validate domain- DomainBlueprint.validate_domain_code(domain)-- # Validate concept code- if not is_pascal_case(concept_code):- msg = (- f"ConceptBlueprint validate_concept_string: Concept code '{concept_code}' must be PascalCase "- f"(letters and numbers only, starting with uppercase, without `.`)"- )- raise ConceptCodeError(msg)-- # Validate that if the concept code is among the native concepts, the domain MUST be native.- if concept_code in NativeConceptCode.values_list():- if not SpecialDomain.is_native(domain=domain):- msg = (- f"Concept string '{concept_string}' is invalid. "- f"Concept code '{concept_code}' is a native concept, so the domain must be '{SpecialDomain.NATIVE}', "- f"or nothing, but not '{domain}'"- )- raise ConceptStringError(msg)- # Validate that if the domain is native, the concept code is a native concept- if SpecialDomain.is_native(domain=domain):- if concept_code not in NativeConceptCode.values_list():- msg = (- f"Concept string '{concept_string}' is invalid. "- f"Concept code '{concept_code}' is not a native concept, so the domain must not be '{SpecialDomain.NATIVE}'."- )- raise ConceptStringError(msg)-@field_validator("refines", mode="before")@classmethoddef validate_refines(cls, refines: str | None = None) -> str | None:if refines is not None:if not NativeConceptCode.get_validated_native_concept_string(concept_string_or_code=refines):msg = f"Refine '{refines}' is not a native concept and we currently can only refine native concepts"- raise ConceptBlueprintError(msg)+ raise ConceptBlueprintValueError(msg)return refines@model_validator(mode="before")@classmethod- def model_validate_blueprint(cls, values: dict[str, Any] | str) -> dict[str, Any] | str:+ def validate_blueprint(cls, values: dict[str, Any] | str) -> dict[str, Any] | str:if isinstance(values, dict) and values.get("refines") and values.get("structure"):msg = (f"Forbidden to have refines and structure at the same time: `{values.get('refines')}` "f"and `{values.get('structure')}` for concept that has the definition `{values.get('description')}`")- raise ConceptBlueprintError(msg)+ raise ConceptBlueprintValueError(msg)return valuesdiff --git a/pipelex/core/concepts/concept_factory.py b/pipelex/core/concepts/concept_factory.pyindex c512b5b92..3798fefe7 100644--- a/pipelex/core/concepts/concept_factory.py+++ b/pipelex/core/concepts/concept_factory.py@@ -2,16 +2,20 @@ from kajson.kajson_manager import KajsonManagerfrom pydantic import BaseModelfrom pipelex.core.concepts.concept import Concept-from pipelex.core.concepts.concept_blueprint import (- ConceptBlueprint,- ConceptStructureBlueprint,- ConceptStructureBlueprintFieldType,-)+from pipelex.core.concepts.concept_blueprint import ConceptBlueprintfrom pipelex.core.concepts.concept_native import NativeConceptCode+from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldType+from pipelex.core.concepts.exceptions import (+ ConceptDefinitionError,+ ConceptFactoryError,+ ConceptRefineError,+ ConceptStructureGeneratorError,+ StructureClassError,+)from pipelex.core.concepts.structure_generator import StructureGenerator+from pipelex.core.concepts.validation import is_concept_code_valid, is_concept_string_valid, validate_refinefrom pipelex.core.domains.domain import SpecialDomainfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import ConceptCodeError, ConceptDefinitionError, ConceptRefineError, ConceptStructureGeneratorError, StructureClassErrorclass DomainAndConceptCode(BaseModel):@@ -50,7 +54,9 @@ class ConceptFactory:@classmethoddef make_implicit_concept(cls, concept_string: str) -> Concept:- ConceptBlueprint.validate_concept_string(concept_string=concept_string)+ if not is_concept_string_valid(concept_string=concept_string):+ msg = f"Concept string '{concept_string}' is not a valid concept string"+ raise ConceptFactoryError(msg)return Concept(code=concept_string.split(".")[1],domain=SpecialDomain.IMPLICIT,@@ -181,11 +187,34 @@ class ConceptFactory:@classmethoddef make_refine(cls, refine: str) -> str:- if native_concept_string := NativeConceptCode.get_validated_native_concept_string(concept_string_or_code=refine):- return native_concept_string- else:- msg = f"Refine '{refine}' is not a native concept and we currently can only refine native concepts"- raise ConceptRefineError(msg)+ """Validate and normalize a refine string.++ If the refine is a native concept code without domain (e.g., 'Text'),+ it will be normalized to include the native domain prefix (e.g., 'native.Text').++ Args:+ refine: The refine string to validate and normalize++ Returns:+ The normalized refine string with domain prefix++ Raises:+ ConceptFactoryError: If the refine is invalid++ """+ try:+ validate_refine(refine=refine)+ except ConceptRefineError as exc:+ msg = f"Could not validate refine '{refine}': {exc}"+ raise ConceptFactoryError(msg) from exc++ # Normalize the refine string (adds native domain if missing)+ normalized_refine = NativeConceptCode.get_validated_native_concept_string(concept_string_or_code=refine)+ if normalized_refine is None:+ msg = f"Could not normalize refine '{refine}' to a native concept string"+ raise ConceptFactoryError(msg)++ return normalized_refine@classmethoddef make_from_blueprint_or_description(@@ -215,13 +244,9 @@ class ConceptFactory:blueprint: ConceptBlueprint,concept_codes_from_the_same_domain: list[str] | None = None,) -> Concept:- try:- ConceptBlueprint.validate_concept_code(concept_code=concept_code)- except ConceptCodeError as exc:- msg = f"Could not validate concept code '{concept_code}' in domain '{domain}': {exc}"- raise ConceptDefinitionError(- message=msg, domain_code=domain, concept_code=concept_code, description=blueprint.description, source=blueprint.source- ) from exc+ if not is_concept_code_valid(concept_code=concept_code):+ msg = f"Concept code '{concept_code}' is not a valid concept code"+ raise ConceptFactoryError(msg)structure_class_name: strcurrent_refine: str | None = None@@ -267,6 +292,7 @@ class ConceptFactory:# Handle refines definitionelif blueprint.refines:# If we have refines, validate that there is not already a structure related to this concept code in the class registry+ # TODO: This test should NOT BE HERE, but in the `validate_with_libraries`.if Concept.is_valid_structure_class(structure_class_name=concept_code):msg = (f"Concept '{concept_code}' in domain '{domain}' has refines but also has a structure class registered. "diff --git a/pipelex/core/concepts/concept_library.py b/pipelex/core/concepts/concept_library.pyindex b04165782..22ae29144 100644--- a/pipelex/core/concepts/concept_library.py+++ b/pipelex/core/concepts/concept_library.py@@ -4,14 +4,15 @@ from pydantic import Field, RootModelfrom typing_extensions import overridefrom pipelex.core.concepts.concept import Concept-from pipelex.core.concepts.concept_blueprint import ConceptBlueprintfrom pipelex.core.concepts.concept_factory import ConceptFactoryfrom pipelex.core.concepts.concept_library_abstract import ConceptLibraryAbstractfrom pipelex.core.concepts.concept_native import NativeConceptCode+from pipelex.core.concepts.exceptions import ConceptLibraryConceptNotFoundError+from pipelex.core.concepts.validation import is_concept_code_valid, is_concept_string_validfrom pipelex.core.domains.domain import SpecialDomainfrom pipelex.core.stuffs.image_content import ImageContent-from pipelex.exceptions import ConceptLibraryConceptNotFoundError, ConceptLibraryErrorfrom pipelex.hub import get_class_registry+from pipelex.libraries.exceptions import ConceptLibraryErrorfrom pipelex.types import SelfConceptLibraryRoot = dict[str, Concept]@@ -85,7 +86,9 @@ class ConceptLibrary(RootModel[ConceptLibraryRoot], ConceptLibraryAbstract):"""if Concept.is_implicit_concept(concept_string=concept_string):return ConceptFactory.make_implicit_concept(concept_string=concept_string)- ConceptBlueprint.validate_concept_string(concept_string=concept_string)+ if not is_concept_string_valid(concept_string=concept_string):+ msg = f"Concept string '{concept_string}' is not a valid concept string"+ raise ConceptLibraryError(msg)the_concept = self.get_optional_concept(concept_string=concept_string)if not the_concept:msg = f"Concept '{concept_string}' not found in the library"@@ -158,7 +161,9 @@ class ConceptLibrary(RootModel[ConceptLibraryRoot], ConceptLibraryAbstract):@overridedef search_for_concept_in_domains(self, concept_code: str, search_domains: list[str]) -> Concept | None:- ConceptBlueprint.validate_concept_code(concept_code=concept_code)+ if not is_concept_code_valid(concept_code=concept_code):+ msg = f"Concept code '{concept_code}' is not a valid concept code"+ raise ConceptLibraryError(msg)for domain in search_domains:if found_concept := self.get_required_concept(concept_string=ConceptFactory.make_concept_string_with_domain(domain=domain, concept_code=concept_code),diff --git a/pipelex/core/concepts/concept_structure_blueprint.py b/pipelex/core/concepts/concept_structure_blueprint.pynew file mode 100644index 000000000..ae85b0598--- /dev/null+++ b/pipelex/core/concepts/concept_structure_blueprint.py@@ -0,0 +1,98 @@+from datetime import datetime+from typing import Any++from pydantic import BaseModel, Field, model_validator++from pipelex.core.concepts.exceptions import ConceptStructureBlueprintValueError+from pipelex.types import Self, StrEnum+++class ConceptStructureBlueprintFieldType(StrEnum):+ TEXT = "text"+ LIST = "list"+ DICT = "dict"+ INTEGER = "integer"+ BOOLEAN = "boolean"+ NUMBER = "number"+ DATE = "date"+++class ConceptStructureBlueprint(BaseModel):+ description: str+ type: ConceptStructureBlueprintFieldType | None = None+ item_type: str | None = None+ key_type: str | None = None+ value_type: str | None = None+ choices: list[str] | None = Field(default=None)+ required: bool | None = Field(default=True)+ default_value: Any | None = None++ # TODO: date translator for default_value++ @model_validator(mode="after")+ def validate_structure_blueprint(self) -> Self:+ """Validate the structure blueprint according to type rules."""+ # If type is None (array), choices must not be None+ if self.type is None and not self.choices:+ msg = f"When type is None (array), choices must not be empty. Actual type: {self.type}, choices: {self.choices}"+ raise ConceptStructureBlueprintValueError(msg)++ # If type is "dict", key_type and value_type must not be empty+ if self.type == ConceptStructureBlueprintFieldType.DICT:+ if not self.key_type:+ msg = f"When type is '{ConceptStructureBlueprintFieldType.DICT}', key_type must not be empty. Actual key_type: {self.key_type}"+ raise ConceptStructureBlueprintValueError(msg)+ if not self.value_type:+ msg = f"When type is '{ConceptStructureBlueprintFieldType.DICT}', value_type must not be empty. Actual value_type: {self.value_type}"+ raise ConceptStructureBlueprintValueError(msg)++ # Check when default_value is not None, type is not None (except for choice fields)+ if self.default_value is not None and self.type is None and not self.choices:+ msg = (+ f"When default_value is not None, type must be specified (unless choices are provided). Actual type: {self.type},"+ f"default_value: {self.default_value}, choices: {self.choices}"+ )+ raise ConceptStructureBlueprintValueError(msg)++ # Check default_value type is the same as type+ if self.default_value is not None and self.type is not None:+ self._validate_default_value_type()++ # Check default_value is valid for choice fields+ if self.default_value is not None and self.type is None and self.choices:+ if self.default_value not in self.choices:+ msg = f"default_value must be one of the valid choices. Got '{self.default_value}', valid choices: {self.choices}"+ raise ConceptStructureBlueprintValueError(msg)++ return self++ def _validate_default_value_type(self) -> None:+ if self.type is None or self.default_value is None:+ return++ match self.type:+ case ConceptStructureBlueprintFieldType.TEXT:+ if not isinstance(self.default_value, str):+ self._raise_type_mismatch_error("str", type(self.default_value).__name__)+ case ConceptStructureBlueprintFieldType.INTEGER:+ if not isinstance(self.default_value, int):+ self._raise_type_mismatch_error("int", type(self.default_value).__name__)+ case ConceptStructureBlueprintFieldType.BOOLEAN:+ if not isinstance(self.default_value, bool):+ self._raise_type_mismatch_error("bool", type(self.default_value).__name__)+ case ConceptStructureBlueprintFieldType.NUMBER:+ if not isinstance(self.default_value, (int, float)):+ self._raise_type_mismatch_error("number (int or float)", type(self.default_value).__name__)+ case ConceptStructureBlueprintFieldType.LIST:+ if not isinstance(self.default_value, list):+ self._raise_type_mismatch_error("list", type(self.default_value).__name__)+ case ConceptStructureBlueprintFieldType.DICT:+ if not isinstance(self.default_value, dict):+ self._raise_type_mismatch_error("dict", type(self.default_value).__name__)+ case ConceptStructureBlueprintFieldType.DATE:+ if not isinstance(self.default_value, datetime):+ self._raise_type_mismatch_error("date", type(self.default_value).__name__)++ def _raise_type_mismatch_error(self, expected_type_name: str, actual_type_name: str) -> None:+ msg = f"default_value type mismatch: expected {expected_type_name} for type '{self.type}', but got {actual_type_name}"+ raise ConceptStructureBlueprintValueError(msg)diff --git a/pipelex/core/concepts/exceptions.py b/pipelex/core/concepts/exceptions.pyindex 6624def1f..a9fc3b338 100644--- a/pipelex/core/concepts/exceptions.py+++ b/pipelex/core/concepts/exceptions.py@@ -1,10 +1,102 @@-class ConceptCodeError(Exception):+from abc import ABC, abstractmethod++from pydantic import BaseModel, Field++from pipelex.base_exceptions import PipelexException+from pipelex.core.exceptions import SyntaxErrorData+++class ConceptError(PipelexException):+ pass+++class ConceptBlueprintValueError(ValueError):+ pass+++class ConceptStructureBlueprintValueError(ValueError):pass-class ConceptStringError(Exception):+class ConceptStructureValidationError(PipelexException):pass-class ConceptStringOrConceptCodeError(Exception):+class ConceptFactoryError(PipelexException):pass+++class StructureClassError(ConceptFactoryError):+ pass+++class ConceptCodeError(ConceptError):+ pass+++class ConceptStringError(ConceptError):+ pass+++class ConceptRefineError(ConceptError):+ pass+++class ConceptLibraryConceptNotFoundError(PipelexException):+ pass+++class ConceptDefinitionErrorData(BaseModel):+ """Structured data for ConceptDefinitionError."""++ message: str = Field(description="The error message")+ domain_code: str = Field(description="The domain code")+ concept_code: str = Field(description="The concept code")+ description: str = Field(description="Description of the concept")+ structure_class_python_code: str | None = Field(None, description="Python code for the structure class if available")+ structure_class_syntax_error_data: SyntaxErrorData | None = Field(None, description="Syntax error data for the structure class if available")+ source: str | None = Field(None, description="Source of the error")+++class ConceptDefinitionError(PipelexException):+ def __init__(+ self,+ message: str,+ domain_code: str,+ concept_code: str,+ description: str,+ structure_class_python_code: str | None = None,+ structure_class_syntax_error_data: SyntaxErrorData | None = None,+ source: str | None = None,+ ):+ self.domain_code = domain_code+ self.concept_code = concept_code+ self.description = description+ self.structure_class_python_code = structure_class_python_code+ self.structure_class_syntax_error_data = structure_class_syntax_error_data+ self.source = source+ super().__init__(message)++ def as_structured_content(self) -> ConceptDefinitionErrorData:+ return ConceptDefinitionErrorData(+ message=str(self),+ domain_code=self.domain_code,+ concept_code=self.concept_code,+ description=self.description,+ structure_class_python_code=self.structure_class_python_code,+ structure_class_syntax_error_data=self.structure_class_syntax_error_data,+ source=self.source,+ )+++class ConceptStructureGeneratorError(PipelexException):+ def __init__(self, message: str, structure_class_python_code: str | None = None, syntax_error_data: SyntaxErrorData | None = None):+ self.structure_class_python_code = structure_class_python_code+ self.syntax_error_data = syntax_error_data+ super().__init__(message)+++class PipelexValidationExceptionAbstract(PipelexException, ABC):+ @abstractmethod+ def get_concept_definition_errors(self) -> list[ConceptDefinitionErrorData]:+ passdiff --git a/pipelex/core/concepts/structure_generator.py b/pipelex/core/concepts/structure_generator.pyindex bcec78202..7311c4701 100644--- a/pipelex/core/concepts/structure_generator.py+++ b/pipelex/core/concepts/structure_generator.py@@ -5,14 +5,9 @@ from typing import Any, Literal, Optionalfrom pydantic import Field-from pipelex.builder.validation_error_data import SyntaxErrorData-from pipelex.core.concepts.concept_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldType+from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldType+from pipelex.core.concepts.exceptions import ConceptStructureGeneratorError, ConceptStructureValidationError, SyntaxErrorDatafrom pipelex.core.stuffs.structured_content import StructuredContent-from pipelex.exceptions import ConceptStructureGeneratorError, PipelexException---class ConceptStructureValidationError(PipelexException):- passclass StructureGenerator:diff --git a/pipelex/core/concepts/validation.py b/pipelex/core/concepts/validation.pynew file mode 100644index 000000000..8f6ff41f1--- /dev/null+++ b/pipelex/core/concepts/validation.py@@ -0,0 +1,86 @@+from pipelex.core.concepts.concept_native import NativeConceptCode+from pipelex.core.concepts.exceptions import ConceptCodeError, ConceptRefineError, ConceptStringError+from pipelex.core.domains.domain import SpecialDomain+from pipelex.core.domains.exceptions import DomainCodeError+from pipelex.core.domains.validation import is_domain_code_valid, validate_domain_code+from pipelex.tools.misc.string_utils import is_pascal_case+++def is_concept_code_valid(concept_code: str) -> bool:+ return is_pascal_case(concept_code)+++def validate_concept_code(concept_code: str) -> None:+ if not is_concept_code_valid(concept_code=concept_code):+ msg = f"Concept code '{concept_code}' is not a valid concept code. It should be in PascalCase."+ raise ConceptCodeError(msg)+++def is_concept_string_or_code_valid(concept_string_or_code: str) -> bool:+ if concept_string_or_code.count(".") > 1:+ return False++ if concept_string_or_code.count(".") == 1:+ domain, concept_code = concept_string_or_code.split(".")+ try:+ validate_concept_code(concept_code=concept_code)+ validate_domain_code(code=domain)+ return True+ except (ConceptCodeError, DomainCodeError):+ return False+ else:+ return is_concept_code_valid(concept_code=concept_string_or_code)+++def validate_concept_string_or_code(concept_string_or_code: str) -> None:+ if not is_concept_string_or_code_valid(concept_string_or_code=concept_string_or_code):+ msg = f"Concept string or code '{concept_string_or_code}' is not a valid concept string or code."+ raise ConceptStringError(msg)+++def validate_concept_string(concept_string: str) -> None:+ if not is_concept_string_valid(concept_string=concept_string):+ msg = (+ f"Concept string '{concept_string}' is not a valid concept string. It must be in the format 'domain.ConceptCode': "+ " - domain: a valid domain code (snake_case), "+ " - ConceptCode: a valid concept code (PascalCase)"+ )+ raise ConceptStringError(msg)+++def is_concept_string_valid(concept_string: str) -> bool:+ if "." not in concept_string or concept_string.count(".") > 1:+ return False+ domain, concept_code = concept_string.split(".", 1)++ # Validate domain+ if not is_domain_code_valid(code=domain):+ return False++ # Validate concept code+ if not is_concept_code_valid(concept_code=concept_code):+ return False++ # Validate that if the concept code is among the native concepts, the domain MUST be native.+ if concept_code in NativeConceptCode.values_list():+ if not SpecialDomain.is_native(domain=domain):+ return False+ # Validate that if the domain is native, the concept code is a native concept+ if SpecialDomain.is_native(domain=domain):+ if concept_code not in NativeConceptCode.values_list():+ return False+ return True+++def is_refine_valid(refine: str) -> bool:+ return NativeConceptCode.get_validated_native_concept_string(concept_string_or_code=refine) is not None+++def validate_refine(refine: str) -> None:+ if not is_refine_valid(refine=refine):+ msg = (+ f"Refine '{refine}' is not a valid refine. It must be referencing a native concept. "+ "More about native concepts here: "+ "https://docs.pipelex.com/pages/build-reliable-ai-workflows-with-pipelex/define_your_concepts/#native-concepts-and-their-structures"+ )+ raise ConceptRefineError(msg)diff --git a/pipelex/core/domains/domain_blueprint.py b/pipelex/core/domains/domain_blueprint.pyindex 9ec0f637b..5cdceecaf 100644--- a/pipelex/core/domains/domain_blueprint.py+++ b/pipelex/core/domains/domain_blueprint.py@@ -1,8 +1,5 @@from pydantic import BaseModel, ConfigDict-from pipelex.core.domains.exceptions import DomainError-from pipelex.tools.misc.string_utils import is_snake_case-class DomainBlueprint(BaseModel):model_config = ConfigDict(extra="forbid")@@ -11,10 +8,3 @@ class DomainBlueprint(BaseModel):description: strsystem_prompt: str | None = Nonemain_pipe: str | None = None-- @staticmethod- def validate_domain_code(code: str) -> None:- """Validate that a domain code follows snake_case convention."""- if not is_snake_case(code):- msg = f"Domain code '{code}' must be snake_case (lowercase letters, numbers, and underscores only)"- raise DomainError(msg)diff --git a/pipelex/core/domains/domain_factory.py b/pipelex/core/domains/domain_factory.pyindex bab5839a7..7c3fdf697 100644--- a/pipelex/core/domains/domain_factory.py+++ b/pipelex/core/domains/domain_factory.py@@ -2,7 +2,7 @@ from pydantic import ValidationErrorfrom pipelex.core.domains.domain import Domainfrom pipelex.core.domains.domain_blueprint import DomainBlueprint-from pipelex.exceptions import DomainDefinitionError+from pipelex.core.domains.exceptions import DomainDefinitionErrorfrom pipelex.tools.typing.pydantic_utils import format_pydantic_validation_errordiff --git a/pipelex/core/domains/domain_library.py b/pipelex/core/domains/domain_library.pyindex 7a757160b..39e370fee 100644--- a/pipelex/core/domains/domain_library.py+++ b/pipelex/core/domains/domain_library.py@@ -3,7 +3,7 @@ from typing_extensions import overridefrom pipelex.core.domains.domain import Domainfrom pipelex.core.domains.domain_library_abstract import DomainLibraryAbstract-from pipelex.exceptions import DomainLibraryError+from pipelex.libraries.exceptions import DomainLibraryErrorfrom pipelex.types import SelfDomainLibraryRoot = dict[str, Domain]diff --git a/pipelex/core/domains/exceptions.py b/pipelex/core/domains/exceptions.pyindex 24c45ca08..f1d7a3c70 100644--- a/pipelex/core/domains/exceptions.py+++ b/pipelex/core/domains/exceptions.py@@ -1,2 +1,13 @@-class DomainError(Exception):+from pipelex.base_exceptions import PipelexException+++class DomainCodeError(PipelexException):pass+++class DomainDefinitionError(PipelexException):+ def __init__(self, message: str, domain_code: str, description: str, source: str | None = None):+ self.domain_code = domain_code+ self.description = description+ self.source = source+ super().__init__(message)diff --git a/pipelex/core/domains/validation.py b/pipelex/core/domains/validation.pynew file mode 100644index 000000000..9d3c1f00b--- /dev/null+++ b/pipelex/core/domains/validation.py@@ -0,0 +1,12 @@+from pipelex.core.domains.exceptions import DomainCodeError+from pipelex.tools.misc.string_utils import is_snake_case+++def is_domain_code_valid(code: str) -> bool:+ return is_snake_case(code)+++def validate_domain_code(code: str) -> None:+ if not is_domain_code_valid(code=code):+ msg = f"Domain code '{code}' is not a valid domain code. It should be in snake_case."+ raise DomainCodeError(msg)diff --git a/pipelex/core/exceptions.py b/pipelex/core/exceptions.pyindex 2d2f5ccae..37577c49e 100644--- a/pipelex/core/exceptions.py+++ b/pipelex/core/exceptions.py@@ -1,13 +1,72 @@-"""Custom exceptions for the Pipelex core module."""+from pydantic import BaseModel+from typing_extensions import override+from pipelex.base_exceptions import PipelexException+from pipelex.core.pipes.exceptions import StaticValidationErrorType-class PipelexInterpreterError(Exception):- """Base exception class for PipelexInterpreter errors."""--class PipelexConfigurationError(PipelexInterpreterError):+class PipelexConfigurationError(PipelexException):"""Raised when there are configuration issues with the PipelexInterpreter."""-class PipelexUnknownPipeError(PipelexInterpreterError):- """Raised when encountering an unknown pipe blueprint type."""+class SyntaxErrorData(BaseModel):+ message: str+ lineno: int | None = None+ offset: int | None = None+ text: str | None = None+ end_lineno: int | None = None+ end_offset: int | None = None++ @classmethod+ def from_syntax_error(cls, syntax_error: SyntaxError) -> "SyntaxErrorData":+ return cls(+ message=syntax_error.msg,+ lineno=syntax_error.lineno,+ offset=syntax_error.offset,+ text=syntax_error.text,+ end_lineno=syntax_error.end_lineno,+ end_offset=syntax_error.end_offset,+ )+++class StaticValidationError(Exception):+ def __init__(+ self,+ error_type: StaticValidationErrorType,+ domain: str,+ pipe_code: str | None = None,+ variable_names: list[str] | None = None,+ required_concept_codes: list[str] | None = None,+ provided_concept_code: str | None = None,+ file_path: str | None = None,+ explanation: str | None = None,+ ):+ self.error_type = error_type+ self.domain = domain+ self.pipe_code = pipe_code+ self.variable_names = variable_names+ self.required_concept_codes = required_concept_codes+ self.provided_concept_code = provided_concept_code+ self.file_path = file_path+ self.explanation = explanation+ super().__init__()++ def desc(self) -> str:+ msg = f"{self.error_type} • domain='{self.domain}'"+ if self.pipe_code:+ msg += f" • pipe='{self.pipe_code}'"+ if self.variable_names:+ msg += f" • variable='{self.variable_names}'"+ if self.required_concept_codes:+ msg += f" • required_concept_codes='{self.required_concept_codes}'"+ if self.provided_concept_code:+ msg += f" • provided_concept_code='{self.provided_concept_code}'"+ if self.file_path:+ msg += f" • file='{self.file_path}'"+ if self.explanation:+ msg += f" • explanation='{self.explanation}'"+ return msg++ @override+ def __str__(self) -> str:+ return self.desc()diff --git a/pipelex/core/interpreter.py b/pipelex/core/interpreter.pyindex 31cb0116b..fc67f1ced 100644--- a/pipelex/core/interpreter.py+++ b/pipelex/core/interpreter.py@@ -3,9 +3,7 @@ from pathlib import Pathfrom pydantic import BaseModel, model_validatorfrom pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprint-from pipelex.core.exceptions import (- PipelexConfigurationError,-)+from pipelex.core.exceptions import PipelexConfigurationErrorfrom pipelex.tools.misc.toml_utils import TomlError, load_toml_from_content, load_toml_from_pathfrom pipelex.types import Selfdiff --git a/pipelex/core/memory/exceptions.py b/pipelex/core/memory/exceptions.pynew file mode 100644index 000000000..82793b2e0--- /dev/null+++ b/pipelex/core/memory/exceptions.py@@ -0,0 +1,33 @@+from pipelex.base_exceptions import PipelexException+from pipelex.tools.misc.context_provider_abstract import ContextProviderException+++class WorkingMemoryFactoryError(PipelexException):+ pass+++class WorkingMemoryError(PipelexException):+ pass+++class WorkingMemoryConsistencyError(WorkingMemoryError):+ pass+++class WorkingMemoryVariableError(WorkingMemoryError, ContextProviderException):+ pass+++class WorkingMemoryTypeError(WorkingMemoryVariableError):+ pass+++class WorkingMemoryStuffAttributeNotFoundError(WorkingMemoryVariableError):+ pass+++class WorkingMemoryStuffNotFoundError(WorkingMemoryVariableError):+ def __init__(self, message: str, variable_name: str, pipe_code: str | None = None, concept_code: str | None = None):+ super().__init__(message, variable_name)+ self.pipe_code = pipe_code+ self.concept_code = concept_codediff --git a/pipelex/core/memory/working_memory.py b/pipelex/core/memory/working_memory.pyindex 32673afe6..aad3fc46e 100644--- a/pipelex/core/memory/working_memory.py+++ b/pipelex/core/memory/working_memory.py@@ -5,6 +5,12 @@ from pydantic import BaseModel, Field, model_validatorfrom typing_extensions import overridefrom pipelex import log, pretty_print+from pipelex.core.memory.exceptions import (+ WorkingMemoryConsistencyError,+ WorkingMemoryStuffAttributeNotFoundError,+ WorkingMemoryStuffNotFoundError,+ WorkingMemoryTypeError,+)from pipelex.core.stuffs.html_content import HtmlContentfrom pipelex.core.stuffs.image_content import ImageContentfrom pipelex.core.stuffs.list_content import ListContent@@ -16,12 +22,6 @@ from pipelex.core.stuffs.stuff_artefact import StuffArtefactfrom pipelex.core.stuffs.stuff_content import StuffContentTypefrom pipelex.core.stuffs.text_and_images_content import TextAndImagesContentfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import (- WorkingMemoryConsistencyError,- WorkingMemoryStuffAttributeNotFoundError,- WorkingMemoryStuffNotFoundError,- WorkingMemoryTypeError,-)from pipelex.tools.misc.context_provider_abstract import ContextProviderAbstractfrom pipelex.types import Selfdiff --git a/pipelex/core/memory/working_memory_factory.py b/pipelex/core/memory/working_memory_factory.pyindex 0d3c06cf0..9df54e352 100644--- a/pipelex/core/memory/working_memory_factory.py+++ b/pipelex/core/memory/working_memory_factory.py@@ -6,8 +6,10 @@ from pydantic import BaseModelfrom pipelex import logfrom pipelex.client.protocol import PipelineInputs-from pipelex.core.concepts.concept import ConceptBlueprint, SpecialDomain+from pipelex.core.concepts.concept import SpecialDomainfrom pipelex.core.concepts.concept_native import NativeConceptCode+from pipelex.core.concepts.validation import validate_concept_string+from pipelex.core.memory.exceptions import WorkingMemoryFactoryErrorfrom pipelex.core.memory.working_memory import MAIN_STUFF_NAME, StuffDict, WorkingMemoryfrom pipelex.core.pipes.input_requirements import TypedNamedInputRequirementfrom pipelex.core.stuffs.image_content import ImageContent@@ -17,7 +19,6 @@ from pipelex.core.stuffs.stuff import Stufffrom pipelex.core.stuffs.stuff_content import StuffContentfrom pipelex.core.stuffs.stuff_factory import StuffFactoryfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import WorkingMemoryFactoryErrorfrom pipelex.hub import get_required_concept@@ -29,7 +30,7 @@ class WorkingMemoryFactory(BaseModel):concept_string: str = SpecialDomain.NATIVE + "." + NativeConceptCode.TEXT,name: str | None = "text",) -> WorkingMemory:- ConceptBlueprint.validate_concept_string(concept_string=concept_string)+ validate_concept_string(concept_string=concept_string)return cls.make_from_single_stuff(stuff=StuffFactory.make_stuff(concept=get_required_concept(concept_string=concept_string),@@ -46,7 +47,7 @@ class WorkingMemoryFactory(BaseModel):name: str | None = "image",) -> WorkingMemory:# TODO: validate that the concept is compatible with an image concept- ConceptBlueprint.validate_concept_string(concept_string=concept_string)+ validate_concept_string(concept_string=concept_string)stuff = StuffFactory.make_stuff(concept=get_required_concept(concept_string=concept_string),content=ImageContent(url=image_url),@@ -61,7 +62,7 @@ class WorkingMemoryFactory(BaseModel):concept_string: str = SpecialDomain.NATIVE + "." + NativeConceptCode.PDF,name: str | None = "pdf",) -> WorkingMemory:- ConceptBlueprint.validate_concept_string(concept_string=concept_string)+ validate_concept_string(concept_string=concept_string)return cls.make_from_single_stuff(stuff=StuffFactory.make_stuff(concept=get_required_concept(concept_string=concept_string),diff --git a/pipelex/core/pipes/exceptions.py b/pipelex/core/pipes/exceptions.pyindex 0fae11bce..d48eff3bf 100644--- a/pipelex/core/pipes/exceptions.py+++ b/pipelex/core/pipes/exceptions.py@@ -1,2 +1,86 @@-class PipeBlueprintError(Exception):- """Exception raised for errors in the PipeBlueprint class."""+from pydantic import BaseModel, Field+from typing_extensions import override++from pipelex.base_exceptions import PipelexException+from pipelex.cogt.extract.extract_setting import ExtractModelChoice+from pipelex.cogt.img_gen.img_gen_setting import ImgGenModelChoice+from pipelex.cogt.llm.llm_setting import LLMModelChoice+from pipelex.cogt.model_backends.model_type import ModelType+from pipelex.types import StrEnum+++class PipeBlueprintValueError(ValueError):+ pass+++class PipeInputNotFoundError(PipelexException):+ pass+++class PipeFactoryError(PipelexException):+ pass+++class PipeInputError(PipelexException):+ def __init__(self, message: str, pipe_code: str, variable_name: str, concept_code: str | None = None):+ self.pipe_code = pipe_code+ self.variable_name = variable_name+ self.concept_code = concept_code+ super().__init__(message)+++class PipeRunInputsError(PipelexException):+ def __init__(self, message: str, pipe_code: str, missing_inputs: dict[str, str]):+ self.pipe_code = pipe_code+ self.missing_inputs = missing_inputs+ super().__init__(message)+++class PipeDefinitionErrorData(BaseModel):+ message: str = Field(description="The error message")+ domain_code: str | None = Field(None, description="The domain code")+ pipe_code: str | None = Field(None, description="The pipe code")+ description: str | None = Field(None, description="Description of the pipe")+ source: str | None = Field(None, description="Source of the error")+++class StaticValidationErrorType(StrEnum):+ MISSING_INPUT_VARIABLE = "missing_input_variable"+ EXTRANEOUS_INPUT_VARIABLE = "extraneous_input_variable"+ INADEQUATE_INPUT_CONCEPT = "inadequate_input_concept"+ TOO_MANY_CANDIDATE_INPUTS = "too_many_candidate_inputs"+++class PipeOperatorModelChoiceError(PipelexException):+ def __init__(+ self,+ message: str,+ pipe_type: str,+ pipe_code: str,+ model_type: ModelType,+ model_choice: LLMModelChoice | ExtractModelChoice | ImgGenModelChoice,+ ):+ self.pipe_type = pipe_type+ self.pipe_code = pipe_code+ self.model_type = model_type+ self.model_choice = model_choice+ super().__init__(message)++ def desc(self) -> str:+ msg = f"{self.message}"+ msg += f" • pipe='{self.pipe_code}' ({self.pipe_type})"+ msg += f" • model_type='{self.model_type}'"++ # Extract the choice identifier from the model_choice union type+ if isinstance(self.model_choice, str):+ # It's a preset/alias string+ msg += f" • choice='{self.model_choice}'"+ else:+ # It's a Setting object with a model field and optional desc()+ msg += f" • choice={self.model_choice.desc()}"++ return msg++ @override+ def __str__(self) -> str:+ return self.desc()diff --git a/pipelex/core/pipes/input_requirements.py b/pipelex/core/pipes/input_requirements.pyindex 207c62465..b733aeaec 100644--- a/pipelex/core/pipes/input_requirements.py+++ b/pipelex/core/pipes/input_requirements.py@@ -4,9 +4,9 @@ from pydantic import BaseModel, Field, RootModel, field_validatorfrom pipelex import logfrom pipelex.core.concepts.concept import Concept+from pipelex.core.pipes.exceptions import PipeInputNotFoundErrorfrom pipelex.core.pipes.variable_multiplicity import VariableMultiplicityfrom pipelex.core.stuffs.stuff_content import StuffContent-from pipelex.exceptions import PipeInputNotFoundErrorclass InputRequirement(BaseModel):diff --git a/pipelex/core/pipes/input_requirements_factory.py b/pipelex/core/pipes/input_requirements_factory.pyindex b8bc7dfb6..d5d82a12a 100644--- a/pipelex/core/pipes/input_requirements_factory.py+++ b/pipelex/core/pipes/input_requirements_factory.py@@ -1,17 +1,18 @@import refrom typing import TYPE_CHECKING-from pipelex.core.concepts.concept_blueprint import ConceptBlueprint+from pipelex.base_exceptions import PipelexExceptionfrom pipelex.core.concepts.concept_factory import ConceptFactory+from pipelex.core.concepts.exceptions import ConceptStringError+from pipelex.core.concepts.validation import validate_concept_string_or_codefrom pipelex.core.pipes.input_requirements import InputRequirement, InputRequirements-from pipelex.exceptions import PipelexExceptionfrom pipelex.hub import get_required_conceptif TYPE_CHECKING:from pipelex.core.pipes.variable_multiplicity import VariableMultiplicity-class InputRequirementsFactorySyntaxError(PipelexException):+class InputRequirementsFactoryError(PipelexException):pass@@ -61,7 +62,7 @@ class InputRequirementsFactory:InputRequirement with the parsed concept and multiplicityRaises:- InputRequirementsFactorySyntaxError: If the requirement string format is invalid+ InputRequirementsFactorySyInputRequirementsFactoryErrorntaxError: If the requirement string format is invalid"""# Pattern to match concept string and optional multiplicity brackets# Group 1: concept string (everything before brackets)@@ -71,13 +72,18 @@ class InputRequirementsFactory:if not match:msg = f"Invalid input requirement string: {requirement_str}"- raise InputRequirementsFactorySyntaxError(msg)+ raise InputRequirementsFactoryError(msg)concept_string_or_code = match.group(1)multiplicity_str = match.group(2)# Validate and resolve concept string with domain- ConceptBlueprint.validate_concept_string_or_code(concept_string_or_code=concept_string_or_code)+ try:+ validate_concept_string_or_code(concept_string_or_code=concept_string_or_code)+ except ConceptStringError as exc:+ msg = f"Invalid concept string '{concept_string_or_code}' when trying to make an 'InputRequirement' from string: {exc}"+ raise InputRequirementsFactoryError(msg) from exc+concept_string_with_domain = ConceptFactory.make_concept_string_with_domain_from_concept_string_or_code(domain=domain,concept_sring_or_code=concept_string_or_code,diff --git a/pipelex/core/pipes/pipe_abstract.py b/pipelex/core/pipes/pipe_abstract.pyindex 0d1e03d31..f59baaf88 100644--- a/pipelex/core/pipes/pipe_abstract.py+++ b/pipelex/core/pipes/pipe_abstract.py@@ -6,12 +6,13 @@ from pydantic import BaseModel, ConfigDict, Field, field_validatorfrom pipelex.cogt.exceptions import ModelChoiceNotFoundErrorfrom pipelex.core.concepts.concept import Conceptfrom pipelex.core.memory.working_memory import WorkingMemory+from pipelex.core.pipes.exceptions import PipeOperatorModelChoiceErrorfrom pipelex.core.pipes.input_requirements import InputRequirementsfrom pipelex.core.pipes.pipe_blueprint import PipeBlueprintfrom pipelex.core.pipes.pipe_output import PipeOutput-from pipelex.exceptions import PipeOperatorModelChoiceError, PipeStackOverflowErrorfrom pipelex.pipe_run.pipe_run_mode import PipeRunModefrom pipelex.pipe_run.pipe_run_params import PipeRunParams+from pipelex.pipeline.exceptions import PipeStackOverflowErrorfrom pipelex.pipeline.job_metadata import JobMetadatadiff --git a/pipelex/core/pipes/pipe_blueprint.py b/pipelex/core/pipes/pipe_blueprint.pyindex 1028f3237..701979416 100644--- a/pipelex/core/pipes/pipe_blueprint.py+++ b/pipelex/core/pipes/pipe_blueprint.py@@ -1,10 +1,13 @@+import refrom typing import Anyfrom pydantic import BaseModel, ConfigDict, Field, field_validator-from pipelex.core.concepts.concept_blueprint import ConceptBlueprint-from pipelex.core.pipes.exceptions import PipeBlueprintError-from pipelex.core.pipes.variable_multiplicity import parse_concept_with_multiplicity+from pipelex.core.concepts.exceptions import ConceptStringError+from pipelex.core.concepts.validation import validate_concept_string_or_code+from pipelex.core.pipes.exceptions import PipeBlueprintValueError+from pipelex.core.pipes.validation import validate_input_name+from pipelex.core.pipes.variable_multiplicity import MUTLIPLICITY_PATTERN, parse_concept_with_multiplicityfrom pipelex.tools.misc.string_utils import is_snake_casefrom pipelex.types import StrEnum@@ -107,13 +110,40 @@ class PipeBlueprint(BaseModel):"""return None+ @field_validator("inputs", mode="after")+ @classmethod+ def validate_inputs(cls, inputs: dict[str, str] | None) -> dict[str, str] | None:+ if inputs is None:+ return None++ # Pattern allows: ConceptName, domain.ConceptName, ConceptName[], ConceptName[N]+ multiplicity_pattern = MUTLIPLICITY_PATTERN++ for input_name, concept_spec in inputs.items():+ validate_input_name(input_name)++ # Validate the concept spec format with optional multiplicity brackets+ match = re.match(multiplicity_pattern, concept_spec)+ if not match:+ msg = (+ f"Invalid input syntax for '{input_name}': '{concept_spec}'. "+ f"Expected format: 'ConceptName', 'ConceptName[]', or 'ConceptName[N]' where N is an integer."+ )+ raise PipeBlueprintValueError(msg)++ # Extract the concept part (without multiplicity) and validate it+ concept_string_or_code = match.group(1)+ validate_concept_string_or_code(concept_string_or_code=concept_string_or_code)++ return inputs+@field_validator("type", mode="after")@classmethoddef validate_pipe_type(cls, value: Any) -> Any:"""Validate that the pipe type is one of the allowed values."""if value not in AllowedPipeTypes.value_list():msg = f"Invalid pipe type '{value}'. Must be one of: {AllowedPipeTypes.value_list()}"- raise PipeBlueprintError(msg)+ raise PipeBlueprintValueError(msg)return value@field_validator("pipe_category", mode="after")@@ -122,7 +152,7 @@ class PipeBlueprint(BaseModel):"""Validate that the pipe category is one of the allowed values."""if value not in AllowedPipeCategories.value_list():msg = f"Invalid pipe category '{value}'. Must be one of: {AllowedPipeCategories.value_list()}"- raise PipeBlueprintError(msg)+ raise PipeBlueprintValueError(msg)return value@field_validator("output", mode="before")@@ -130,12 +160,16 @@ class PipeBlueprint(BaseModel):def validate_output(cls, output: str) -> str:# Strip multiplicity brackets before validatingoutput_parse_result = parse_concept_with_multiplicity(output)- ConceptBlueprint.validate_concept_string_or_code(concept_string_or_code=output_parse_result.concept)- return output # Return with brackets intact+ try:+ validate_concept_string_or_code(concept_string_or_code=output_parse_result.concept)+ except ConceptStringError as exc:+ msg = f"Invalid concept string '{output_parse_result.concept}' when trying to validate the output of a pipe blueprint: {exc}"+ raise PipeBlueprintValueError(msg) from exc+ return output@classmethoddef validate_pipe_code_syntax(cls, pipe_code: str) -> str:if not is_snake_case(pipe_code):msg = f"Invalid pipe code syntax '{pipe_code}'. Must be in snake_case."- raise PipeBlueprintError(msg)+ raise PipeBlueprintValueError(msg)return pipe_codediff --git a/pipelex/core/pipes/pipe_factory.py b/pipelex/core/pipes/pipe_factory.pyindex 1b9bfc37d..e2dabc5d6 100644--- a/pipelex/core/pipes/pipe_factory.py+++ b/pipelex/core/pipes/pipe_factory.py@@ -4,9 +4,9 @@ from kajson.exceptions import ClassRegistryInheritanceError, ClassRegistryNotFoufrom kajson.kajson_manager import KajsonManagerfrom typing_extensions import override, runtime_checkable+from pipelex.core.pipes.exceptions import PipeFactoryErrorfrom pipelex.core.pipes.pipe_abstract import PipeAbstractfrom pipelex.core.pipes.pipe_blueprint import PipeBlueprint-from pipelex.exceptions import PipeFactoryErrorPipeBlueprintType = TypeVar("PipeBlueprintType", bound="PipeBlueprint", contravariant=True)PipeType = TypeVar("PipeType", bound="PipeAbstract", covariant=True)diff --git a/pipelex/core/pipes/pipe_library.py b/pipelex/core/pipes/pipe_library.pyindex d139d0206..9d404a8d5 100644--- a/pipelex/core/pipes/pipe_library.py+++ b/pipelex/core/pipes/pipe_library.py@@ -6,10 +6,11 @@ from rich.table import Tablefrom typing_extensions import overridefrom pipelex import pretty_print+from pipelex.core.concepts.exceptions import ConceptError, ConceptLibraryConceptNotFoundErrorfrom pipelex.core.pipes.pipe_abstract import PipeAbstractfrom pipelex.core.pipes.pipe_library_abstract import PipeLibraryAbstract-from pipelex.exceptions import ConceptError, ConceptLibraryConceptNotFoundError, PipeLibraryError, PipeLibraryPipeNotFoundErrorfrom pipelex.hub import get_concept_library+from pipelex.libraries.exceptions import PipeLibraryError, PipeLibraryPipeNotFoundErrorfrom pipelex.types import SelfPipeLibraryRoot = dict[str, PipeAbstract]diff --git a/pipelex/core/pipes/validation.py b/pipelex/core/pipes/validation.pynew file mode 100644index 000000000..64aef7d29--- /dev/null+++ b/pipelex/core/pipes/validation.py@@ -0,0 +1,72 @@+from pipelex.core.pipes.exceptions import PipeBlueprintValueError+from pipelex.tools.misc.string_utils import is_snake_case+++def is_valid_input_name(input_name: str) -> bool:+ """Check if an input name is valid.++ An input name is valid if:+ - It's not empty+ - It doesn't start or end with a dot+ - All parts separated by dots are in snake_case+ - There are no consecutive dots++ Args:+ input_name: The input name to validate++ Returns:+ bool: True if the input name is valid, False otherwise++ Examples:+ >>> is_valid_input_name("my_input")+ True+ >>> is_valid_input_name("my_input.field_name")+ True+ >>> is_valid_input_name("my_input.field_name.nested_field")+ True+ >>> is_valid_input_name("myInput")+ False+ >>> is_valid_input_name("my_input.fieldName")+ False+ >>> is_valid_input_name("")+ False+ >>> is_valid_input_name(".")+ False+ >>> is_valid_input_name(".my_input")+ False+ >>> is_valid_input_name("my_input.")+ False+ >>> is_valid_input_name("my_input..field")+ False++ """+ if not input_name:+ return False++ # Check for leading/trailing dots or consecutive dots+ if input_name.startswith(".") or input_name.endswith(".") or ".." in input_name:+ return False++ # Split by dots and validate each part is snake_case+ parts = input_name.split(".")+ return all(is_snake_case(part) for part in parts)+++def validate_input_name(input_name: str) -> None:+ """Validate an input name and raise an error if invalid.++ Args:+ input_name: The input name to validate++ Raises:+ PipeBlueprintValueError: If the input name is invalid++ """+ if not is_valid_input_name(input_name):+ msg = (+ f"Invalid input name syntax '{input_name}'. "+ "Input names must be in snake_case. "+ "Nested field access is allowed using dots (e.g., 'my_input.field_name'), "+ "where each part must also be in snake_case."+ )+ raise PipeBlueprintValueError(msg)diff --git a/pipelex/core/pipes/variable_multiplicity.py b/pipelex/core/pipes/variable_multiplicity.pyindex 5df9d2693..88d3a07eb 100644--- a/pipelex/core/pipes/variable_multiplicity.py+++ b/pipelex/core/pipes/variable_multiplicity.py@@ -6,6 +6,8 @@ from pydantic import BaseModel, FieldVariableMultiplicity = bool | int+MUTLIPLICITY_PATTERN = r"^([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)?)(?:\[(\d*)\])?$"+class VariableMultiplicityResolution(BaseModel):"""Result of resolving output multiplicity settings between base and override values."""diff --git a/pipelex/core/stuffs/exceptions.py b/pipelex/core/stuffs/exceptions.pynew file mode 100644index 000000000..12e763462--- /dev/null+++ b/pipelex/core/stuffs/exceptions.py@@ -0,0 +1,30 @@+from pipelex.base_exceptions import PipelexException+++class StuffArtefactError(PipelexException):+ pass+++class StuffArtefactReservedFieldError(StuffArtefactError):+ pass+++class StuffError(PipelexException):+ pass+++class StuffContentTypeError(StuffError):+ def __init__(self, message: str, expected_type: str, actual_type: str):+ self.expected_type = expected_type+ self.actual_type = actual_type+ super().__init__(message)+++class StuffContentValidationError(StuffError):+ """Raised when content validation fails during type conversion."""++ def __init__(self, original_type: str, target_type: str, validation_error: str):+ self.original_type = original_type+ self.target_type = target_type+ self.validation_error = validation_error+ super().__init__(f"Failed to validate content from {original_type} to {target_type}: {validation_error}")diff --git a/pipelex/core/stuffs/stuff.py b/pipelex/core/stuffs/stuff.pyindex 0cda69dc2..b3aea6cae 100644--- a/pipelex/core/stuffs/stuff.py+++ b/pipelex/core/stuffs/stuff.py@@ -5,6 +5,7 @@ from typing_extensions import overridefrom pipelex import logfrom pipelex.core.concepts.concept import Concept+from pipelex.core.stuffs.exceptions import StuffArtefactReservedFieldError, StuffContentTypeError, StuffContentValidationErrorfrom pipelex.core.stuffs.html_content import HtmlContentfrom pipelex.core.stuffs.image_content import ImageContentfrom pipelex.core.stuffs.list_content import ListContent@@ -15,7 +16,6 @@ from pipelex.core.stuffs.stuff_artefact import StuffArtefactfrom pipelex.core.stuffs.stuff_content import StuffContent, StuffContentTypefrom pipelex.core.stuffs.text_and_images_content import TextAndImagesContentfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import StuffArtefactReservedFieldError, StuffContentTypeError, StuffContentValidationErrorfrom pipelex.tools.misc.string_utils import pascal_case_to_snake_casefrom pipelex.tools.typing.pydantic_utils import CustomBaseModel, format_pydantic_validation_errordiff --git a/pipelex/core/stuffs/stuff_artefact.py b/pipelex/core/stuffs/stuff_artefact.pyindex 9b9c9bf23..861f1fcdb 100644--- a/pipelex/core/stuffs/stuff_artefact.py+++ b/pipelex/core/stuffs/stuff_artefact.py@@ -5,8 +5,8 @@ from pydantic import RootModelfrom typing_extensions import overridefrom pipelex.cogt.templating.templating_style import TextFormat+from pipelex.core.stuffs.exceptions import StuffArtefactErrorfrom pipelex.core.stuffs.stuff_content import StuffContent-from pipelex.exceptions import StuffArtefactErrorfrom pipelex.tools.jinja2.jinja2_models import Jinja2ContextKey, Jinja2TaggableAbstractdiff --git a/pipelex/core/stuffs/stuff_factory.py b/pipelex/core/stuffs/stuff_factory.pyindex 85a9d2c90..7a2a43c6f 100644--- a/pipelex/core/stuffs/stuff_factory.py+++ b/pipelex/core/stuffs/stuff_factory.py@@ -3,18 +3,18 @@ from typing import Any, castimport shortuuidfrom pydantic import BaseModel, ValidationError, field_validator+from pipelex.base_exceptions import PipelexExceptionfrom pipelex.client.protocol import StuffContentOrDatafrom pipelex.core.concepts.concept import Concept-from pipelex.core.concepts.concept_blueprint import ConceptBlueprintfrom pipelex.core.concepts.concept_factory import ConceptFactoryfrom pipelex.core.concepts.concept_library import ConceptLibraryConceptNotFoundErrorfrom pipelex.core.concepts.concept_native import NativeConceptCode+from pipelex.core.concepts.validation import validate_concept_stringfrom pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.structured_content import StructuredContentfrom pipelex.core.stuffs.stuff import DictStuff, Stufffrom pipelex.core.stuffs.stuff_content import StuffContentfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import PipelexExceptionfrom pipelex.hub import get_class_registry, get_concept_library, get_native_concept, get_required_conceptfrom pipelex.tools.typing.pydantic_utils import format_pydantic_validation_error@@ -30,8 +30,8 @@ class StuffBlueprint(BaseModel):@field_validator("concept_string")@classmethod- def validate_concept_string(cls, concept_string: str) -> str:- ConceptBlueprint.validate_concept_string(concept_string)+ def validate_concept_string_field(cls, concept_string: str) -> str:+ validate_concept_string(concept_string)return concept_string@@ -50,7 +50,7 @@ class StuffFactory:@classmethoddef make_from_concept_string(cls, concept_string: str, name: str, content: StuffContent) -> Stuff:- ConceptBlueprint.validate_concept_string(concept_string)+ validate_concept_string(concept_string)concept = get_required_concept(concept_string=concept_string)return cls.make_stuff(concept=concept,diff --git a/pipelex/core/validation_errors.py b/pipelex/core/validation_errors.pydeleted file mode 100644index d5e8566d7..000000000--- a/pipelex/core/validation_errors.py+++ /dev/null@@ -1,9 +0,0 @@-from abc import ABC, abstractmethod--from pipelex.builder.validation_error_data import ConceptDefinitionErrorData---class PipelexValidationExceptionAbstract(Exception, ABC):- @abstractmethod- def get_concept_definition_errors(self) -> list[ConceptDefinitionErrorData]:- passdiff --git a/pipelex/exceptions.py b/pipelex/exceptions.pyindex b10ed11be..dbc7cb79c 100644--- a/pipelex/exceptions.py+++ b/pipelex/exceptions.py@@ -1,539 +1,169 @@-from __future__ import annotations--from typing import TYPE_CHECKING--from click import ClickException-from typing_extensions import override--from pipelex.builder.validation_error_data import (+from pipelex.client.exceptions import ClientAuthenticationError+from pipelex.core.bundles.exceptions import PipelexBundleBlueprintValueError+from pipelex.core.concepts.exceptions import (+ ConceptBlueprintValueError,+ ConceptCodeError,+ ConceptDefinitionError,ConceptDefinitionErrorData,- LibraryLoadingErrorData,+ ConceptError,+ ConceptFactoryError,+ ConceptLibraryConceptNotFoundError,+ ConceptRefineError,+ ConceptStringError,+ ConceptStructureBlueprintValueError,+ ConceptStructureGeneratorError,+ ConceptStructureValidationError,+ PipelexValidationExceptionAbstract,+ StructureClassError,+)+from pipelex.core.domains.exceptions import DomainCodeError, DomainDefinitionError+from pipelex.core.exceptions import PipelexConfigurationError, StaticValidationError, SyntaxErrorData+from pipelex.core.memory.exceptions import (+ WorkingMemoryConsistencyError,+ WorkingMemoryError,+ WorkingMemoryFactoryError,+ WorkingMemoryStuffAttributeNotFoundError,+ WorkingMemoryStuffNotFoundError,+ WorkingMemoryVariableError,+)+from pipelex.core.pipes.exceptions import (+ PipeBlueprintValueError,PipeDefinitionErrorData,+ PipeFactoryError,+ PipeInputError,+ PipeInputNotFoundError,+ PipeOperatorModelChoiceError,+ PipeRunInputsError,StaticValidationErrorType,- SyntaxErrorData,)-from pipelex.core.validation_errors import PipelexValidationExceptionAbstract-from pipelex.system.exceptions import RootException-from pipelex.tools.misc.context_provider_abstract import ContextProviderException--if TYPE_CHECKING:- from pipelex.cogt.extract.extract_setting import ExtractModelChoice- from pipelex.cogt.img_gen.img_gen_setting import ImgGenModelChoice- from pipelex.cogt.llm.llm_setting import LLMModelChoice- from pipelex.cogt.model_backends.model_type import ModelType- from pipelex.cogt.templating.template_category import TemplateCategory- from pipelex.pipe_run.pipe_run_mode import PipeRunMode---class PipelexException(RootException):- pass---class PipelexUnexpectedError(PipelexException):- pass---class StaticValidationError(Exception):- def __init__(- self,- error_type: StaticValidationErrorType,- domain: str,- pipe_code: str | None = None,- variable_names: list[str] | None = None,- required_concept_codes: list[str] | None = None,- provided_concept_code: str | None = None,- file_path: str | None = None,- explanation: str | None = None,- ):- self.error_type = error_type- self.domain = domain- self.pipe_code = pipe_code- self.variable_names = variable_names- self.required_concept_codes = required_concept_codes- self.provided_concept_code = provided_concept_code- self.file_path = file_path- self.explanation = explanation- super().__init__()-- def desc(self) -> str:- msg = f"{self.error_type} • domain='{self.domain}'"- if self.pipe_code:- msg += f" • pipe='{self.pipe_code}'"- if self.variable_names:- msg += f" • variable='{self.variable_names}'"- if self.required_concept_codes:- msg += f" • required_concept_codes='{self.required_concept_codes}'"- if self.provided_concept_code:- msg += f" • provided_concept_code='{self.provided_concept_code}'"- if self.file_path:- msg += f" • file='{self.file_path}'"- if self.explanation:- msg += f" • explanation='{self.explanation}'"- return msg-- @override- def __str__(self) -> str:- return self.desc()---class WorkingMemoryFactoryError(PipelexException):- pass---class WorkingMemoryError(PipelexException):- pass---class WorkingMemoryConsistencyError(WorkingMemoryError):- pass---class WorkingMemoryVariableError(WorkingMemoryError, ContextProviderException):- pass---class WorkingMemoryTypeError(WorkingMemoryVariableError):- pass---class WorkingMemoryStuffAttributeNotFoundError(WorkingMemoryVariableError):- pass---class WorkingMemoryStuffNotFoundError(WorkingMemoryVariableError):- def __init__(self, message: str, variable_name: str, pipe_code: str | None = None, concept_code: str | None = None):- super().__init__(message, variable_name)- self.pipe_code = pipe_code- self.concept_code = concept_code---class PipelexCLIError(PipelexException, ClickException):- """Raised when there's an error in CLI usage or operation."""---class VirtualEnvironmentError(PipelexCLIError):- """Raised when the CLI is run outside the required virtual environment."""---class ReadinessCheckError(PipelexCLIError):- """Raised when readiness checks fail (missing dependencies or dev mode without venv)."""---class PipelexConfigError(PipelexException):- pass---class PipelexSetupError(PipelexException):- pass---class ClientAuthenticationError(PipelexException):- pass---class ConceptLibraryConceptNotFoundError(PipelexException):- pass---class LibraryError(PipelexException):- pass---class LibraryLoadingError(LibraryError, PipelexValidationExceptionAbstract):- """Error raised when loading library components fails."""-- def __init__(- self,- message: str,- concept_definition_errors: list[ConceptDefinitionErrorData] | None = None,- pipe_definition_errors: list[PipeDefinitionErrorData] | None = None,- ):- self.concept_definition_errors = concept_definition_errors- self.pipe_definition_errors = pipe_definition_errors- super().__init__(message)-- @override- def get_concept_definition_errors(self) -> list[ConceptDefinitionErrorData]:- return self.concept_definition_errors or []-- def as_structured_content(self) -> LibraryLoadingErrorData:- return LibraryLoadingErrorData(- message=str(self),- concept_definition_errors=self.concept_definition_errors,- pipe_definition_errors=self.pipe_definition_errors,- )---class DomainLibraryError(LibraryError):- pass---class ConceptLibraryError(LibraryError):- pass---class PipeLibraryError(LibraryError):- pass---class PipeLibraryPipeNotFoundError(PipeLibraryError):- pass---class PipeFactoryError(PipelexException):- pass---class LibraryParsingError(LibraryError):- pass---class DomainDefinitionError(PipelexException):- def __init__(self, message: str, domain_code: str, description: str, source: str | None = None):- self.domain_code = domain_code- self.description = description- self.source = source- super().__init__(message)---class ConceptDefinitionError(PipelexException):- def __init__(- self,- message: str,- domain_code: str,- concept_code: str,- description: str,- structure_class_python_code: str | None = None,- structure_class_syntax_error_data: SyntaxErrorData | None = None,- source: str | None = None,- ):- self.domain_code = domain_code- self.concept_code = concept_code- self.description = description- self.structure_class_python_code = structure_class_python_code- self.structure_class_syntax_error_data = structure_class_syntax_error_data- self.source = source- super().__init__(message)-- def as_structured_content(self) -> ConceptDefinitionErrorData:- return ConceptDefinitionErrorData(- message=str(self),- domain_code=self.domain_code,- concept_code=self.concept_code,- description=self.description,- structure_class_python_code=self.structure_class_python_code,- structure_class_syntax_error_data=self.structure_class_syntax_error_data,- source=self.source,- )---class ConceptStructureGeneratorError(PipelexException):- def __init__(self, message: str, structure_class_python_code: str | None = None, syntax_error_data: SyntaxErrorData | None = None):- self.structure_class_python_code = structure_class_python_code- self.syntax_error_data = syntax_error_data- super().__init__(message)---class PipeInputError(PipelexException):- def __init__(self, message: str, pipe_code: str, variable_name: str, concept_code: str | None = None):- self.pipe_code = pipe_code- self.variable_name = variable_name- self.concept_code = concept_code- super().__init__(message)---class PipeRunInputsError(PipelexException):- def __init__(self, message: str, pipe_code: str, missing_inputs: dict[str, str]):- self.pipe_code = pipe_code- self.missing_inputs = missing_inputs- super().__init__(message)---class DomainLoadingError(LibraryLoadingError):- def __init__(self, message: str, domain_code: str, description: str, source: str | None = None):- self.domain_code = domain_code- self.description = description- self.source = source- super().__init__(message)---class ConceptLoadingError(LibraryLoadingError):- def __init__(- self, message: str, concept_definition_error: ConceptDefinitionError, concept_code: str, description: str, source: str | None = None- ):- self.concept_definition_error = concept_definition_error- self.concept_code = concept_code- self.description = description- self.source = source- super().__init__(message)---class PipeLoadingError(LibraryLoadingError):- def __init__(self, message: str, pipe_definition_error: PipeDefinitionErrorData, pipe_code: str, description: str, source: str | None = None):- self.pipe_definition_error = pipe_definition_error- self.pipe_code = pipe_code- self.description = description- self.source = source- super().__init__(message)---class StuffError(PipelexException):- pass---class StuffContentTypeError(StuffError):- def __init__(self, message: str, expected_type: str, actual_type: str):- self.expected_type = expected_type- self.actual_type = actual_type- super().__init__(message)---class StuffContentValidationError(StuffError):- """Raised when content validation fails during type conversion."""-- def __init__(self, original_type: str, target_type: str, validation_error: str):- self.original_type = original_type- self.target_type = target_type- self.validation_error = validation_error- super().__init__(f"Failed to validate content from {original_type} to {target_type}: {validation_error}")---class PipeRunError(PipelexException):- pass---class DryRunError(PipeRunError):- """Raised when a dry run fails due to missing inputs or other validation issues."""-- 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)---class DryRunMissingInputsError(DryRunError):- """Raised when a dry run fails due to missing inputs or other validation issues."""-- 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)---class BatchParamsError(PipelexException):- pass---class PipeConditionError(PipelexException):- pass---class StructureClassError(PipelexException):- pass---class PipeOperatorException(PipelexException):- pass---class PipeOperatorModelAvailabilityError(PipelexException):- def __init__(- self,- message: str,- run_mode: PipeRunMode,- pipe_type: str,- pipe_code: str,- pipe_stack: list[str],- model_handle: str,- fallback_list: list[str] | None = None,- ):- self.run_mode = run_mode- self.pipe_type = pipe_type- self.pipe_code = pipe_code- self.pipe_stack = pipe_stack- self.model_handle = model_handle- self.fallback_list = fallback_list- super().__init__(message)---class PipeOperatorModelChoiceError(PipelexException):- def __init__(- self,- message: str,- pipe_type: str,- pipe_code: str,- model_type: ModelType,- model_choice: LLMModelChoice | ExtractModelChoice | ImgGenModelChoice,- ):- self.pipe_type = pipe_type- self.pipe_code = pipe_code- self.model_type = model_type- self.model_choice = model_choice- super().__init__(message)-- def desc(self) -> str:- msg = f"{self.message}"- msg += f" • pipe='{self.pipe_code}' ({self.pipe_type})"- msg += f" • model_type='{self.model_type}'"-- # Extract the choice identifier from the model_choice union type- if isinstance(self.model_choice, str):- # It's a preset/alias string- msg += f" • choice='{self.model_choice}'"- else:- # It's a Setting object with a model field and optional desc()- msg += f" • choice={self.model_choice.desc()}"-- return msg-- @override- def __str__(self) -> str:- return self.desc()---class PipeControllerError(PipelexException):- pass---class PipeControllerOutputConceptMismatchError(PipeControllerError):- def __init__(self, message: str, tested_concept: str, wanted_concept: str):- self.tested_concept = tested_concept- self.wanted_concept = wanted_concept- super().__init__(message)---class PipeRunParamsError(PipelexException):- pass---class PipeBatchError(PipelexException):- """Base class for all PipeBatch-related errors."""---class PipeBatchRecursionError(PipeBatchError):- """Raised when a PipeBatch attempts to run itself recursively."""---class PipeBatchInputError(PipeBatchError):- """Raised when the input to a PipeBatch is not a ListContent or is invalid."""---class PipeBatchOutputError(PipeBatchError):- """Raised when there's an error with the output structure of a PipeBatch operation."""---class PipeBatchBranchError(PipeBatchError):- """Raised when there's an error with a branch pipe execution in PipeBatch."""---class JobHistoryError(PipelexException):- pass---class StuffArtefactError(PipelexException):- pass---class StuffArtefactReservedFieldError(StuffArtefactError):- pass---class ConceptError(Exception):- pass---class ConceptCodeError(ConceptError):- pass---class ConceptRefineError(ConceptError):- pass---class PipelineManagerNotFoundError(PipelexException):- pass---class PipeInputSpecError(PipelexException):- pass---class PipeInputNotFoundError(PipelexException):- pass---class PipeInputDetailsError(PipelexException):- pass---class ApiSerializationError(Exception):- """Exception raised when API serialization fails."""---class StartPipelineError(Exception):- pass---class PipelineInputError(Exception):- pass-+from pipelex.core.stuffs.exceptions import (+ StuffArtefactError,+ StuffArtefactReservedFieldError,+ StuffContentTypeError,+ StuffContentValidationError,+ StuffError,+)+from pipelex.libraries.exceptions import (+ ConceptLibraryError,+ ConceptLoadingError,+ DomainLibraryError,+ DomainLoadingError,+ LibraryError,+ LibraryLoadingError,+ LibraryLoadingErrorData,+ PipeLibraryError,+ PipeLibraryPipeNotFoundError,+ PipeLoadingError,+)+from pipelex.pipe_controllers.exceptions import PipeControllerError, PipeControllerOutputConceptMismatchError+from pipelex.pipe_operators.exceptions import PipeOperatorModelAvailabilityError+from pipelex.pipe_run.exceptions import BatchParamsError, PipeRouterError, PipeRunError, PipeRunParamsError+from pipelex.pipeline.exceptions import (+ DryRunError,+ DryRunMissingInputsError,+ DryRunMissingPipesError,+ DryRunTemplatingError,+ PipeExecutionError,+ PipelineExecutionError,+ PipeStackOverflowError,+)+from pipelex.pipeline.track.exceptions import JobHistoryError+from pipelex.system.exceptions import (+ ConfigModelError,+ ConfigValidationError,+ CredentialsError,+ FatalError,+ NestedKeyConflictError,+ ToolException,+ TracebackMessageError,+)-class PipeExecutionError(PipelexException):- pass+__all__ = [+ # from pipelex.client.exceptions+ "ClientAuthenticationError",+ # from pipelex.core.bundles.exceptions+ "PipelexBundleBlueprintValueError",+ # from pipelex.core.domains.exceptions+ "DomainCodeError",+ "DomainDefinitionError",+ # from pipelex.core.concepts.exceptions+ "ConceptError",+ "ConceptBlueprintValueError",+ "ConceptStructureBlueprintValueError",+ "ConceptStructureValidationError",+ "ConceptFactoryError",+ "StructureClassError",+ "ConceptCodeError",+ "ConceptStringError",+ "ConceptRefineError",+ "ConceptLibraryConceptNotFoundError",+ "ConceptDefinitionErrorData",+ "ConceptDefinitionError",+ "ConceptStructureGeneratorError",+ "PipelexValidationExceptionAbstract",+ # from pipelex.libraries.exceptions+ "LibraryError",+ "LibraryLoadingErrorData",+ "LibraryLoadingError",+ "DomainLibraryError",+ "ConceptLibraryError",+ "ConceptLoadingError",+ "DomainLoadingError",+ "PipeLibraryError",+ "PipeLibraryPipeNotFoundError",+ "PipeLoadingError",+ # from pipelex.pipe_controllers.exceptions+ "PipeControllerError",+ "PipeControllerOutputConceptMismatchError",+ # from pipelex.pipe_operators.exceptions+ "PipeOperatorModelAvailabilityError",+ # from pipelex.pipe_run.exceptions+ "PipeRunParamsError",+ "BatchParamsError",+ "PipeRouterError",+ "PipeRunError",+ # from pipelex.core.pipes.exceptions+ "PipeDefinitionErrorData",+ "PipeBlueprintValueError",+ "PipeInputNotFoundError",+ "PipeFactoryError",+ "PipeOperatorModelChoiceError",+ "PipeInputError",+ "StaticValidationErrorType",+ "PipeRunInputsError",+ # from pipelex.core.stuffs.exceptions+ "StuffArtefactError",+ "StuffArtefactReservedFieldError",+ "StuffError",+ "StuffContentTypeError",+ "StuffContentValidationError",+ # from pipelex.core.exceptions+ "PipelexConfigurationError",+ "SyntaxErrorData",+ "StaticValidationError",+ # from pipelex.core.memory.exceptions+ "WorkingMemoryConsistencyError",+ "WorkingMemoryError",+ "WorkingMemoryFactoryError",+ "WorkingMemoryStuffAttributeNotFoundError",+ "WorkingMemoryStuffNotFoundError",+ "WorkingMemoryVariableError",+ # pipelex.pipeline.exceptions+ "PipeStackOverflowError",+ "DryRunTemplatingError",+ "DryRunMissingPipesError",+ "DryRunMissingInputsError",+ "DryRunError",+ "PipelineExecutionError",+ "PipeExecutionError",+ # from pipelex.pipeline.track.exceptions+ "JobHistoryError",+ # from pipelex.system.exceptions+ "ToolException",+ "NestedKeyConflictError",+ "CredentialsError",+ "TracebackMessageError",+ "FatalError",+ "ConfigValidationError",+ "ConfigModelError",+]diff --git a/pipelex/kit/index_loader.py b/pipelex/kit/index_loader.pyindex adb8b5556..b5130220a 100644--- a/pipelex/kit/index_loader.py+++ b/pipelex/kit/index_loader.py@@ -1,6 +1,6 @@from pydantic import ValidationError-from pipelex.exceptions import PipelexException+from pipelex.base_exceptions import PipelexExceptionfrom pipelex.kit.index_models import KitIndexfrom pipelex.kit.paths import get_kit_rootfrom pipelex.tools.misc.toml_utils import load_toml_from_pathdiff --git a/pipelex/libraries/exceptions.py b/pipelex/libraries/exceptions.pynew file mode 100644index 000000000..968a5c5e8--- /dev/null+++ b/pipelex/libraries/exceptions.py@@ -0,0 +1,87 @@+from pydantic import BaseModel, Field+from typing_extensions import override++from pipelex.base_exceptions import PipelexException+from pipelex.core.concepts.exceptions import ConceptDefinitionError, ConceptDefinitionErrorData, PipelexValidationExceptionAbstract+from pipelex.core.pipes.exceptions import PipeDefinitionErrorData+++class LibraryError(PipelexException):+ pass+++class LibraryLoadingErrorData(BaseModel):+ """Structured data for LibraryLoadingError."""++ message: str = Field(description="The main error message")+ concept_definition_errors: list[ConceptDefinitionErrorData] | None = Field(None, description="List of concept definition errors")+ pipe_definition_errors: list[PipeDefinitionErrorData] | None = Field(None, description="List of pipe definition errors")+++class LibraryLoadingError(LibraryError, PipelexValidationExceptionAbstract):+ """Error raised when loading library components fails."""++ def __init__(+ self,+ message: str,+ concept_definition_errors: list[ConceptDefinitionErrorData] | None = None,+ pipe_definition_errors: list[PipeDefinitionErrorData] | None = None,+ ):+ self.concept_definition_errors = concept_definition_errors+ self.pipe_definition_errors = pipe_definition_errors+ super().__init__(message)++ def as_structured_content(self) -> LibraryLoadingErrorData:+ return LibraryLoadingErrorData(+ message=str(self),+ concept_definition_errors=self.concept_definition_errors,+ pipe_definition_errors=self.pipe_definition_errors,+ )++ @override+ def get_concept_definition_errors(self) -> list[ConceptDefinitionErrorData]:+ return self.concept_definition_errors or []+++class DomainLibraryError(LibraryError):+ pass+++class ConceptLibraryError(LibraryError):+ pass+++class PipeLibraryError(LibraryError):+ pass+++class PipeLibraryPipeNotFoundError(PipeLibraryError):+ pass+++class DomainLoadingError(LibraryLoadingError):+ def __init__(self, message: str, domain_code: str, description: str, source: str | None = None):+ self.domain_code = domain_code+ self.description = description+ self.source = source+ super().__init__(message)+++class ConceptLoadingError(LibraryLoadingError):+ def __init__(+ self, message: str, concept_definition_error: ConceptDefinitionError, concept_code: str, description: str, source: str | None = None+ ):+ self.concept_definition_error = concept_definition_error+ self.concept_code = concept_code+ self.description = description+ self.source = source+ super().__init__(message)+++class PipeLoadingError(LibraryLoadingError):+ def __init__(self, message: str, pipe_definition_error: PipeDefinitionErrorData, pipe_code: str, description: str, source: str | None = None):+ self.pipe_definition_error = pipe_definition_error+ self.pipe_code = pipe_code+ self.description = description+ self.source = source+ super().__init__(message)diff --git a/pipelex/libraries/library_manager.py b/pipelex/libraries/library_manager.pyindex dde79d4e4..8f4f98585 100644--- a/pipelex/libraries/library_manager.py+++ b/pipelex/libraries/library_manager.py@@ -5,27 +5,27 @@ from pydantic import ValidationErrorfrom typing_extensions import overridefrom pipelex import log-from pipelex.builder.validation_error_data import PipeDefinitionErrorDatafrom pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprintfrom pipelex.core.concepts.concept import Conceptfrom pipelex.core.concepts.concept_factory import ConceptFactoryfrom pipelex.core.concepts.concept_library import ConceptLibrary+from pipelex.core.concepts.exceptions import ConceptDefinitionErrorfrom pipelex.core.domains.domain import Domainfrom pipelex.core.domains.domain_blueprint import DomainBlueprintfrom pipelex.core.domains.domain_factory import DomainFactoryfrom pipelex.core.domains.domain_library import DomainLibrary+from pipelex.core.domains.exceptions import DomainDefinitionErrorfrom pipelex.core.interpreter import PipelexInterpreterfrom pipelex.core.pipe_errors import PipeDefinitionError+from pipelex.core.pipes.exceptions import PipeDefinitionErrorDatafrom pipelex.core.pipes.pipe_abstract import PipeAbstractfrom pipelex.core.pipes.pipe_factory import PipeFactoryfrom pipelex.core.pipes.pipe_library import PipeLibraryfrom pipelex.core.stuffs.structured_content import StructuredContentfrom pipelex.core.validation import report_validation_error-from pipelex.exceptions import (- ConceptDefinitionError,+from pipelex.libraries.exceptions import (ConceptLibraryError,ConceptLoadingError,- DomainDefinitionError,DomainLoadingError,LibraryError,LibraryLoadingError,diff --git a/pipelex/pipe_controllers/batch/pipe_batch.py b/pipelex/pipe_controllers/batch/pipe_batch.pyindex 820dc81b3..eeadab176 100644--- a/pipelex/pipe_controllers/batch/pipe_batch.py+++ b/pipelex/pipe_controllers/batch/pipe_batch.py@@ -6,17 +6,13 @@ from pydantic import model_validatorfrom typing_extensions import overridefrom pipelex.config import get_config+from pipelex.core.memory.exceptions import WorkingMemoryStuffNotFoundErrorfrom pipelex.core.memory.working_memory import MAIN_STUFF_NAME, WorkingMemory+from pipelex.core.pipes.exceptions import PipeInputError, PipeInputNotFoundError, PipeRunInputsErrorfrom pipelex.core.pipes.input_requirements import InputRequirementsfrom pipelex.core.pipes.pipe_output import PipeOutputfrom pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.stuff_factory import StuffFactory-from pipelex.exceptions import (- PipeInputError,- PipeInputNotFoundError,- PipeRunInputsError,- WorkingMemoryStuffNotFoundError,-)from pipelex.hub import get_pipeline_tracker, get_required_pipefrom pipelex.pipe_controllers.pipe_controller import PipeControllerfrom pipelex.pipe_run.pipe_run_params import BatchParams, PipeRunMode, PipeRunParamsdiff --git a/pipelex/pipe_controllers/condition/exceptions.py b/pipelex/pipe_controllers/condition/exceptions.pynew file mode 100644index 000000000..f5198718b--- /dev/null+++ b/pipelex/pipe_controllers/condition/exceptions.py@@ -0,0 +1,5 @@+from pipelex.base_exceptions import PipelexException+++class PipeConditionError(PipelexException):+ passdiff --git a/pipelex/pipe_controllers/condition/pipe_condition.py b/pipelex/pipe_controllers/condition/pipe_condition.pyindex 515853bd9..aae5ffe2b 100644--- a/pipelex/pipe_controllers/condition/pipe_condition.py+++ b/pipelex/pipe_controllers/condition/pipe_condition.py@@ -9,27 +9,22 @@ from pipelex.cogt.templating.template_category import TemplateCategoryfrom pipelex.config import StaticValidationReaction, get_configfrom pipelex.core.concepts.concept_factory import ConceptFactoryfrom pipelex.core.concepts.concept_native import NativeConceptCode+from pipelex.core.exceptions import StaticValidationError+from pipelex.core.memory.exceptions import WorkingMemoryStuffNotFoundErrorfrom pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.pipe_errors import PipeDefinitionError+from pipelex.core.pipes.exceptions import PipeInputError, StaticValidationErrorTypefrom pipelex.core.pipes.input_requirements import InputRequirementsfrom pipelex.core.pipes.input_requirements_factory import InputRequirementsFactoryfrom pipelex.core.pipes.pipe_output import PipeOutput-from pipelex.exceptions import (- DryRunMissingInputsError,- DryRunMissingPipesError,- DryRunTemplatingError,- PipeConditionError,- PipeInputError,- StaticValidationError,- StaticValidationErrorType,- WorkingMemoryStuffNotFoundError,-)from pipelex.hub import get_content_generator, get_optional_pipe, get_pipe_router, get_pipeline_tracker, get_required_pipe+from pipelex.pipe_controllers.condition.exceptions import PipeConditionErrorfrom pipelex.pipe_controllers.condition.pipe_condition_details import PipeConditionDetailsfrom pipelex.pipe_controllers.condition.special_outcome import SpecialOutcomefrom pipelex.pipe_controllers.pipe_controller import PipeControllerfrom pipelex.pipe_run.pipe_job_factory import PipeJobFactoryfrom pipelex.pipe_run.pipe_run_params import PipeRunParams+from pipelex.pipeline.exceptions import DryRunMissingInputsError, DryRunMissingPipesError, DryRunTemplatingErrorfrom pipelex.pipeline.job_metadata import JobMetadatafrom pipelex.tools.jinja2.jinja2_errors import Jinja2DetectVariablesErrorfrom pipelex.tools.jinja2.jinja2_required_variables import detect_jinja2_required_variablesdiff --git a/pipelex/pipe_controllers/exceptions.py b/pipelex/pipe_controllers/exceptions.pynew file mode 100644index 000000000..cae5a0f45--- /dev/null+++ b/pipelex/pipe_controllers/exceptions.py@@ -0,0 +1,12 @@+from pipelex.base_exceptions import PipelexException+++class PipeControllerError(PipelexException):+ pass+++class PipeControllerOutputConceptMismatchError(PipeControllerError):+ def __init__(self, message: str, tested_concept: str, wanted_concept: str):+ self.tested_concept = tested_concept+ self.wanted_concept = wanted_concept+ super().__init__(message)diff --git a/pipelex/pipe_controllers/parallel/pipe_parallel.py b/pipelex/pipe_controllers/parallel/pipe_parallel.pyindex 784e4e2f2..83c381d5b 100644--- a/pipelex/pipe_controllers/parallel/pipe_parallel.py+++ b/pipelex/pipe_controllers/parallel/pipe_parallel.py@@ -7,25 +7,21 @@ from typing_extensions import overridefrom pipelex import logfrom pipelex.config import StaticValidationReaction, get_configfrom pipelex.core.concepts.concept import Concept+from pipelex.core.exceptions import StaticValidationError, StaticValidationErrorTypefrom pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.pipe_errors import PipeDefinitionError+from pipelex.core.pipes.exceptions import PipeInputError, PipeInputNotFoundErrorfrom pipelex.core.pipes.input_requirements import InputRequirementsfrom pipelex.core.pipes.input_requirements_factory import InputRequirementsFactoryfrom pipelex.core.pipes.pipe_output import PipeOutputfrom pipelex.core.stuffs.stuff_factory import StuffFactory-from pipelex.exceptions import (- DryRunMissingInputsError,- PipeInputError,- PipeInputNotFoundError,- PipeRunParamsError,- StaticValidationError,- StaticValidationErrorType,-)from pipelex.hub import get_pipeline_tracker, get_required_pipefrom pipelex.pipe_controllers.pipe_controller import PipeControllerfrom pipelex.pipe_controllers.sub_pipe import SubPipe+from pipelex.pipe_run.exceptions import PipeRunParamsErrorfrom pipelex.pipe_run.pipe_run_mode import PipeRunModefrom pipelex.pipe_run.pipe_run_params import PipeRunParams+from pipelex.pipeline.exceptions import DryRunMissingInputsErrorfrom pipelex.pipeline.job_metadata import JobMetadatafrom pipelex.types import Selfdiff --git a/pipelex/pipe_controllers/parallel/pipe_parallel_blueprint.py b/pipelex/pipe_controllers/parallel/pipe_parallel_blueprint.pyindex 9a3e3828c..92dc881c6 100644--- a/pipelex/pipe_controllers/parallel/pipe_parallel_blueprint.py+++ b/pipelex/pipe_controllers/parallel/pipe_parallel_blueprint.py@@ -3,7 +3,7 @@ from typing import Literalfrom pydantic import field_validator, model_validatorfrom typing_extensions import override-from pipelex.core.concepts.concept_blueprint import ConceptBlueprint+from pipelex.core.concepts.validation import is_concept_string_or_code_validfrom pipelex.core.pipe_errors import PipeDefinitionErrorfrom pipelex.core.pipes.pipe_blueprint import PipeBlueprintfrom pipelex.pipe_controllers.sub_pipe_blueprint import SubPipeBlueprint@@ -27,7 +27,9 @@ class PipeParallelBlueprint(PipeBlueprint):@classmethoddef validate_combined_output(cls, combined_output: str) -> str:if combined_output:- ConceptBlueprint.validate_concept_string_or_code(concept_string_or_code=combined_output)+ if not is_concept_string_or_code_valid(concept_string_or_code=combined_output):+ msg = f"Combined output '{combined_output}' is not a valid concept string or code"+ raise PipeDefinitionError(message=msg)return combined_output@model_validator(mode="after")diff --git a/pipelex/pipe_controllers/pipe_controller.py b/pipelex/pipe_controllers/pipe_controller.pyindex f50088c8f..267ad4c30 100644--- a/pipelex/pipe_controllers/pipe_controller.py+++ b/pipelex/pipe_controllers/pipe_controller.py@@ -4,12 +4,12 @@ from typing import Literalfrom typing_extensions import overridefrom pipelex import log+from pipelex.core.memory.exceptions import WorkingMemoryStuffNotFoundErrorfrom pipelex.core.memory.working_memory import WorkingMemory+from pipelex.core.pipes.exceptions import PipeRunInputsErrorfrom pipelex.core.pipes.pipe_abstract import PipeAbstractfrom pipelex.core.pipes.pipe_output import PipeOutput-from pipelex.exceptions import PipeRunInputsError, WorkingMemoryStuffNotFoundError-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 import PipeRunMode, PipeRunParamsfrom pipelex.pipeline.job_metadata import JobMetadatadiff --git a/pipelex/pipe_controllers/sequence/pipe_sequence.py b/pipelex/pipe_controllers/sequence/pipe_sequence.pyindex 075954f0b..043e3ce00 100644--- a/pipelex/pipe_controllers/sequence/pipe_sequence.py+++ b/pipelex/pipe_controllers/sequence/pipe_sequence.py@@ -5,22 +5,18 @@ from typing_extensions import overridefrom pipelex import logfrom pipelex.config import StaticValidationReaction, get_config+from pipelex.core.exceptions import StaticValidationError, StaticValidationErrorTypefrom pipelex.core.memory.working_memory import WorkingMemory+from pipelex.core.pipes.exceptions import PipeInputError, PipeInputNotFoundErrorfrom pipelex.core.pipes.input_requirements import InputRequirementsfrom pipelex.core.pipes.input_requirements_factory import InputRequirementsFactoryfrom pipelex.core.pipes.pipe_output import PipeOutput-from pipelex.exceptions import (- PipeControllerOutputConceptMismatchError,- PipeInputError,- PipeInputNotFoundError,- PipeRunParamsError,- StaticValidationError,- StaticValidationErrorType,-)from pipelex.hub import get_concept_library, get_required_pipe+from pipelex.pipe_controllers.exceptions import PipeControllerOutputConceptMismatchErrorfrom pipelex.pipe_controllers.parallel.pipe_parallel import PipeParallelfrom pipelex.pipe_controllers.pipe_controller import PipeControllerfrom pipelex.pipe_controllers.sub_pipe import SubPipe+from pipelex.pipe_run.exceptions import PipeRunParamsErrorfrom pipelex.pipe_run.pipe_run_params import PipeRunParamsfrom pipelex.pipeline.job_metadata import JobMetadatafrom pipelex.types import Selfdiff --git a/pipelex/pipe_controllers/sub_pipe.py b/pipelex/pipe_controllers/sub_pipe.pyindex 76eae772e..d86159da8 100644--- a/pipelex/pipe_controllers/sub_pipe.py+++ b/pipelex/pipe_controllers/sub_pipe.py@@ -1,11 +1,12 @@from pydantic import BaseModelfrom pipelex import log+from pipelex.core.memory.exceptions import WorkingMemoryStuffNotFoundErrorfrom pipelex.core.memory.working_memory import WorkingMemory+from pipelex.core.pipes.exceptions import PipeInputError, PipeInputNotFoundErrorfrom pipelex.core.pipes.pipe_output import PipeOutputfrom pipelex.core.pipes.variable_multiplicity import VariableMultiplicityfrom pipelex.core.stuffs.list_content import ListContent-from pipelex.exceptions import PipeInputError, PipeInputNotFoundError, WorkingMemoryStuffNotFoundErrorfrom pipelex.hub import get_pipeline_tracker, get_required_pipefrom pipelex.pipe_controllers.batch.pipe_batch_blueprint import PipeBatchBlueprintfrom pipelex.pipe_controllers.batch.pipe_batch_factory import PipeBatchFactorydiff --git a/pipelex/pipe_operators/compose/pipe_compose.py b/pipelex/pipe_operators/compose/pipe_compose.pyindex 8cda93e4f..5072a52c8 100644--- a/pipelex/pipe_operators/compose/pipe_compose.py+++ b/pipelex/pipe_operators/compose/pipe_compose.py@@ -19,9 +19,9 @@ from pipelex.core.pipes.input_requirements_factory import InputRequirementsFactofrom pipelex.core.pipes.pipe_output import PipeOutputfrom pipelex.core.stuffs.stuff_factory import StuffFactoryfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import PipeRunParamsErrorfrom pipelex.hub import get_content_generatorfrom pipelex.pipe_operators.pipe_operator import PipeOperator+from pipelex.pipe_run.exceptions import PipeRunParamsErrorfrom pipelex.pipe_run.pipe_run_mode import PipeRunModefrom pipelex.pipe_run.pipe_run_params import PipeRunParamsfrom pipelex.pipe_run.pipe_run_params_factory import PipeRunParamsFactorydiff --git a/pipelex/pipe_operators/exceptions.py b/pipelex/pipe_operators/exceptions.pynew file mode 100644index 000000000..50ef07c1d--- /dev/null+++ b/pipelex/pipe_operators/exceptions.py@@ -0,0 +1,22 @@+from pipelex.base_exceptions import PipelexException+from pipelex.pipe_run.pipe_run_mode import PipeRunMode+++class PipeOperatorModelAvailabilityError(PipelexException):+ def __init__(+ self,+ message: str,+ run_mode: PipeRunMode,+ pipe_type: str,+ pipe_code: str,+ pipe_stack: list[str],+ model_handle: str,+ fallback_list: list[str] | None = None,+ ):+ self.run_mode = run_mode+ self.pipe_type = pipe_type+ self.pipe_code = pipe_code+ self.pipe_stack = pipe_stack+ self.model_handle = model_handle+ self.fallback_list = fallback_list+ super().__init__(message)diff --git a/pipelex/pipe_operators/extract/pipe_extract.py b/pipelex/pipe_operators/extract/pipe_extract.pyindex da32dd25d..c12bfaa97 100644--- a/pipelex/pipe_operators/extract/pipe_extract.py+++ b/pipelex/pipe_operators/extract/pipe_extract.py@@ -12,6 +12,7 @@ from pipelex.cogt.extract.extract_setting import ExtractModelChoice, ExtractSettfrom pipelex.cogt.models.model_deck_check import check_extract_choice_with_deckfrom pipelex.config import StaticValidationReaction, get_configfrom pipelex.core.concepts.concept_native import NativeConceptCode+from pipelex.core.exceptions import StaticValidationError, StaticValidationErrorTypefrom pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.pipe_errors import PipeDefinitionErrorfrom pipelex.core.pipes.input_requirements import InputRequirements@@ -22,10 +23,6 @@ from pipelex.core.stuffs.page_content import PageContentfrom pipelex.core.stuffs.stuff_factory import StuffFactoryfrom pipelex.core.stuffs.text_and_images_content import TextAndImagesContentfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import (- StaticValidationError,- StaticValidationErrorType,-)from pipelex.hub import (get_concept_library,get_content_generator,diff --git a/pipelex/pipe_operators/func/pipe_func.py b/pipelex/pipe_operators/func/pipe_func.pyindex 63e4dc07c..a1f86e9d1 100644--- a/pipelex/pipe_operators/func/pipe_func.py+++ b/pipelex/pipe_operators/func/pipe_func.py@@ -15,9 +15,9 @@ from pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.stuff_content import StuffContentfrom pipelex.core.stuffs.stuff_factory import StuffFactoryfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import DryRunMissingInputsErrorfrom pipelex.pipe_operators.pipe_operator import PipeOperatorfrom pipelex.pipe_run.pipe_run_params import PipeRunParams+from pipelex.pipeline.exceptions import DryRunMissingInputsErrorfrom pipelex.pipeline.job_metadata import JobMetadatafrom pipelex.system.registries.func_registry import func_registrydiff --git a/pipelex/pipe_operators/img_gen/pipe_img_gen.py b/pipelex/pipe_operators/img_gen/pipe_img_gen.pyindex 00447130d..3fcb48e3b 100644--- a/pipelex/pipe_operators/img_gen/pipe_img_gen.py+++ b/pipelex/pipe_operators/img_gen/pipe_img_gen.py@@ -13,25 +13,22 @@ from pipelex.cogt.models.model_deck_check import check_img_gen_choice_with_deckfrom pipelex.config import StaticValidationReaction, get_configfrom pipelex.core.concepts.concept_factory import ConceptFactoryfrom pipelex.core.concepts.concept_native import NativeConceptCode+from pipelex.core.exceptions import StaticValidationError, StaticValidationErrorType+from pipelex.core.memory.exceptions import WorkingMemoryStuffNotFoundErrorfrom pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.pipe_errors import PipeDefinitionError, UnexpectedPipeDefinitionError+from pipelex.core.pipes.exceptions import PipeInputErrorfrom pipelex.core.pipes.input_requirements import InputRequirementsfrom pipelex.core.pipes.input_requirements_factory import InputRequirementsFactoryfrom pipelex.core.pipes.pipe_output import PipeOutputfrom pipelex.core.pipes.variable_multiplicity import VariableMultiplicity+from pipelex.core.stuffs.exceptions import StuffContentTypeErrorfrom pipelex.core.stuffs.image_content import ImageContentfrom pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.stuff_factory import StuffFactory-from pipelex.exceptions import (- PipeInputError,- PipeRunParamsError,- StaticValidationError,- StaticValidationErrorType,- StuffContentTypeError,- WorkingMemoryStuffNotFoundError,-)from pipelex.hub import get_concept_library, get_content_generator, get_model_deck, get_native_conceptfrom pipelex.pipe_operators.pipe_operator import PipeOperator+from pipelex.pipe_run.exceptions import PipeRunParamsErrorfrom pipelex.pipe_run.pipe_run_mode import PipeRunModefrom pipelex.pipe_run.pipe_run_params import PipeRunParams, output_multiplicity_to_applyfrom pipelex.pipe_run.pipe_run_params_factory import PipeRunParamsFactorydiff --git a/pipelex/pipe_operators/llm/pipe_llm.py b/pipelex/pipe_operators/llm/pipe_llm.pyindex e8e8faaf2..52a65ad71 100644--- a/pipelex/pipe_operators/llm/pipe_llm.py+++ b/pipelex/pipe_operators/llm/pipe_llm.py@@ -17,6 +17,7 @@ from pipelex.config import StaticValidationReaction, get_configfrom pipelex.core.concepts.concept_factory import ConceptFactoryfrom pipelex.core.concepts.concept_native import NativeConceptCodefrom pipelex.core.domains.domain import SpecialDomain+from pipelex.core.exceptions import StaticValidationError, StaticValidationErrorTypefrom pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.pipe_errors import PipeDefinitionErrorfrom pipelex.core.pipes.input_requirements import InputRequirements@@ -27,11 +28,6 @@ from pipelex.core.stuffs.list_content import ListContentfrom pipelex.core.stuffs.stuff_content import StuffContentfrom pipelex.core.stuffs.stuff_factory import StuffFactoryfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import (- PipeRunError,- StaticValidationError,- StaticValidationErrorType,-)from pipelex.hub import (get_class_registry,get_concept_library,@@ -48,6 +44,7 @@ from pipelex.pipe_run.pipe_run_params import (PipeRunParams,output_multiplicity_to_apply,)+from pipelex.pipeline.exceptions import PipeRunErrorfrom pipelex.pipeline.job_metadata import JobMetadatafrom pipelex.tools.typing.structure_printer import StructurePrinterfrom pipelex.types import Selfdiff --git a/pipelex/pipe_operators/pipe_operator.py b/pipelex/pipe_operators/pipe_operator.pyindex 5fb9653a5..cdb4794b1 100644--- a/pipelex/pipe_operators/pipe_operator.py+++ b/pipelex/pipe_operators/pipe_operator.py@@ -8,7 +8,7 @@ from pipelex.cogt.exceptions import ModelNotFoundError, ModelWaterfallErrorfrom pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.pipes.pipe_abstract import PipeAbstractfrom pipelex.core.pipes.pipe_output import PipeOutput-from pipelex.exceptions import PipeOperatorModelAvailabilityError+from pipelex.pipe_operators.exceptions import PipeOperatorModelAvailabilityErrorfrom pipelex.pipe_run.pipe_run_mode import PipeRunModefrom pipelex.pipe_run.pipe_run_params import PipeRunParamsfrom pipelex.pipeline.job_metadata import JobMetadatadiff --git a/pipelex/pipe_run/dry_run.py b/pipelex/pipe_run/dry_run.pyindex 650ee9320..cf2adce06 100644--- a/pipelex/pipe_run/dry_run.py+++ b/pipelex/pipe_run/dry_run.py@@ -12,10 +12,10 @@ from pipelex.core.pipes.input_requirements import InputRequirements, TypedNamedIfrom pipelex.core.pipes.pipe_abstract import PipeAbstractfrom pipelex.core.stuffs.stuff_content import StuffContentfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import PipeStackOverflowErrorfrom pipelex.hub import get_class_registryfrom pipelex.pipe_run.pipe_run_params import PipeRunModefrom pipelex.pipe_run.pipe_run_params_factory import PipeRunParamsFactory+from pipelex.pipeline.exceptions import PipeStackOverflowErrorfrom pipelex.pipeline.job_metadata import JobMetadatafrom pipelex.types import StrEnumdiff --git a/pipelex/pipe_run/exceptions.py b/pipelex/pipe_run/exceptions.pynew file mode 100644index 000000000..a468f4a7c--- /dev/null+++ b/pipelex/pipe_run/exceptions.py@@ -0,0 +1,32 @@+from pipelex.base_exceptions import PipelexException+from pipelex.pipe_run.pipe_run_mode import PipeRunMode+++class PipeRunParamsError(PipelexException):+ pass+++class BatchParamsError(PipelexException):+ pass+++class PipeRunError(PipelexException):+ pass+++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)diff --git a/pipelex/pipe_run/pipe_router_protocol.py b/pipelex/pipe_run/pipe_router_protocol.pyindex 05bfb6299..dab56a97a 100644--- a/pipelex/pipe_run/pipe_router_protocol.py+++ b/pipelex/pipe_run/pipe_router_protocol.py@@ -1,9 +1,10 @@from typing import Protocolfrom pipelex.core.pipes.pipe_output import PipeOutput-from pipelex.exceptions import DryRunMissingInputsError, PipeRouterError, PipeRunErrorfrom pipelex.observer.observer_protocol import ObserverProtocol, PayloadKey, PayloadType+from pipelex.pipe_run.exceptions import PipeRouterError, PipeRunErrorfrom pipelex.pipe_run.pipe_job import PipeJob+from pipelex.pipeline.exceptions import DryRunMissingInputsErrorclass PipeRouterProtocol(Protocol):diff --git a/pipelex/pipelex.py b/pipelex/pipelex.pyindex 8529641ed..03a8d7b05 100644--- a/pipelex/pipelex.py+++ b/pipelex/pipelex.py@@ -8,6 +8,7 @@ from kajson.singleton import MetaSingletonfrom pydantic import ValidationErrorfrom pipelex import log+from pipelex.base_exceptions import PipelexConfigError, PipelexSetupErrorfrom pipelex.cogt.content_generation.content_generator import ContentGeneratorfrom pipelex.cogt.content_generation.content_generator_protocol import (ContentGeneratorProtocol,@@ -30,7 +31,6 @@ from pipelex.core.domains.domain_library import DomainLibraryfrom pipelex.core.pipes.pipe_library import PipeLibraryfrom pipelex.core.registry_models import CoreRegistryModelsfrom pipelex.core.validation import report_validation_error-from pipelex.exceptions import PipelexConfigError, PipelexSetupErrorfrom pipelex.hub import PipelexHub, set_pipelex_hubfrom pipelex.libraries.library_manager_factory import LibraryManagerFactoryfrom pipelex.observer.local_observer import LocalObserverdiff --git a/pipelex/pipeline/exceptions.py b/pipelex/pipeline/exceptions.pynew file mode 100644index 000000000..06804320c--- /dev/null+++ b/pipelex/pipeline/exceptions.py@@ -0,0 +1,65 @@+from pipelex.base_exceptions import PipelexException+from pipelex.cogt.templating.template_category import TemplateCategory+from pipelex.pipe_run.exceptions import PipeRunError+from pipelex.pipe_run.pipe_run_mode import PipeRunMode+++class PipeExecutionError(PipelexException):+ pass+++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)+++class DryRunError(PipeRunError):+ """Raised when a dry run fails due to missing inputs or other validation issues."""++ 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)+++class DryRunMissingInputsError(DryRunError):+ """Raised when a dry run fails due to missing inputs or other validation issues."""++ 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(PipelexException):+ def __init__(self, message: str, limit: int, pipe_stack: list[str]):+ self.limit = limit+ self.pipe_stack = pipe_stack+ super().__init__(message)diff --git a/pipelex/pipeline/execute.py b/pipelex/pipeline/execute.pyindex 4ca793adf..fbe430e4f 100644--- a/pipelex/pipeline/execute.py+++ b/pipelex/pipeline/execute.py@@ -4,7 +4,6 @@ from pipelex.client.protocol import PipelineInputsfrom pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.memory.working_memory_factory import WorkingMemoryFactoryfrom pipelex.core.pipes.pipe_output import PipeOutput-from pipelex.exceptions import PipeExecutionError, PipelineExecutionError, PipeRouterErrorfrom pipelex.hub import (get_library_manager,get_pipe_router,@@ -13,6 +12,7 @@ from pipelex.hub import (get_required_pipe,get_telemetry_manager,)+from pipelex.pipe_run.exceptions import PipeRouterErrorfrom pipelex.pipe_run.pipe_job_factory import PipeJobFactoryfrom pipelex.pipe_run.pipe_run_mode import PipeRunModefrom pipelex.pipe_run.pipe_run_params import (@@ -20,6 +20,7 @@ from pipelex.pipe_run.pipe_run_params import (VariableMultiplicity,)from pipelex.pipe_run.pipe_run_params_factory import PipeRunParamsFactory+from pipelex.pipeline.exceptions import PipeExecutionError, PipelineExecutionErrorfrom pipelex.pipeline.job_metadata import JobMetadatafrom pipelex.pipeline.validate_plx import validate_plxfrom pipelex.system.environment import get_optional_envdiff --git a/pipelex/pipeline/pipeline_manager.py b/pipelex/pipeline/pipeline_manager.pyindex 919ff4fce..8c323a23b 100644--- a/pipelex/pipeline/pipeline_manager.py+++ b/pipelex/pipeline/pipeline_manager.py@@ -1,7 +1,7 @@from pydantic import Field, RootModelfrom typing_extensions import override-from pipelex.exceptions import PipelineManagerNotFoundError+from pipelex.base_exceptions import PipelexExceptionfrom pipelex.pipeline.pipeline import Pipelinefrom pipelex.pipeline.pipeline_factory import PipelineFactoryfrom pipelex.pipeline.pipeline_manager_abstract import PipelineManagerAbstract@@ -9,6 +9,10 @@ from pipelex.pipeline.pipeline_manager_abstract import PipelineManagerAbstractPipelineManagerRoot = dict[str, Pipeline]+class PipelineManagerNotFoundError(PipelexException):+ pass++class PipelineManager(PipelineManagerAbstract, RootModel[PipelineManagerRoot]):root: PipelineManagerRoot = Field(default_factory=dict)diff --git a/pipelex/pipeline/track/exceptions.py b/pipelex/pipeline/track/exceptions.pynew file mode 100644index 000000000..8e042d45a--- /dev/null+++ b/pipelex/pipeline/track/exceptions.py@@ -0,0 +1,5 @@+from pipelex.base_exceptions import PipelexException+++class JobHistoryError(PipelexException):+ passdiff --git a/pipelex/pipeline/track/flow_chart.py b/pipelex/pipeline/track/flow_chart.pyindex e34c25295..a70102907 100644--- a/pipelex/pipeline/track/flow_chart.py+++ b/pipelex/pipeline/track/flow_chart.py@@ -9,7 +9,7 @@ import networkx as nximport yamlfrom pipelex import log-from pipelex.exceptions import JobHistoryError+from pipelex.pipeline.track.exceptions import JobHistoryErrorfrom pipelex.pipeline.track.tracker_config import TrackerConfigfrom pipelex.pipeline.track.tracker_models import (EdgeAttributeKey,diff --git a/pipelex/pipeline/track/pipeline_tracker.py b/pipelex/pipeline/track/pipeline_tracker.pyindex 20f908d5d..7f5c18328 100644--- a/pipelex/pipeline/track/pipeline_tracker.py+++ b/pipelex/pipeline/track/pipeline_tracker.py@@ -10,8 +10,8 @@ from typing_extensions import overridefrom pipelex import logfrom pipelex.core.concepts.concept import Conceptfrom pipelex.core.stuffs.stuff import Stuff-from pipelex.exceptions import JobHistoryErrorfrom pipelex.pipe_controllers.condition.pipe_condition_details import PipeConditionDetails+from pipelex.pipeline.track.exceptions import JobHistoryErrorfrom pipelex.pipeline.track.flow_chart import PipelineFlowChartfrom pipelex.pipeline.track.pipeline_tracker_protocol import PipelineTrackerProtocolfrom pipelex.pipeline.track.tracker_config import TrackerConfigdiff --git a/pipelex/pipeline/validate_plx.py b/pipelex/pipeline/validate_plx.pyindex ac1fd45f9..d90f6da43 100644--- a/pipelex/pipeline/validate_plx.py+++ b/pipelex/pipeline/validate_plx.py@@ -5,15 +5,9 @@ from pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprintfrom pipelex.core.exceptions import PipelexConfigurationErrorfrom pipelex.core.interpreter import PipelexInterpreter, PLXDecodeErrorfrom 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+from pipelex.libraries.exceptions import ConceptLoadingError, DomainLoadingError, PipeLibraryError, PipeLoadingError+from pipelex.pipe_run.dry_run import DryRunError, dry_run_pipesasync def validate_plx(plx_content: str, remove_after_validation: bool = True) -> tuple[PipelexBundleBlueprint, list[PipeAbstract]]:diff --git a/pipelex/system/exceptions.py b/pipelex/system/exceptions.pyindex bd3547502..c91550b6f 100644--- a/pipelex/system/exceptions.py+++ b/pipelex/system/exceptions.py@@ -1,15 +1,10 @@import loggingfrom typing import ClassVar+from pipelex.base_exceptions import RootExceptionfrom pipelex.types import StrEnum-class RootException(Exception):- def __init__(self, message: str):- super().__init__(message)- self.message = message--class ToolException(RootException):pass@@ -51,9 +46,5 @@ class ConfigValidationError(FatalError):pass-class ConfigNotFoundError(RootException):- pass--class ConfigModelError(ValueError, FatalError):passdiff --git a/pyproject.toml b/pyproject.tomlindex fb4d8d04d..a16fe41f8 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -320,6 +320,7 @@ ignore = ["RUF001", # String contains ambiguous `′` (PRIME). Did you mean ``` (GRAVE ACCENT)?"RUF003", # Comment contains ambiguous `’` (RIGHT SINGLE QUOTATION MARK). Did you mean ``` (GRAVE ACCENT)?+ "RUF022", # Checks for __all__ definitions that are not ordered according to an "isort-style" sort."SIM105", # Use `contextlib.suppress(ValueError)` instead of `try`-`except`-`pass`"SIM108", # Use ternary operator `description = func.__doc__.strip().split("\n")[0] if func.__doc__ else func.__name__` instead of `if`-`else`-blockdiff --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.pyindex c13df7201..14eec0a68 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@@ -7,12 +7,13 @@ from pipelex.core.concepts.concept_factory import ConceptFactoryfrom pipelex.core.concepts.concept_native import NativeConceptCodefrom pipelex.core.domains.domain import SpecialDomainfrom pipelex.core.memory.working_memory_factory import WorkingMemoryFactory+from pipelex.core.pipes.exceptions import PipeRunInputsErrorfrom pipelex.core.pipes.input_requirements import TypedNamedInputRequirement-from pipelex.exceptions import DryRunMissingInputsError, PipeRunInputsErrorfrom pipelex.pipe_controllers.condition.pipe_condition_blueprint import PipeConditionBlueprintfrom pipelex.pipe_controllers.condition.pipe_condition_factory import PipeConditionFactoryfrom pipelex.pipe_run.pipe_run_params import PipeRunModefrom pipelex.pipe_run.pipe_run_params_factory import PipeRunParamsFactory+from pipelex.pipeline.exceptions import DryRunMissingInputsErrorfrom pipelex.pipeline.job_metadata import JobMetadatafrom tests.test_pipelines.pipe_controllers.pipe_condition.pipe_condition import CategoryInputdiff --git a/tests/e2e/pipelex/pipes/pipe_operators/test_pipe_llm_vision.py b/tests/e2e/pipelex/pipes/pipe_operators/test_pipe_llm_vision.pyindex bdd849c44..ccf05052b 100644--- a/tests/e2e/pipelex/pipes/pipe_operators/test_pipe_llm_vision.py+++ b/tests/e2e/pipelex/pipes/pipe_operators/test_pipe_llm_vision.py@@ -53,8 +53,8 @@ class TestPipeLLMVision:pipe_output = await execute_pipeline(pipe_code=pipe_code,inputs={- "imageA": ImageContent(url=LLMVisionTestCases.PATH_IMG_GANTT_1),- "imageB": ImageContent(url=LLMVisionTestCases.PATH_IMG_JPEG_3),+ "image_a": ImageContent(url=LLMVisionTestCases.PATH_IMG_GANTT_1),+ "image_b": ImageContent(url=LLMVisionTestCases.PATH_IMG_JPEG_3),},)diff --git a/tests/integration/pipelex/cogt/test_content_generator.py b/tests/integration/pipelex/cogt/test_content_generator.pyindex e0f866614..ac8372521 100644--- a/tests/integration/pipelex/cogt/test_content_generator.py+++ b/tests/integration/pipelex/cogt/test_content_generator.py@@ -2,7 +2,7 @@ import pytestfrom pytest import FixtureRequestfrom pipelex import pretty_print-from pipelex.cogt.exceptions import LLMHandleNotFoundError+from pipelex.cogt.exceptions import ModelNotFoundErrorfrom pipelex.cogt.extract.extract_input import ExtractInputfrom pipelex.cogt.extract.extract_job_components import ExtractJobConfig, ExtractJobParamsfrom pipelex.cogt.extract.extract_output import ExtractOutput@@ -157,7 +157,7 @@ class TestContentGenerator:@pytest.mark.inferenceasync def test_make_llm_text_with_error(self, request: FixtureRequest):llm_setting_main = LLMSetting(model="bad_handle_to_test_failure", temperature=0.5, max_tokens=100)- with pytest.raises(LLMHandleNotFoundError) as excinfo:+ with pytest.raises(ModelNotFoundError) as excinfo:await get_content_generator().make_llm_text(job_metadata=JobMetadata(job_name=request.node.originalname), # pyright: ignore[reportUnknownMemberType,reportUnknownArgumentType]llm_prompt_for_text=LLMPrompt(user_text=USER_TEXT_FOR_BASE),@@ -165,4 +165,4 @@ class TestContentGenerator:)error = excinfo.valuepretty_print(f"Caught expected error: {error}")- assert str(error).startswith("Model handle 'bad_handle_to_test_failure' not found")+ assert str(error).startswith("Model handle 'bad_handle_to_test_failure' was not found")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.pyindex 93eef19e7..e5b2bb99b 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@@ -8,9 +8,9 @@ from pytest import FixtureRequestfrom pipelex import pretty_printfrom pipelex.core.concepts.concept_factory import ConceptFactoryfrom pipelex.core.memory.working_memory_factory import WorkingMemoryFactory+from pipelex.core.pipes.exceptions import PipeRunInputsErrorfrom pipelex.core.stuffs.stuff_factory import StuffFactoryfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import PipeRunInputsErrorfrom pipelex.hub import get_pipe_router, get_required_pipefrom pipelex.pipe_run.pipe_job_factory import PipeJobFactoryfrom pipelex.pipe_run.pipe_run_params import PipeRunModediff --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.pyindex 7aa3da4d0..801f2504c 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@@ -10,9 +10,9 @@ from pipelex.core.concepts.concept_factory import ConceptFactoryfrom pipelex.core.concepts.concept_native import NativeConceptCodefrom pipelex.core.domains.domain import SpecialDomainfrom pipelex.core.memory.working_memory_factory import WorkingMemoryFactory+from pipelex.core.pipes.exceptions import PipeRunInputsErrorfrom pipelex.core.stuffs.stuff_factory import StuffFactoryfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import PipeRunInputsErrorfrom pipelex.hub import get_pipe_router, get_required_pipefrom pipelex.pipe_controllers.condition.pipe_condition_blueprint import PipeConditionBlueprintfrom pipelex.pipe_controllers.condition.pipe_condition_factory import PipeConditionFactorydiff --git a/tests/integration/pipelex/pipes/test_pipe_running_variants.py b/tests/integration/pipelex/pipes/test_pipe_running_variants.pyindex e819a7df6..ce9f95ca8 100644--- a/tests/integration/pipelex/pipes/test_pipe_running_variants.py+++ b/tests/integration/pipelex/pipes/test_pipe_running_variants.py@@ -9,6 +9,7 @@ from pipelex.hub import get_pipe_router, get_required_pipefrom pipelex.pipe_run.pipe_job_factory import PipeJobFactoryfrom pipelex.pipe_run.pipe_run_params import PipeRunModefrom pipelex.pipe_run.pipe_run_params_factory import PipeRunParamsFactory+from pipelex.pipeline.exceptions import PipeStackOverflowErrorfrom pipelex.pipeline.job_metadata import JobMetadatafrom tests.integration.pipelex.test_data import PipeTestCases@@ -107,7 +108,7 @@ class TestPipeRunningVariants:# )log.verbose(f"This pipe '{pipe_code}' is supposed to cause an error of type: {exception.__name__}")- with pytest.raises(exception) as exc:+ with pytest.raises(PipeStackOverflowError) as exc:await get_pipe_router().run(pipe_job=PipeJobFactory.make_pipe_job(pipe=get_required_pipe(pipe_code=pipe_code),diff --git a/tests/integration/pipelex/test_data.py b/tests/integration/pipelex/test_data.pyindex b3738ca6b..455ba18f5 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 StructuredContentfrom pipelex.core.stuffs.stuff import Stufffrom pipelex.core.stuffs.stuff_factory import StuffBlueprint, StuffFactoryfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import PipeRouterError+from pipelex.pipe_run.exceptions import PipeRouterErrorfrom tests.cases import ImageTestCases, PDFTestCasesdiff --git a/tests/integration/pipelex/test_inline_structure_concepts.py b/tests/integration/pipelex/test_inline_structure_concepts.pyindex 1652ea960..e93811494 100644--- a/tests/integration/pipelex/test_inline_structure_concepts.py+++ b/tests/integration/pipelex/test_inline_structure_concepts.py@@ -5,11 +5,11 @@ import pytestfrom pipelex.core.concepts.concept_blueprint import (ConceptBlueprint,ConceptStructureBlueprint,- ConceptStructureBlueprintFieldType,)from pipelex.core.concepts.concept_factory import ConceptFactory+from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprintFieldType+from pipelex.core.concepts.exceptions import StructureClassErrorfrom pipelex.core.stuffs.structured_content import StructuredContent-from pipelex.exceptions import StructureClassErrorfrom pipelex.hub import get_class_registrydiff --git a/tests/test_pipelines/pipe_operators/pipe_llm_vision.plx b/tests/test_pipelines/pipe_operators/pipe_llm_vision.plxindex 0579c20e0..aa5cb6e83 100644--- a/tests/test_pipelines/pipe_operators/pipe_llm_vision.plx+++ b/tests/test_pipelines/pipe_operators/pipe_llm_vision.plx@@ -23,23 +23,23 @@ $image[pipe.describe_image_number_1_only]type = "PipeLLM"description = "Describe what is in the image"-inputs = { imageA = "Image", imageB = "Image" }+inputs = { image_a = "Image", image_b = "Image" }output = "BasicDescription"model = "llm_for_diagram_to_text"prompt = """-Describe what you see in $imageA only.-Completely ignore $imageB.+Describe what you see in $image_a only.+Completely ignore $image_b."""[pipe.describe_image_number_2_only]type = "PipeLLM"description = "Describe what is in the image"-inputs = { imageA = "Image", imageB = "Image" }+inputs = { image_a = "Image", image_b = "Image" }output = "BasicDescription"model = "llm_for_diagram_to_text"prompt = """-Describe what you see in $imageB only.-Completely ignore $imageA.+Describe what you see in $image_b only.+Completely ignore $image_a."""diff --git a/tests/unit/builder/concept/test_data.py b/tests/unit/builder/concept/test_data.pyindex 5fd196f8d..e2fc42e84 100644--- a/tests/unit/builder/concept/test_data.py+++ b/tests/unit/builder/concept/test_data.py@@ -1,7 +1,8 @@from typing import ClassVarfrom pipelex.builder.concept.concept_spec import ConceptSpec, ConceptStructureSpec, ConceptStructureSpecFieldType-from pipelex.core.concepts.concept_blueprint import ConceptBlueprint, ConceptStructureBlueprint, ConceptStructureBlueprintFieldType+from pipelex.core.concepts.concept_blueprint import ConceptBlueprint, ConceptStructureBlueprint+from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprintFieldTypeclass ConceptBlueprintTestCases:diff --git a/tests/unit/cli/test_init_cmd.py b/tests/unit/cli/test_init_cmd.pyindex a6d91dde6..1b63257a2 100644--- a/tests/unit/cli/test_init_cmd.py+++ b/tests/unit/cli/test_init_cmd.py@@ -11,7 +11,7 @@ if TYPE_CHECKING:from pipelex.cli.commands.init.config_files import init_config-from pipelex.exceptions import PipelexCLIError+from pipelex.cli.exceptions import PipelexCLIErrorclass TestInitCmd:diff --git a/tests/unit/core/concepts/concept_factory/data.py b/tests/unit/core/concepts/concept_factory/data.pyindex 2956ce4b4..b70fbf5b3 100644--- a/tests/unit/core/concepts/concept_factory/data.py+++ b/tests/unit/core/concepts/concept_factory/data.py@@ -4,10 +4,10 @@ from pipelex.core.concepts.concept import Conceptfrom pipelex.core.concepts.concept_blueprint import (ConceptBlueprint,ConceptStructureBlueprint,- ConceptStructureBlueprintFieldType,)from pipelex.core.concepts.concept_factory import DomainAndConceptCodefrom pipelex.core.concepts.concept_native import NativeConceptCode+from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprintFieldTypefrom pipelex.core.domains.domain import SpecialDomain@@ -27,6 +27,11 @@ class TestCases:),f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}",),+ (+ "without_domain",+ ConceptBlueprint(description="A concept that refines a concept without domain", refines=NativeConceptCode.TEXT),+ f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}",+ ),]# Test cases for make_domain_and_concept_code_from_concept_string_or_concept_code methoddiff --git a/tests/unit/core/concepts/concept_factory/test_concept_factory.py b/tests/unit/core/concepts/concept_factory/test_concept_factory.pyindex 005e2a25c..104214b78 100644--- a/tests/unit/core/concepts/concept_factory/test_concept_factory.py+++ b/tests/unit/core/concepts/concept_factory/test_concept_factory.py@@ -4,10 +4,10 @@ from pipelex.core.concepts.concept import Conceptfrom pipelex.core.concepts.concept_blueprint import (ConceptBlueprint,ConceptStructureBlueprint,- ConceptStructureBlueprintFieldType,)from pipelex.core.concepts.concept_factory import ConceptFactory-from pipelex.exceptions import StructureClassError+from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprintFieldType+from pipelex.core.concepts.exceptions import StructureClassErrorfrom tests.unit.core.concepts.concept_factory.data import TestCasesdiff --git a/tests/unit/core/concepts/test_concept.py b/tests/unit/core/concepts/test_concept.pyindex e5f0bc1ad..91f1d371f 100644--- a/tests/unit/core/concepts/test_concept.py+++ b/tests/unit/core/concepts/test_concept.py@@ -4,63 +4,15 @@ from pipelex.core.concepts.concept import Conceptfrom pipelex.core.concepts.concept_blueprint import ConceptBlueprintfrom pipelex.core.concepts.concept_factory import ConceptFactoryfrom pipelex.core.concepts.concept_native import NativeConceptCode-from pipelex.core.concepts.exceptions import ConceptCodeError, ConceptStringError+from pipelex.core.concepts.exceptions import ConceptStringError+from pipelex.core.concepts.validation import validate_concept_stringfrom pipelex.core.domains.domain import SpecialDomain-from pipelex.core.domains.exceptions import DomainErrorclass TestConcept:"""Test Concept class."""- def test_is_native_concept_code(self):- """Test is_native_concept_code method."""- assert ConceptBlueprint.is_native_concept_code(NativeConceptCode.TEXT) is True- assert ConceptBlueprint.is_native_concept_code(NativeConceptCode.IMAGE) is True- assert ConceptBlueprint.is_native_concept_code(NativeConceptCode.PDF) is True- assert ConceptBlueprint.is_native_concept_code(NativeConceptCode.TEXT_AND_IMAGES) is True- assert ConceptBlueprint.is_native_concept_code(NativeConceptCode.NUMBER) is True- assert ConceptBlueprint.is_native_concept_code(NativeConceptCode.ANYTHING) is True- assert ConceptBlueprint.is_native_concept_code(NativeConceptCode.DYNAMIC) is True-- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}")-- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"{SpecialDomain.NATIVE}.{NativeConceptCode.IMAGE}")-- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"{SpecialDomain.NATIVE}.{NativeConceptCode.PDF}")-- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT_AND_IMAGES}")-- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"{SpecialDomain.NATIVE}.{NativeConceptCode.NUMBER}")-- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"not_native.{NativeConceptCode.TEXT}")-- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"not_native.{NativeConceptCode.IMAGE}")-- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"not_native.{NativeConceptCode.PDF}")-- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"not_native.{NativeConceptCode.TEXT_AND_IMAGES}")-- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"not_native.{NativeConceptCode.NUMBER}")-- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"not_native.{NativeConceptCode.DYNAMIC}")-- assert ConceptBlueprint.is_native_concept_code("RandomConcept") is False- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code("text")-def test_get_validated_native_concept_string(self):- """Test is_native_concept_code method."""assert NativeConceptCode.get_validated_native_concept_string(NativeConceptCode.TEXT) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}"assert NativeConceptCode.get_validated_native_concept_string(NativeConceptCode.IMAGE) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.IMAGE}"assert NativeConceptCode.get_validated_native_concept_string(NativeConceptCode.PDF) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.PDF}"@@ -217,50 +169,51 @@ class TestConcept:valid_concept_code = "ConceptCode"valid_concept_string = f"{valid_domain}.{valid_concept_code}"# Valid cases - should not raise exceptions- assert ConceptBlueprint.validate_concept_string(valid_concept_string) is None- assert ConceptBlueprint.validate_concept_string(f"snake_case_domain.{valid_concept_code}") is None- assert ConceptBlueprint.validate_concept_string(f"domain_123.{valid_concept_code}") is None- assert ConceptBlueprint.validate_concept_string(f"{valid_domain}.TEXT") is None- assert ConceptBlueprint.validate_concept_string(f"{SpecialDomain.NATIVE}.{NativeConceptCode.ANYTHING}") is None+ validate_concept_string(valid_concept_string)+ validate_concept_string(f"domain_123.{valid_concept_code}")+ validate_concept_string(f"{SpecialDomain.NATIVE}.{NativeConceptCode.ANYTHING}")+ validate_concept_string(f"{valid_domain}.UPPERCASE")# Invalid cases - should raise ConceptCodeError+ with pytest.raises(ConceptStringError):+ validate_concept_string(f"snake_case_domaiN.{valid_concept_code}")# Multiple dotswith pytest.raises(ConceptStringError):- ConceptBlueprint.validate_concept_string(f"domain.sub.{valid_concept_code}")+ validate_concept_string(f"domain.sub.{valid_concept_code}")with pytest.raises(ConceptStringError):- ConceptBlueprint.validate_concept_string(f"a.b.c.{valid_concept_code}")+ validate_concept_string(f"a.b.c.{valid_concept_code}")# Invalid domain (not snake_case)- with pytest.raises(DomainError):- ConceptBlueprint.validate_concept_string(f"InvalidDomain.{valid_concept_code}")+ with pytest.raises(ConceptStringError):+ validate_concept_string(f"InvalidDomain.{valid_concept_code}")- with pytest.raises(DomainError):- ConceptBlueprint.validate_concept_string(f"domain-name.{valid_concept_code}")+ with pytest.raises(ConceptStringError):+ validate_concept_string(f"domain-name.{valid_concept_code}")- with pytest.raises(DomainError):- ConceptBlueprint.validate_concept_string(f"Domain_Name.{valid_concept_code}")+ with pytest.raises(ConceptStringError):+ validate_concept_string(f"Domain_Name.{valid_concept_code}")- with pytest.raises(DomainError):- ConceptBlueprint.validate_concept_string(f"123domain.{valid_concept_code}")+ with pytest.raises(ConceptStringError):+ validate_concept_string(f"123domain.{valid_concept_code}")# Invalid concept code (not PascalCase)- with pytest.raises(ConceptCodeError):- ConceptBlueprint.validate_concept_string(f"{valid_domain}.invalidText")+ with pytest.raises(ConceptStringError):+ validate_concept_string(f"{valid_domain}.invalidText")- with pytest.raises(ConceptCodeError):- ConceptBlueprint.validate_concept_string(f"{valid_domain}.text")+ with pytest.raises(ConceptStringError):+ validate_concept_string(f"{valid_domain}.text")- with pytest.raises(ConceptCodeError):- ConceptBlueprint.validate_concept_string(f"{valid_domain}.Text_Name")+ with pytest.raises(ConceptStringError):+ validate_concept_string(f"{valid_domain}.Text_Name")- with pytest.raises(ConceptCodeError):- ConceptBlueprint.validate_concept_string(f"{valid_domain}.text-name")+ with pytest.raises(ConceptStringError):+ validate_concept_string(f"{valid_domain}.text-name")# Invalid native conceptwith pytest.raises(ConceptStringError):- ConceptBlueprint.validate_concept_string(f"{SpecialDomain.NATIVE}.InvalidNativeConcept")+ validate_concept_string(f"{SpecialDomain.NATIVE}.InvalidNativeConcept")def test_are_concept_compatible(self):concept1 = ConceptFactory.make_from_blueprint(diff --git a/tests/unit/core/concepts/test_concept_blueprint.py b/tests/unit/core/concepts/test_concept_blueprint.pyindex f0727d28d..8d7aac636 100644--- a/tests/unit/core/concepts/test_concept_blueprint.py+++ b/tests/unit/core/concepts/test_concept_blueprint.py@@ -1,12 +1,10 @@"""Tests for ConceptStructureBlueprint validation logic."""import pytest+from pydantic import ValidationError-from pipelex.core.concepts.concept_blueprint import (- ConceptStructureBlueprint,- ConceptStructureBlueprintError,- ConceptStructureBlueprintFieldType,-)+from pipelex.core.concepts.concept_blueprint import ConceptStructureBlueprint+from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprintFieldTypeclass TestConceptStructureBlueprintValidation:@@ -64,23 +62,23 @@ class TestConceptStructureBlueprintValidation:def test_default_value_type_mismatch(self):"""Test that default_value type mismatches are caught."""# Text field with non-string default- with pytest.raises(ConceptStructureBlueprintError, match="default_value type mismatch: expected str"):+ with pytest.raises(ValidationError, match="default_value type mismatch: expected str"):ConceptStructureBlueprint(description="A text field", type=ConceptStructureBlueprintFieldType.TEXT, default_value=42)# Integer field with non-integer default- with pytest.raises(ConceptStructureBlueprintError, match="default_value type mismatch: expected int"):+ with pytest.raises(ValidationError, match="default_value type mismatch: expected int"):ConceptStructureBlueprint(description="An integer field", type=ConceptStructureBlueprintFieldType.INTEGER, default_value="not an int")# Boolean field with non-boolean default- with pytest.raises(ConceptStructureBlueprintError, match="default_value type mismatch: expected bool"):+ with pytest.raises(ValidationError, match="default_value type mismatch: expected bool"):ConceptStructureBlueprint(description="A boolean field", type=ConceptStructureBlueprintFieldType.BOOLEAN, default_value="not a bool")# Number field with invalid type- with pytest.raises(ConceptStructureBlueprintError, match="default_value type mismatch: expected number"):+ with pytest.raises(ValidationError, match="default_value type mismatch: expected number"):ConceptStructureBlueprint(description="A number field", type=ConceptStructureBlueprintFieldType.NUMBER, default_value="not a number")# List field with non-list default- with pytest.raises(ConceptStructureBlueprintError, match="default_value type mismatch: expected list"):+ with pytest.raises(ValidationError, match="default_value type mismatch: expected list"):ConceptStructureBlueprint(description="A list field",type=ConceptStructureBlueprintFieldType.LIST,@@ -89,7 +87,7 @@ class TestConceptStructureBlueprintValidation:)# Dict field with non-dict default- with pytest.raises(ConceptStructureBlueprintError, match="default_value type mismatch: expected dict"):+ with pytest.raises(ValidationError, match="default_value type mismatch: expected dict"):ConceptStructureBlueprint(description="A dict field",type=ConceptStructureBlueprintFieldType.DICT,@@ -101,7 +99,7 @@ class TestConceptStructureBlueprintValidation:def test_missing_type_with_default_value(self):"""Test that missing type when default_value is provided (except for choices) is caught."""# Missing type with default_value (no choices) - this will trigger the "type is None (array)" validation first- with pytest.raises(ConceptStructureBlueprintError, match="When type is None \\(array\\), choices must not be empty"):+ with pytest.raises(ValidationError, match="When type is None \\(array\\), choices must not be empty"):ConceptStructureBlueprint(description="A field without type", default_value="some value")def test_default_value_without_type_but_with_choices_allowed(self):@@ -115,21 +113,21 @@ class TestConceptStructureBlueprintValidation:def test_invalid_choice_default_value(self):"""Test that invalid default_value for choice fields is caught."""# Invalid choice default- with pytest.raises(ConceptStructureBlueprintError, match="default_value must be one of the valid choices"):+ with pytest.raises(ValidationError, match="default_value must be one of the valid choices"):ConceptStructureBlueprint(description="A choice field", choices=["low", "medium", "high"], default_value="invalid_choice")def test_existing_validations_still_work(self):"""Test that existing validations continue to work."""# Type None (array) without choices- with pytest.raises(ConceptStructureBlueprintError, match="When type is None \\(array\\), choices must not be empty"):+ with pytest.raises(ValidationError, match="When type is None \\(array\\), choices must not be empty"):ConceptStructureBlueprint(description="Array field without choices", type=None)# Dict type without key_type- with pytest.raises(ConceptStructureBlueprintError, match="key_type must not be empty"):+ with pytest.raises(ValidationError, match="key_type must not be empty"):ConceptStructureBlueprint(description="Dict field without key_type", type=ConceptStructureBlueprintFieldType.DICT, value_type="text")# Dict type without value_type- with pytest.raises(ConceptStructureBlueprintError, match="value_type must not be empty"):+ with pytest.raises(ValidationError, match="value_type must not be empty"):ConceptStructureBlueprint(description="Dict field without value_type", type=ConceptStructureBlueprintFieldType.DICT, key_type="text")def test_edge_cases(self):diff --git a/tests/unit/core/concepts/test_structure_generator_escaping.py b/tests/unit/core/concepts/test_structure_generator_escaping.pyindex 49b4e1f2b..214ba66d5 100644--- a/tests/unit/core/concepts/test_structure_generator_escaping.py+++ b/tests/unit/core/concepts/test_structure_generator_escaping.py@@ -7,7 +7,7 @@ generated Python code.import ast-from pipelex.core.concepts.concept_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldType+from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldTypefrom pipelex.core.concepts.structure_generator import StructureGeneratorfrom pipelex.core.stuffs.structured_content import StructuredContentdiff --git a/tests/unit/core/concepts/test_structured_output_generator.py b/tests/unit/core/concepts/test_structured_output_generator.pyindex eb50395d3..d25b97b06 100644--- a/tests/unit/core/concepts/test_structured_output_generator.py+++ b/tests/unit/core/concepts/test_structured_output_generator.py@@ -1,8 +1,8 @@import pytestfrom pipelex import pretty_print-from pipelex.core.concepts.concept_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldTypefrom pipelex.core.concepts.concept_factory import ConceptFactory+from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldTypefrom pipelex.core.concepts.structure_generator import ConceptStructureValidationError, StructureGeneratorfrom pipelex.core.stuffs.structured_content import StructuredContentdiff --git a/tests/unit/core/memory/test_working_memory_typed_access.py b/tests/unit/core/memory/test_working_memory_typed_access.pyindex 393ced263..03e2f88b2 100644--- a/tests/unit/core/memory/test_working_memory_typed_access.py+++ b/tests/unit/core/memory/test_working_memory_typed_access.py@@ -6,6 +6,7 @@ import pytestfrom pipelex.core.concepts.concept_factory import ConceptFactoryfrom pipelex.core.domains.domain import SpecialDomain+from pipelex.core.memory.exceptions import WorkingMemoryStuffAttributeNotFoundError, WorkingMemoryTypeErrorfrom pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.memory.working_memory_factory import WorkingMemoryFactoryfrom pipelex.core.stuffs.image_content import ImageContent@@ -13,7 +14,6 @@ from pipelex.core.stuffs.page_content import PageContentfrom pipelex.core.stuffs.stuff_factory import StuffFactoryfrom pipelex.core.stuffs.text_and_images_content import TextAndImagesContentfrom pipelex.core.stuffs.text_content import TextContent-from pipelex.exceptions import WorkingMemoryStuffAttributeNotFoundError, WorkingMemoryTypeErrorfrom tests.unit.core.memory.conftest import TestWorkingMemoryDatadiff --git a/tests/unit/core/pipes/test_input_requirements_factory.py b/tests/unit/core/pipes/test_input_requirements_factory.pyindex 07e55b44c..b2fc3815a 100644--- a/tests/unit/core/pipes/test_input_requirements_factory.py+++ b/tests/unit/core/pipes/test_input_requirements_factory.py@@ -1,10 +1,8 @@import pytest-from pipelex.core.concepts.exceptions import ConceptCodeError-from pipelex.core.domains.exceptions import DomainError+from pipelex.core.concepts.exceptions import ConceptLibraryConceptNotFoundError, ConceptStringErrorfrom pipelex.core.pipes.input_requirements import InputRequirement-from pipelex.core.pipes.input_requirements_factory import InputRequirementsFactory, InputRequirementsFactorySyntaxError-from pipelex.exceptions import ConceptLibraryConceptNotFoundError+from pipelex.core.pipes.input_requirements_factory import InputRequirementsFactory, InputRequirementsFactoryErrorfrom tests.unit.core.pipes.data import (CONCEPT_CODE_RESOLUTION_TEST_CASES,DIFFERENT_CONCEPT_CODES_TEST_CASES,@@ -97,15 +95,19 @@ class TestMakeInputRequirementsFromString:def test_empty_string_raises_value_error(self):"""Test that an empty string raises InputRequirementsFactorySyntaxError."""- with pytest.raises(InputRequirementsFactorySyntaxError, match="Invalid input requirement string"):+ with pytest.raises(InputRequirementsFactoryError, match="Invalid input requirement string") as exc_info:InputRequirementsFactory.make_from_string(domain="native", requirement_str="")+ # This error is raised directly without a cause+ assert exc_info.value.__cause__ is Nonedef test_malformed_brackets_with_non_digit(self):"""Test that brackets with non-digit content are treated as part of concept string."""# The regex will match "native.Text[abc]" as concept="native.Text[abc]", multiplicity=None# This will then fail during concept validation with ConceptCodeError- with pytest.raises(ConceptCodeError):+ with pytest.raises(InputRequirementsFactoryError) as exc_info:InputRequirementsFactory.make_from_string(domain="native", requirement_str="native.Text[abc]")+ assert exc_info.value.__cause__ is not None+ assert isinstance(exc_info.value.__cause__, ConceptStringError)def test_multiplicity_zero_in_brackets(self):"""Test parsing a concept string with 0 in brackets."""@@ -139,25 +141,33 @@ class TestMakeInputRequirementsFromString:def test_whitespace_not_trimmed(self):"""Test that whitespace is not automatically trimmed."""# Whitespace should cause domain validation to fail- with pytest.raises(DomainError):+ with pytest.raises(InputRequirementsFactoryError) as exc_info:InputRequirementsFactory.make_from_string(domain="native", requirement_str=" native.Text")+ assert exc_info.value.__cause__ is not None+ assert isinstance(exc_info.value.__cause__, ConceptStringError)# Trailing whitespace should cause concept code validation to fail- with pytest.raises(ConceptCodeError):+ with pytest.raises(InputRequirementsFactoryError) as exc_info:InputRequirementsFactory.make_from_string(domain="native", requirement_str="native.Text ")+ assert exc_info.value.__cause__ is not None+ assert isinstance(exc_info.value.__cause__, ConceptStringError)def test_multiple_brackets_treated_as_concept_name(self):"""Test that multiple brackets are treated as part of the concept name."""# "native.Text[5][10]" should match as concept="native.Text[5]", multiplicity=10# This will fail during concept code validation- with pytest.raises(ConceptCodeError):+ with pytest.raises(InputRequirementsFactoryError) as exc_info:InputRequirementsFactory.make_from_string(domain="native", requirement_str="native.Text[5][10]")+ assert exc_info.value.__cause__ is not None+ assert isinstance(exc_info.value.__cause__, ConceptStringError)def test_brackets_at_start_treated_as_concept_name(self):"""Test that brackets at the start are part of the concept name."""# This will fail during domain validation- with pytest.raises(DomainError):+ with pytest.raises(InputRequirementsFactoryError) as exc_info:InputRequirementsFactory.make_from_string(domain="native", requirement_str="[5]native.Text")+ assert exc_info.value.__cause__ is not None+ assert isinstance(exc_info.value.__cause__, ConceptStringError)@pytest.mark.parametrize(("domain", "requirement_str", "concept_codes_from_same_domain", "expected_concept_string", "expected_multiplicity", "description"),diff --git a/tests/unit/core/pipes/test_validation.py b/tests/unit/core/pipes/test_validation.pynew file mode 100644index 000000000..1e20169ea--- /dev/null+++ b/tests/unit/core/pipes/test_validation.py@@ -0,0 +1,105 @@+import pytest++from pipelex.core.pipes.exceptions import PipeBlueprintValueError+from pipelex.core.pipes.validation import is_valid_input_name, validate_input_name+++class TestInputNameValidation:+ """Test input name validation functions."""++ @pytest.mark.parametrize(+ ("input_name", "expected_result"),+ [+ # Valid cases+ ("my_input", True),+ ("input_123", True),+ ("my_input_field", True),+ ("my_input.field_name", True),+ ("my_input.field_name.nested_field", True),+ ("input_1.field_2.nested_3", True),+ ("a", True),+ ("a_b", True),+ ("a.b", True),+ ("a.b.c", True),+ # Invalid cases - not snake_case+ ("myInput", False),+ ("MyInput", False),+ ("my-input", False),+ ("my input", False),+ ("123_input", False), # Cannot start with number+ # Invalid cases - dot issues+ ("", False),+ (".", False),+ (".my_input", False),+ ("my_input.", False),+ ("my_input..field", False),+ ("my_input...field", False),+ ("..", False),+ ("...", False),+ # Invalid cases - mixed with valid dots+ ("my_input.fieldName", False), # Second part not snake_case+ ("myInput.field_name", False), # First part not snake_case+ ("my_input.Field_name", False), # Second part starts with uppercase+ ("my_input..field_name", False), # Consecutive dots+ ("my_input.field_name.", False), # Trailing dot+ (".my_input.field_name", False), # Leading dot+ ],+ )+ def test_is_valid_input_name(self, input_name: str, expected_result: bool):+ """Test is_valid_input_name with various input names."""+ assert is_valid_input_name(input_name) == expected_result++ @pytest.mark.parametrize(+ "valid_input_name",+ [+ "my_input",+ "input_123",+ "my_input_field",+ "my_input.field_name",+ "my_input.field_name.nested_field",+ "input_1.field_2.nested_3",+ "a",+ "a_b",+ "a.b",+ "a.b.c",+ ],+ )+ def test_validate_input_name_valid(self, valid_input_name: str):+ """Test validate_input_name does not raise for valid input names."""+ validate_input_name(valid_input_name) # Should not raise++ @pytest.mark.parametrize(+ "invalid_input_name",+ [+ "myInput",+ "MyInput",+ "my-input",+ "my input",+ "123_input",+ "",+ ".",+ ".my_input",+ "my_input.",+ "my_input..field",+ "my_input...field",+ "..",+ "...",+ "my_input.fieldName",+ "myInput.field_name",+ "my_input.Field_name",+ ],+ )+ def test_validate_input_name_invalid(self, invalid_input_name: str):+ """Test validate_input_name raises PipeBlueprintValueError for invalid input names."""+ with pytest.raises(PipeBlueprintValueError, match="Invalid input name syntax"):+ validate_input_name(invalid_input_name)++ def test_validate_input_name_error_message(self):+ """Test that the error message is helpful and descriptive."""+ with pytest.raises(PipeBlueprintValueError) as exc_info:+ validate_input_name("myInput.fieldName")++ error_message = str(exc_info.value)+ assert "Invalid input name syntax 'myInput.fieldName'" in error_message+ assert "snake_case" in error_message+ assert "dots" in error_message or "nested field" in error_message.lower()diff --git a/tests/unit/core/test_data/concepts/structured_concepts.py b/tests/unit/core/test_data/concepts/structured_concepts.pyindex 283413778..caa44bc81 100644--- a/tests/unit/core/test_data/concepts/structured_concepts.py+++ b/tests/unit/core/test_data/concepts/structured_concepts.py@@ -1,5 +1,6 @@from pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprint-from pipelex.core.concepts.concept_blueprint import ConceptBlueprint, ConceptStructureBlueprint, ConceptStructureBlueprintFieldType+from pipelex.core.concepts.concept_blueprint import ConceptBlueprint+from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldTypeCONCEPTS_WITH_STRUCTURES = ("concepts_with_structures",diff --git a/tests/unit/core/test_data/errors/invalid_plx.py b/tests/unit/core/test_data/errors/invalid_plx.pyindex 5d8ae047c..ffbd0f01f 100644--- a/tests/unit/core/test_data/errors/invalid_plx.py+++ b/tests/unit/core/test_data/errors/invalid_plx.py@@ -1,6 +1,5 @@from pydantic import ValidationError-from pipelex.core.domains.exceptions import DomainErrorfrom pipelex.core.interpreter import PLXDecodeErrorINVALID_PLX_SYNTAX = (@@ -75,7 +74,7 @@ description = "Domain with invalid characters"[concept]TestConcept = "A test concept"""",- DomainError,+ ValidationError,)EMPTY_DOMAIN = (@@ -86,7 +85,7 @@ description = "Domain with empty string"[concept]TestConcept = "A test concept"""",- DomainError,+ ValidationError,)INVALID_ROOT_KEY = (diff --git a/tests/unit/pipe_controllers/condition/test_pipe_condition_input.py b/tests/unit/pipe_controllers/condition/test_pipe_condition_input.pyindex 8968314d5..2a68b7a19 100644--- a/tests/unit/pipe_controllers/condition/test_pipe_condition_input.py+++ b/tests/unit/pipe_controllers/condition/test_pipe_condition_input.py@@ -3,8 +3,8 @@ from typing import Anyimport pytestfrom pipelex import log+from pipelex.core.exceptions import StaticValidationErrorfrom pipelex.core.pipe_errors import PipeDefinitionError-from pipelex.exceptions import StaticValidationErrorfrom pipelex.pipe_controllers.condition.pipe_condition_blueprint import PipeConditionBlueprintfrom pipelex.pipe_controllers.condition.pipe_condition_factory import PipeConditionFactoryfrom tests.unit.pipe_controllers.condition.data import PipeConditionInputTestCasesdiff --git a/tests/unit/pipe_controllers/parallel/test_pipe_parallel_input.py b/tests/unit/pipe_controllers/parallel/test_pipe_parallel_input.pyindex dd55c4085..83ec51980 100644--- a/tests/unit/pipe_controllers/parallel/test_pipe_parallel_input.py+++ b/tests/unit/pipe_controllers/parallel/test_pipe_parallel_input.py@@ -3,8 +3,8 @@ from typing import Anyimport pytestfrom pipelex import log+from pipelex.core.exceptions import StaticValidationErrorfrom pipelex.core.pipe_errors import PipeDefinitionError-from pipelex.exceptions import StaticValidationErrorfrom pipelex.pipe_controllers.parallel.pipe_parallel_blueprint import PipeParallelBlueprintfrom pipelex.pipe_controllers.parallel.pipe_parallel_factory import PipeParallelFactoryfrom tests.unit.pipe_controllers.parallel.data import PipeParallelInputTestCasesdiff --git a/tests/unit/pipe_controllers/sequence/test_pipe_sequence_input.py b/tests/unit/pipe_controllers/sequence/test_pipe_sequence_input.pyindex 2574fd191..265aa2f94 100644--- a/tests/unit/pipe_controllers/sequence/test_pipe_sequence_input.py+++ b/tests/unit/pipe_controllers/sequence/test_pipe_sequence_input.py@@ -3,8 +3,8 @@ from typing import Anyimport pytestfrom pipelex import log+from pipelex.core.exceptions import StaticValidationErrorfrom pipelex.core.pipe_errors import PipeDefinitionError-from pipelex.exceptions import StaticValidationErrorfrom pipelex.pipe_controllers.sequence.pipe_sequence_blueprint import PipeSequenceBlueprintfrom pipelex.pipe_controllers.sequence.pipe_sequence_factory import PipeSequenceFactoryfrom tests.unit.pipe_controllers.sequence.data import PipeSequenceInputTestCasesdiff --git a/tests/unit/pipe_operators/pipe_extract/test_pipe_extract_input.py b/tests/unit/pipe_operators/pipe_extract/test_pipe_extract_input.pyindex f6ed2d000..5f654e50c 100644--- a/tests/unit/pipe_operators/pipe_extract/test_pipe_extract_input.py+++ b/tests/unit/pipe_operators/pipe_extract/test_pipe_extract_input.py@@ -1,7 +1,7 @@import pytestfrom pipelex import log-from pipelex.exceptions import StaticValidationError+from pipelex.core.exceptions import StaticValidationErrorfrom pipelex.pipe_operators.extract.pipe_extract_blueprint import PipeExtractBlueprintfrom pipelex.pipe_operators.extract.pipe_extract_factory import PipeExtractFactoryfrom tests.unit.pipe_operators.pipe_extract.data import PipeExtractInputTestCasesdiff --git a/tests/unit/pipe_operators/pipe_img_gen/test_pipe_img_gen_input.py b/tests/unit/pipe_operators/pipe_img_gen/test_pipe_img_gen_input.pyindex 3492daf08..092e8089a 100644--- a/tests/unit/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@@ -1,8 +1,8 @@import pytestfrom pipelex import log+from pipelex.core.exceptions import StaticValidationErrorfrom pipelex.core.pipe_errors import PipeDefinitionError-from pipelex.exceptions import StaticValidationErrorfrom pipelex.pipe_operators.img_gen.pipe_img_gen_blueprint import PipeImgGenBlueprintfrom pipelex.pipe_operators.img_gen.pipe_img_gen_factory import PipeImgGenFactoryfrom tests.unit.pipe_operators.pipe_img_gen.data import PipeImgGenInputTestCasesdiff --git a/tests/unit/pipe_operators/pipe_llm/test_pipe_llm_input.py b/tests/unit/pipe_operators/pipe_llm/test_pipe_llm_input.pyindex 1522a85f9..ed4280c2f 100644--- a/tests/unit/pipe_operators/pipe_llm/test_pipe_llm_input.py+++ b/tests/unit/pipe_operators/pipe_llm/test_pipe_llm_input.py@@ -1,7 +1,7 @@import pytestfrom pipelex import log-from pipelex.exceptions import StaticValidationError+from pipelex.core.exceptions import StaticValidationErrorfrom pipelex.pipe_operators.llm.pipe_llm_blueprint import PipeLLMBlueprintfrom pipelex.pipe_operators.llm.pipe_llm_factory import PipeLLMFactoryfrom tests.unit.pipe_operators.pipe_llm.data import PipeLLMInputTestCases