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/working memory accessor for one item list (#9)
Antoine8a5b6702b861
diff --git a/pipelex/core/working_memory.py b/pipelex/core/working_memory.pyindex f1a8467cf..a3ab9cafe 100644--- a/pipelex/core/working_memory.py+++ b/pipelex/core/working_memory.py@@ -274,6 +274,10 @@ class WorkingMemory(BaseModel):"""return self.get_stuff(name=name).as_list_of_fixed_content_type(item_type=item_type)+ def get_list_stuff_first_item_as(self, name: str, item_type: Type[StuffContentType]) -> StuffContentType:+ """Get stuff content as ListContent with items of type StuffContentType then return the first item."""+ return self.get_stuff_as_list(name=name, item_type=item_type).items[0]+def get_stuff_as_text(self, name: str) -> TextContent:"""Get stuff content as TextContent if applicable."""return self.get_stuff(name=name).as_text@@ -317,6 +321,10 @@ class WorkingMemory(BaseModel):"""return self.get_stuff_as_list(name=MAIN_STUFF_NAME, item_type=item_type)+ def main_list_stuff_first_item_as(self, item_type: Type[StuffContentType]) -> StuffContentType:+ """Get main stuff content as first list item of type StuffContentType."""+ return self.get_list_stuff_first_item_as(name=MAIN_STUFF_NAME, item_type=item_type)+@propertydef main_stuff_as_text(self) -> TextContent:"""Get main stuff content as TextContent if applicable."""diff --git a/pyproject.toml b/pyproject.tomlindex 453aa7b13..5814aa1e2 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -1,6 +1,6 @@[project]name = "pipelex"-version = "0.2.8"+version = "0.2.9"description = "Pipelex is an open-source dev tool based on a simple declarative language that lets you define replicable, structured, composable LLM pipelines."authors = [{ name = "Evotis S.A.S.", email = "[email protected]" }]maintainers = [{ name = "Pipelex staff", email = "[email protected]" }]diff --git a/uv.lock b/uv.lockindex ca7cedcff..d7328815d 100644--- a/uv.lock+++ b/uv.lock@@ -834,7 +834,7 @@ wheels = [[[package]]name = "pipelex"-version = "0.2.8"+version = "0.2.9"source = { editable = "." }dependencies = [{ name = "aiofiles" },