Zep stores, manages, enriches, indexes, and searches long-term memory for conversational AI applications. This is the Python client for the Zep service.
Project description
Zep: A long-term memory store for conversational AI applications
This is the Python client package for the Zep service. For more information about Zep, see https://github.com/getzep/zep.
Zep documentation: https://docs.getzep.com
Installation
pip install zep-python
or
poetry add zep-python
Quick Start
Ensure that you have a Zep server running. See https://github.com/getzep/zep.
import asyncio
from zep_python import Memory, Message, MemorySearchPayload, ZepClient
base_url = "http://localhost:8000" # TODO: Replace with Zep API URL
session_id = "2a2a2a" # an identifier for your user's session.
async with ZepClient(base_url) as client:
role = "user"
content = "who was the first man to go to space?"
message = Message(role=role, content=content)
memory = Memory()
memory.messages = [message]
# Add a memory
result = await client.aadd_memory(session_id, memory)
# Long chat histories will automatically be summarized.
# A summary and chat history are returned with a `get_memory`
memory = await client.aget_memory(session_id)
for message in memory.messages:
print(message.to_dict())
# Search memory
# Messages uploaded to Zep are automatically embedded and made available
# for vector-based similarity search.
search_payload = MemorySearchPayload("Who is Yuri Gagarin?")
search_results = await client.asearch_memory(session_id, search_payload)
for search_result in search_results:
# Access the 'content' field within the 'message' object.
message_content = search_result.message
print(message_content)
Server Installation and SDK Documentation
Server installation documentation and more available here: https://getzep.github.io
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zep_python-0.32.tar.gz
(10.0 kB
view details)
Built Distribution
zep_python-0.32-py3-none-any.whl
(10.8 kB
view details)
File details
Details for the file zep_python-0.32.tar.gz
.
File metadata
- Download URL: zep_python-0.32.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.1 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7320b36069b4063119fef0f90a7f75fabf0d6e77083abf5f187b5d241ce1576b |
|
MD5 | 42bae89e0959db815c802af742525326 |
|
BLAKE2b-256 | a3b317064e4d02daba7cb66ade9b5aed646a1e34657b93e9631c6e88e646fb93 |
File details
Details for the file zep_python-0.32-py3-none-any.whl
.
File metadata
- Download URL: zep_python-0.32-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.1 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b4e54851c28742e869b8a66928b16618ff0074375428791c7bc4221c2744085 |
|
MD5 | 43e77d70dd0c729d1e50f9d809ca0a5d |
|
BLAKE2b-256 | 85c2802d1f3a962151c2bcc5070978448cd9d6475696998bf8ec267fc330245f |