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.
Move concept blueprint / description disimbiguation to Factory. Add PLX path to the blueprint when making from file.
Louis Choquel0b8c1b7c9187
diff --git a/pipelex/core/concepts/concept_factory.py b/pipelex/core/concepts/concept_factory.pyindex c604fb995..3b8d3ef27 100644--- a/pipelex/core/concepts/concept_factory.py+++ b/pipelex/core/concepts/concept_factory.py@@ -124,6 +124,26 @@ class ConceptFactory:raise ConceptRefineError(msg)return NativeConceptManager.get_native_concept_string(concept_string_or_code=refine)+ @classmethod+ def make_from_blueprint_or_description(+ cls,+ domain: str,+ concept_code: str,+ concept_blueprint_or_description: ConceptBlueprint | str,+ concept_codes_from_the_same_domain: list[str] | None = None,+ ) -> Concept:+ blueprint: ConceptBlueprint+ if isinstance(concept_blueprint_or_description, str):+ blueprint = ConceptBlueprint(definition=concept_blueprint_or_description)+ else:+ blueprint = concept_blueprint_or_description+ return cls.make_from_blueprint(+ domain=domain,+ concept_code=concept_code,+ blueprint=blueprint,+ concept_codes_from_the_same_domain=concept_codes_from_the_same_domain,+ )+@classmethoddef make_from_blueprint(cls,diff --git a/pipelex/core/interpreter.py b/pipelex/core/interpreter.pyindex 383ce55e0..4c5ceafed 100644--- a/pipelex/core/interpreter.py+++ b/pipelex/core/interpreter.py@@ -121,5 +121,7 @@ class PipelexInterpreter(BaseModel):def make_pipelex_bundle_blueprint(self) -> PipelexBundleBlueprint:"""Make a PipelexBundleBlueprint from the file_path or file_content"""file_content = self._read_and_reformat()- plx_data = self._parse_plx_content(file_content)- return PipelexBundleBlueprint.model_validate(plx_data)+ blueprint_dict = self._parse_plx_content(file_content)+ if self.file_path:+ blueprint_dict.update(source=str(self.file_path))+ return PipelexBundleBlueprint.model_validate(blueprint_dict)diff --git a/pipelex/libraries/library_manager.py b/pipelex/libraries/library_manager.pyindex e2e38d3e9..a065650eb 100644--- a/pipelex/libraries/library_manager.py+++ b/pipelex/libraries/library_manager.py@@ -8,7 +8,6 @@ from pipelex import logfrom pipelex.config import get_configfrom pipelex.core.bundles.pipelex_bundle_blueprint import PipelexBundleBlueprintfrom 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 ConceptLibraryfrom pipelex.core.domains.domain import Domain@@ -194,17 +193,12 @@ class LibraryManager(LibraryManagerAbstract):return []concepts: list[Concept] = []- for concept_code, concept_blueprint_or_str in blueprint.concept.items():- concept_blueprint: ConceptBlueprint- if isinstance(concept_blueprint_or_str, str):- concept_blueprint = ConceptBlueprint(definition=concept_blueprint_or_str)- else:- concept_blueprint = concept_blueprint_or_str- concept = ConceptFactory.make_from_blueprint(+ for concept_code, concept_blueprint_or_description in blueprint.concept.items():+ concept = ConceptFactory.make_from_blueprint_or_description(domain=blueprint.domain,concept_code=concept_code,concept_codes_from_the_same_domain=list(blueprint.concept.keys()),- blueprint=concept_blueprint,+ concept_blueprint_or_description=concept_blueprint_or_description,)concepts.append(concept)return concepts