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://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`
    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 = 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


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

Uploaded Source

Built Distribution

zep_python-0.30-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zep_python-0.30.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for zep_python-0.30.tar.gz
Algorithm Hash digest
SHA256 902720af8ffdda861ae1ee1d88e374a095195f1dc3ef79a78ecc699062ace203
MD5 e1d3f9d9a3494b0e1d8807edc2dad1c4
BLAKE2b-256 71274d9a6c5681ea030e8e976cefd7198279ed3561ee45875774ab0a74fc4623

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zep_python-0.30-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for zep_python-0.30-py3-none-any.whl
Algorithm Hash digest
SHA256 6020d2f3c6dc3c3bfb8de62db88d97a8c0cf4029b5def0c8a682c3ddc2c480d2
MD5 8b9153547ede56bd38d1d446288e96b4
BLAKE2b-256 d439b79b6f47a960158bdc1de4e27dcbc3f390f5879bef689cd6ae38f11167d1

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