📦 chore(ZepMemory.py): add ZepMemory component to handle interactions with Zep API
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.
This commit is contained in:
parent
f11c564d75
commit
da694a1d9b
1 changed files with 39 additions and 0 deletions
39
src/backend/langflow/components/memories/ZepMemory.py
Normal file
39
src/backend/langflow/components/memories/ZepMemory.py
Normal file
|
|
@ -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,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue