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.
Feature/simplify input memory (#204)
Louis Choquel4e0ae6443b53
diff --git a/pipelex/client/protocol.py b/pipelex/client/protocol.pyindex 8348b33c6..7dcf84246 100644--- a/pipelex/client/protocol.py+++ b/pipelex/client/protocol.py@@ -9,7 +9,7 @@ from pipelex.core.stuff_content import StuffContentfrom pipelex.core.working_memory import WorkingMemoryfrom pipelex.types import StrEnum-StuffContentOrData = Dict[str, Any] | StuffContent | List[Any]+StuffContentOrData = Dict[str, Any] | StuffContent | List[Any] | strImplicitMemory = Dict[str, StuffContentOrData]CompactMemory = Dict[str, Dict[str, Any]]COMPACT_MEMORY_KEY = "compact_memory"diff --git a/pipelex/core/stuff_factory.py b/pipelex/core/stuff_factory.pyindex e5c7ca834..908848d72 100644--- a/pipelex/core/stuff_factory.py+++ b/pipelex/core/stuff_factory.py@@ -243,10 +243,19 @@ class StuffFactory:)except StuffFactoryError as exc:raise StuffFactoryError(f"Could not make stuff for list of StuffContent '{name}': {exc}") from exc+ elif isinstance(stuff_content_or_data, str):+ str_stuff: str = stuff_content_or_data+ return StuffFactory.make_from_str(+ str_value=str_stuff,+ name=name,+ )else:stuff_content_dict: Dict[str, Any] = stuff_content_or_datatry:- concept_code = stuff_content_dict["concept_code"]+ concept_code: Optional[str]+ concept_code = stuff_content_dict.get("concept") or stuff_content_dict.get("concept_code")+ if not concept_code:+ raise StuffFactoryError("Stuff content data dict is badly formed: no concept code")content_value = stuff_content_dict["content"]except KeyError as exc:raise StuffFactoryError(f"Stuff content data dict is badly formed: {exc}") from exc