Skip to main content

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

Tests lint Release to PyPI GitHub

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


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.34.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

zep_python-0.34-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file zep_python-0.34.tar.gz.

File metadata

  • Download URL: zep_python-0.34.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for zep_python-0.34.tar.gz
Algorithm Hash digest
SHA256 804142feb86e81571ca62945f0dceda8e47caa1f74711e6b682ed26959ce1fe3
MD5 0344507237202b56cf6e89854037e897
BLAKE2b-256 043455a7d549ea5b518f3fda34106df8a6423476b5bfb8690265cf3bcbadbd3a

See more details on using hashes here.

File details

Details for the file zep_python-0.34-py3-none-any.whl.

File metadata

  • Download URL: zep_python-0.34-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for zep_python-0.34-py3-none-any.whl
Algorithm Hash digest
SHA256 a07b3baf8dc5610b76d7334521f38c7d6120292480f4087b8e89c67979adf88a
MD5 eaab3ab3acbc3055bd974d1502c3babd
BLAKE2b-256 5ccbf18932ee7f8506783ee9fc40dc2d3837af6b43908df47c91e037c714625d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page