From da694a1d9bcd44e17569fd2d60087fa2a5af18a6 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 22 Aug 2023 20:38:41 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20chore(ZepMemory.py):=20add=20Zep?= =?UTF-8?q?Memory=20component=20to=20handle=20interactions=20with=20Zep=20?= =?UTF-8?q?API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ZepMemory component is added to handle interactions with the Zep API. It provides a build method that takes in configuration parameters such as zep_api_url, api_key, session_id, memory_key, and return_messages. These parameters are used to initialize an instance of the ZepMemory class, which is a subclass of BaseMemory. The ZepMemory class handles the communication with the Zep API and provides methods for storing and retrieving data from the Zep memory. --- .../langflow/components/memories/ZepMemory.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/backend/langflow/components/memories/ZepMemory.py diff --git a/src/backend/langflow/components/memories/ZepMemory.py b/src/backend/langflow/components/memories/ZepMemory.py new file mode 100644 index 000000000..d2a4b051c --- /dev/null +++ b/src/backend/langflow/components/memories/ZepMemory.py @@ -0,0 +1,39 @@ +from langchain.memory.zep_memory import ZepMemory +from langflow import CustomComponent +from langchain.schema.memory import BaseMemory + + +class ZepMemoryComponent(CustomComponent): + display_name: str = "Zep Memory" + + def build_config(self): + return { + "zep_api_url": { + "display_name": "Zep API URL", + "value": "http://localhost:8000", + }, + "api_key": { + "password": True, + "display_name": "API Key", + }, + "session_id": { + "display_name": "Session ID", + "info": "The session ID to use for the memory.", + }, + } + + def build( + self, + api_key: str, + session_id: str, + memory_key: str, + return_messages: bool, + zep_api_url: str = "http://localhost:8000", + ) -> BaseMemory: + return ZepMemory( + session_id=session_id, + url=zep_api_url, + api_key=api_key, + memory_key=memory_key, + return_messages=return_messages, + )