GithubHelp home page GithubHelp logo

connorblack / zep Goto Github PK

View Code? Open in Web Editor NEW

This project forked from getzep/zep

0.0 0.0 0.0 16.32 MB

Zep: Fast, scalable building blocks for production LLM apps

Home Page: https://docs.getzep.com

License: Apache License 2.0

Shell 0.08% JavaScript 1.10% Go 81.79% CSS 5.43% Makefile 0.47% HTML 11.07% Dockerfile 0.06%

zep's Introduction

Zep Logo

Zep: Fast, scalable building blocks for LLM apps

Chat history memory, embedding, vector search, data enrichment, and more.


Chat on Discord Twitter Follow PyPI - Downloads @getzep/zep-js build/test GoLangCI Lint

Quick Start | Documentation | LangChain and LlamaIndex Support | Discord
www.getzep.com

What is Zep?

Zep is an open source platform for productionizing LLM apps. Zep summarizes, embeds, and enriches chat histories and documents asynchronously, ensuring these operations don't impact your user's chat experience. Data is persisted to database, allowing you to scale out when growth demands. As drop-in replacements for popular LangChain components, you can get to production in minutes without rewriting code.

Zep Demo Video

⭐️ Core Features

💬 Designed for building conversational LLM applications

  • Manage users, sessions, chat messages, chat roles, and more, not just texts and embeddings.
  • Build autopilots, agents, Q&A over docs apps, chatbots, and more.

⚡️ Fast, scalable, low-latency APIs and stateless deployments

  • Zep’s local embedding models and async enrichment ensure a snappy user experience.
  • Storing documents and history in Zep and not in memory enables stateless deployment.

🛠️ Use as drop-in replacements for LangChain or LlamaIndex components, or with a frameworkless app.

  • Zep Memory and VectorStore implementations are shipped with LangChain, LangChain.js, and LlamaIndex.
  • Python & TypeScript/JS SDKs for easy integration with your LLM app.
  • TypeScript/JS SDK supports edge deployment.

🔎 Vector Database with Hybrid Search

  • Populate your prompts with relevant documents and chat history.
  • Rich metadata and JSONPath query filters offer a powerful hybrid search over texts.

🔋 Batteries Included Embedding & Enrichment

  • Automatically embed texts and messages using state-of-the-art open source models, OpenAI, or bring your own vectors.
  • Enrichment of chat histories with summaries, named entities, token counts. Use these as search filters.
  • Associate your own metadata with sessions, documents & chat histories.

Learn more

Examples

Create Users, Chat Sessions, and Chat Messages (Zep Python SDK)

user_request = CreateUserRequest(
    user_id=user_id,
    email="[email protected]",
    first_name="Jane",
    last_name="Smith",
    metadata={"foo": "bar"},
)
new_user = client.user.add(user_request)

# create a chat session
session_id = uuid.uuid4().hex # A new session identifier
session = Session(
            session_id=session_id, 
            user_id=user_id,
            metadata={"foo" : "bar"}
        )
client.memory.add_session(session)

# Add a chat message to the session
history = [
     { role: "human", content: "Who was Octavia Butler?" },
]
messages = [Message(role=m.role, content=m.content) for m in history]
memory = Memory(messages=messages)
client.memory.add_memory(session_id, memory)

# Get all sessions for user_id
sessions = client.user.getSessions(user_id)

Persist Chat History with LangChain.js (Zep TypeScript SDK)

const memory = new ZepMemory({
    sessionId,
    baseURL: zepApiURL,
    apiKey: zepApiKey,
});
const chain = new ConversationChain({ llm: model, memory });
const response = await chain.run(
    {
        input="What is the book's relevance to the challenges facing contemporary society?"
    },
);

Hybrid similarity search over a document collection with text input and JSONPath filters (TypeScript)

const query = "Who was Octavia Butler?";
const searchResults = await collection.search({ text: query }, 3);

// Search for documents using both text and metadata
const metadataQuery = {
    where: { jsonpath: '$[*] ? (@.genre == "scifi")' },
};

const newSearchResults = await collection.search(
    {
        text: query,
        metadata: metadataQuery,
    },
    3
);

Create a LlamaIndex Index using Zep as a VectorStore (Python)

from llama_index import VectorStoreIndex, SimpleDirectoryReader
from llama_index.vector_stores import ZepVectorStore
from llama_index.storage.storage_context import StorageContext

vector_store = ZepVectorStore(
    api_url=zep_api_url,
    api_key=zep_api_key,
    collection_name=collection_name
)

documents = SimpleDirectoryReader("documents/").load_data()
storage_context = StorageContext.from_defaults(vector_store=vector_store)
index = VectorStoreIndex.from_documents(
                            documents,
                            storage_context=storage_context
)

Search by embedding (Zep Python SDK)

# Search by embedding vector, rather than text query
# embedding is a list of floats
results = collection.search(
    embedding=embedding, limit=5
)

Get Started

Install Server

Please see the Zep Quick Start Guide for important configuration information.

docker compose up

Looking for other deployment options?

Install SDK

Please see the Zep Develoment Guide for important beta information and usage instructions.

pip install zep-python

or

npm i @getzep/zep-js

zep's People

Contributors

connorblack avatar danielchalef avatar dependabot[bot] avatar petergarbers avatar rsharath avatar sweep-ai[bot] avatar zetaphor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.