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://getzep.github.io
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, SearchPayload, 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`
memories = await client.aget_memory(session_id)
for memory in memories:
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 = SearchPayload({}, "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.25.tar.gz
(10.1 kB
view hashes)
Built Distribution
zep_python-0.25-py3-none-any.whl
(11.1 kB
view hashes)
Close
Hashes for zep_python-0.25-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d486afc0d621c3211020d89408940bcad4a062bcbb6f5623bf5152fccad1f87e |
|
MD5 | abd007b22dcd6f203fc0a45d99a455f6 |
|
BLAKE2b-256 | cd46bd775fb104da930c3599b67ad0e788352a9ba76e0c115188293e17096396 |