!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}return t}()||function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}(),document.documentElement.setAttribute("data-announcement-bar-initially-dismissed",function(){try{return"true"===localStorage.getItem("docusaurus.announcement.dismiss")}catch(t){}return!1}())

[Skip to main content](#__docusaurus_skipToContent_fallback)

LangChain v0.2 is coming soon! Preview the new docs [here](/v0.2/docs/introduction/).

[

![🦜️🔗 Langchain](/v0.1/img/brand/wordmark.png)![🦜️🔗 Langchain](/v0.1/img/brand/wordmark-dark.png)

](/v0.1/)[Docs](/v0.1/docs/get_started/introduction/)[Use cases](/v0.1/docs/use_cases/)[Integrations](/v0.1/docs/integrations/platforms/)[API Reference](https://api.js.langchain.com)

[More](#)

*   [People](/v0.1/docs/people/)
*   [Community](/v0.1/docs/community/)
*   [Tutorials](/v0.1/docs/additional_resources/tutorials/)
*   [Contributing](/v0.1/docs/contributing/)

[v0.1](#)

*   [v0.2](https://js.langchain.com/v0.2/docs/introduction)
*   [v0.1](/v0.1/docs/get_started/introduction/)

[🦜🔗](#)

*   [LangSmith](https://smith.langchain.com)
*   [LangSmith Docs](https://docs.smith.langchain.com)
*   [LangChain Hub](https://smith.langchain.com/hub)
*   [LangServe](https://github.com/langchain-ai/langserve)
*   [Python Docs](https://python.langchain.com/)

[Chat](https://chatjs.langchain.com)[](https://github.com/langchain-ai/langchainjs)

Search

*   [Providers](/v0.1/docs/integrations/platforms/)
    
    *   [Providers](/v0.1/docs/integrations/platforms/)
    *   [Anthropic](/v0.1/docs/integrations/platforms/anthropic/)
    *   [AWS](/v0.1/docs/integrations/platforms/aws/)
    *   [Google](/v0.1/docs/integrations/platforms/google/)
    *   [Microsoft](/v0.1/docs/integrations/platforms/microsoft/)
    *   [OpenAI](/v0.1/docs/integrations/platforms/openai/)
*   [Components](/v0.1/docs/integrations/components/)
    
    *   [LLMs](/v0.1/docs/integrations/llms/)
        
    *   [Chat models](/v0.1/docs/integrations/chat/)
        
    *   [Document loaders](/v0.1/docs/integrations/document_loaders/)
        
    *   [Document transformers](/v0.1/docs/integrations/document_transformers/)
        
    *   [Document compressors](/v0.1/docs/integrations/document_compressors/)
        
    *   [Text embedding models](/v0.1/docs/integrations/text_embedding/)
        
    *   [Vector stores](/v0.1/docs/integrations/vectorstores/)
        
        *   [Memory](/v0.1/docs/integrations/vectorstores/memory/)
        *   [AnalyticDB](/v0.1/docs/integrations/vectorstores/analyticdb/)
        *   [Astra DB](/v0.1/docs/integrations/vectorstores/astradb/)
        *   [Azure AI Search](/v0.1/docs/integrations/vectorstores/azure_aisearch/)
        *   [Azure Cosmos DB](/v0.1/docs/integrations/vectorstores/azure_cosmosdb/)
        *   [Cassandra](/v0.1/docs/integrations/vectorstores/cassandra/)
        *   [Chroma](/v0.1/docs/integrations/vectorstores/chroma/)
        *   [ClickHouse](/v0.1/docs/integrations/vectorstores/clickhouse/)
        *   [CloseVector](/v0.1/docs/integrations/vectorstores/closevector/)
        *   [Cloudflare Vectorize](/v0.1/docs/integrations/vectorstores/cloudflare_vectorize/)
        *   [Convex](/v0.1/docs/integrations/vectorstores/convex/)
        *   [Couchbase](/v0.1/docs/integrations/vectorstores/couchbase/)
        *   [Elasticsearch](/v0.1/docs/integrations/vectorstores/elasticsearch/)
        *   [Faiss](/v0.1/docs/integrations/vectorstores/faiss/)
        *   [Google Vertex AI Matching Engine](/v0.1/docs/integrations/vectorstores/googlevertexai/)
        *   [SAP HANA Cloud Vector Engine](/v0.1/docs/integrations/vectorstores/hanavector/)
        *   [HNSWLib](/v0.1/docs/integrations/vectorstores/hnswlib/)
        *   [LanceDB](/v0.1/docs/integrations/vectorstores/lancedb/)
        *   [Milvus](/v0.1/docs/integrations/vectorstores/milvus/)
        *   [Momento Vector Index (MVI)](/v0.1/docs/integrations/vectorstores/momento_vector_index/)
        *   [MongoDB Atlas](/v0.1/docs/integrations/vectorstores/mongodb_atlas/)
        *   [MyScale](/v0.1/docs/integrations/vectorstores/myscale/)
        *   [Neo4j Vector Index](/v0.1/docs/integrations/vectorstores/neo4jvector/)
        *   [Neon Postgres](/v0.1/docs/integrations/vectorstores/neon/)
        *   [OpenSearch](/v0.1/docs/integrations/vectorstores/opensearch/)
        *   [PGVector](/v0.1/docs/integrations/vectorstores/pgvector/)
        *   [Pinecone](/v0.1/docs/integrations/vectorstores/pinecone/)
        *   [Prisma](/v0.1/docs/integrations/vectorstores/prisma/)
        *   [Qdrant](/v0.1/docs/integrations/vectorstores/qdrant/)
        *   [Redis](/v0.1/docs/integrations/vectorstores/redis/)
        *   [Rockset](/v0.1/docs/integrations/vectorstores/rockset/)
        *   [SingleStore](/v0.1/docs/integrations/vectorstores/singlestore/)
        *   [Supabase](/v0.1/docs/integrations/vectorstores/supabase/)
        *   [Tigris](/v0.1/docs/integrations/vectorstores/tigris/)
        *   [Turbopuffer](/v0.1/docs/integrations/vectorstores/turbopuffer/)
        *   [TypeORM](/v0.1/docs/integrations/vectorstores/typeorm/)
        *   [Typesense](/v0.1/docs/integrations/vectorstores/typesense/)
        *   [Upstash Vector](/v0.1/docs/integrations/vectorstores/upstash/)
        *   [USearch](/v0.1/docs/integrations/vectorstores/usearch/)
        *   [Vectara](/v0.1/docs/integrations/vectorstores/vectara/)
        *   [Vercel Postgres](/v0.1/docs/integrations/vectorstores/vercel_postgres/)
        *   [Voy](/v0.1/docs/integrations/vectorstores/voy/)
        *   [Weaviate](/v0.1/docs/integrations/vectorstores/weaviate/)
        *   [Xata](/v0.1/docs/integrations/vectorstores/xata/)
        *   [Zep](/v0.1/docs/integrations/vectorstores/zep/)
    *   [Retrievers](/v0.1/docs/integrations/retrievers/)
        
    *   [Tools](/v0.1/docs/integrations/tools/)
        
    *   [Agents and toolkits](/v0.1/docs/integrations/toolkits/)
        
    *   [Chat Memory](/v0.1/docs/integrations/chat_memory/)
        
    *   [Stores](/v0.1/docs/integrations/stores/)
        

*   [](/v0.1/)
*   [Components](/v0.1/docs/integrations/components/)
*   [Vector stores](/v0.1/docs/integrations/vectorstores/)
*   Zep

On this page

Zep
===

> [Zep](https://www.getzep.com) is a long-term memory service for AI Assistant apps. With Zep, you can provide AI assistants with the ability to recall past conversations, no matter how distant, while also reducing hallucinations, latency, and cost.

> Interested in Zep Cloud? See [Zep Cloud Installation Guide](https://help.getzep.com/sdks), [Zep Cloud Vector Store Example](https://help.getzep.com/langchain/examples/vectorstore-example)

**Note:** The `ZepVectorStore` works with `Documents` and is intended to be used as a `Retriever`. It offers separate functionality to Zep's `ZepMemory` class, which is designed for persisting, enriching and searching your user's chat history.

Why Zep's VectorStore? 🤖🚀[​](#why-zeps-vectorstore- "Direct link to Why Zep's VectorStore? 🤖🚀")
---------------------------------------------------------------------------------------------------

Zep automatically embeds documents added to the Zep Vector Store using low-latency models local to the Zep server. The Zep TS/JS client can be used in non-Node edge environments. These two together with Zep's chat memory functionality make Zep ideal for building conversational LLM apps where latency and performance are important.

### Supported Search Types[​](#supported-search-types "Direct link to Supported Search Types")

Zep supports both similarity search and Maximal Marginal Relevance (MMR) search. MMR search is particularly useful for Retrieval Augmented Generation applications as it re-ranks results to ensure diversity in the returned documents.

Installation[​](#installation "Direct link to Installation")
------------------------------------------------------------

Follow the [Zep Quickstart Guide](https://docs.getzep.com/deployment/quickstart/) to install and get started with Zep.

Usage[​](#usage "Direct link to Usage")
---------------------------------------

You'll need your Zep API URL and optionally an API key to use the Zep VectorStore. See the [Zep docs](https://docs.getzep.com) for more information.

In the examples below, we're using Zep's auto-embedding feature which automatically embed documents on the Zep server using low-latency embedding models. Since LangChain requires passing in a `Embeddings` instance, we pass in `FakeEmbeddings`.

**Note:** If you pass in an `Embeddings` instance other than `FakeEmbeddings`, this class will be used to embed documents. You must also set your document collection to `isAutoEmbedded === false`. See the `OpenAIEmbeddings` example below.

### Example: Creating a ZepVectorStore from Documents & Querying[​](#example-creating-a-zepvectorstore-from-documents--querying "Direct link to Example: Creating a ZepVectorStore from Documents & Querying")

tip

See [this section for general instructions on installing integration packages](/v0.1/docs/get_started/installation/#installing-integration-packages).

*   npm
*   Yarn
*   pnpm

    npm install @langchain/openai @langchain/community

    yarn add @langchain/openai @langchain/community

    pnpm add @langchain/openai @langchain/community

    import { ZepVectorStore } from "@langchain/community/vectorstores/zep";import { FakeEmbeddings } from "@langchain/core/utils/testing";import { TextLoader } from "langchain/document_loaders/fs/text";import { randomUUID } from "crypto";const loader = new TextLoader("src/document_loaders/example_data/example.txt");const docs = await loader.load();export const run = async () => {  const collectionName = `collection${randomUUID().split("-")[0]}`;  const zepConfig = {    apiUrl: "http://localhost:8000", // this should be the URL of your Zep implementation    collectionName,    embeddingDimensions: 1536, // this much match the width of the embeddings you're using    isAutoEmbedded: true, // If true, the vector store will automatically embed documents when they are added  };  const embeddings = new FakeEmbeddings();  const vectorStore = await ZepVectorStore.fromDocuments(    docs,    embeddings,    zepConfig  );  // Wait for the documents to be embedded  // eslint-disable-next-line no-constant-condition  while (true) {    const c = await vectorStore.client.document.getCollection(collectionName);    console.log(      `Embedding status: ${c.document_embedded_count}/${c.document_count} documents embedded`    );    // eslint-disable-next-line no-promise-executor-return    await new Promise((resolve) => setTimeout(resolve, 1000));    if (c.status === "ready") {      break;    }  }  const results = await vectorStore.similaritySearchWithScore("bar", 3);  console.log("Similarity Results:");  console.log(JSON.stringify(results));  const results2 = await vectorStore.maxMarginalRelevanceSearch("bar", {    k: 3,  });  console.log("MMR Results:");  console.log(JSON.stringify(results2));};

#### API Reference:

*   [ZepVectorStore](https://api.js.langchain.com/classes/langchain_community_vectorstores_zep.ZepVectorStore.html) from `@langchain/community/vectorstores/zep`
*   [FakeEmbeddings](https://api.js.langchain.com/classes/langchain_core_utils_testing.FakeEmbeddings.html) from `@langchain/core/utils/testing`
*   [TextLoader](https://api.js.langchain.com/classes/langchain_document_loaders_fs_text.TextLoader.html) from `langchain/document_loaders/fs/text`

### Example: Querying a ZepVectorStore using a metadata filter[​](#example-querying-a-zepvectorstore-using-a-metadata-filter "Direct link to Example: Querying a ZepVectorStore using a metadata filter")

    import { ZepVectorStore } from "@langchain/community/vectorstores/zep";import { FakeEmbeddings } from "@langchain/core/utils/testing";import { randomUUID } from "crypto";import { Document } from "@langchain/core/documents";const docs = [  new Document({    metadata: { album: "Led Zeppelin IV", year: 1971 },    pageContent:      "Stairway to Heaven is one of the most iconic songs by Led Zeppelin.",  }),  new Document({    metadata: { album: "Led Zeppelin I", year: 1969 },    pageContent:      "Dazed and Confused was a standout track on Led Zeppelin's debut album.",  }),  new Document({    metadata: { album: "Physical Graffiti", year: 1975 },    pageContent:      "Kashmir, from Physical Graffiti, showcases Led Zeppelin's unique blend of rock and world music.",  }),  new Document({    metadata: { album: "Houses of the Holy", year: 1973 },    pageContent:      "The Rain Song is a beautiful, melancholic piece from Houses of the Holy.",  }),  new Document({    metadata: { band: "Black Sabbath", album: "Paranoid", year: 1970 },    pageContent:      "Paranoid is Black Sabbath's second studio album and includes some of their most notable songs.",  }),  new Document({    metadata: {      band: "Iron Maiden",      album: "The Number of the Beast",      year: 1982,    },    pageContent:      "The Number of the Beast is often considered Iron Maiden's best album.",  }),  new Document({    metadata: { band: "Metallica", album: "Master of Puppets", year: 1986 },    pageContent:      "Master of Puppets is widely regarded as Metallica's finest work.",  }),  new Document({    metadata: { band: "Megadeth", album: "Rust in Peace", year: 1990 },    pageContent:      "Rust in Peace is Megadeth's fourth studio album and features intricate guitar work.",  }),];export const run = async () => {  const collectionName = `collection${randomUUID().split("-")[0]}`;  const zepConfig = {    apiUrl: "http://localhost:8000", // this should be the URL of your Zep implementation    collectionName,    embeddingDimensions: 1536, // this much match the width of the embeddings you're using    isAutoEmbedded: true, // If true, the vector store will automatically embed documents when they are added  };  const embeddings = new FakeEmbeddings();  const vectorStore = await ZepVectorStore.fromDocuments(    docs,    embeddings,    zepConfig  );  // Wait for the documents to be embedded  // eslint-disable-next-line no-constant-condition  while (true) {    const c = await vectorStore.client.document.getCollection(collectionName);    console.log(      `Embedding status: ${c.document_embedded_count}/${c.document_count} documents embedded`    );    // eslint-disable-next-line no-promise-executor-return    await new Promise((resolve) => setTimeout(resolve, 1000));    if (c.status === "ready") {      break;    }  }  vectorStore    .similaritySearchWithScore("sad music", 3, {      where: { jsonpath: "$[*] ? (@.year == 1973)" }, // We should see a single result: The Rain Song    })    .then((results) => {      console.log(`\n\nSimilarity Results:\n${JSON.stringify(results)}`);    })    .catch((e) => {      if (e.name === "NotFoundError") {        console.log("No results found");      } else {        throw e;      }    });  // We're not filtering here, but rather demonstrating MMR at work.  // We could also add a filter to the MMR search, as we did with the similarity search above.  vectorStore    .maxMarginalRelevanceSearch("sad music", {      k: 3,    })    .then((results) => {      console.log(`\n\nMMR Results:\n${JSON.stringify(results)}`);    })    .catch((e) => {      if (e.name === "NotFoundError") {        console.log("No results found");      } else {        throw e;      }    });};

#### API Reference:

*   [ZepVectorStore](https://api.js.langchain.com/classes/langchain_community_vectorstores_zep.ZepVectorStore.html) from `@langchain/community/vectorstores/zep`
*   [FakeEmbeddings](https://api.js.langchain.com/classes/langchain_core_utils_testing.FakeEmbeddings.html) from `@langchain/core/utils/testing`
*   [Document](https://api.js.langchain.com/classes/langchain_core_documents.Document.html) from `@langchain/core/documents`

### Example: Using a LangChain Embedding Class such as `OpenAIEmbeddings`[​](#example-using-a-langchain-embedding-class-such-as-openaiembeddings "Direct link to example-using-a-langchain-embedding-class-such-as-openaiembeddings")

    import { ZepVectorStore } from "@langchain/community/vectorstores/zep";import { OpenAIEmbeddings } from "@langchain/openai";import { TextLoader } from "langchain/document_loaders/fs/text";import { randomUUID } from "crypto";const loader = new TextLoader("src/document_loaders/example_data/example.txt");const docs = await loader.load();export const run = async () => {  const collectionName = `collection${randomUUID().split("-")[0]}`;  const zepConfig = {    apiUrl: "http://localhost:8000", // this should be the URL of your Zep implementation    collectionName,    embeddingDimensions: 1536, // this much match the width of the embeddings you're using    isAutoEmbedded: false, // set to false to disable auto-embedding  };  const embeddings = new OpenAIEmbeddings();  const vectorStore = await ZepVectorStore.fromDocuments(    docs,    embeddings,    zepConfig  );  const results = await vectorStore.similaritySearchWithScore("bar", 3);  console.log("Similarity Results:");  console.log(JSON.stringify(results));  const results2 = await vectorStore.maxMarginalRelevanceSearch("bar", {    k: 3,  });  console.log("MMR Results:");  console.log(JSON.stringify(results2));};

#### API Reference:

*   [ZepVectorStore](https://api.js.langchain.com/classes/langchain_community_vectorstores_zep.ZepVectorStore.html) from `@langchain/community/vectorstores/zep`
*   [OpenAIEmbeddings](https://api.js.langchain.com/classes/langchain_openai.OpenAIEmbeddings.html) from `@langchain/openai`
*   [TextLoader](https://api.js.langchain.com/classes/langchain_document_loaders_fs_text.TextLoader.html) from `langchain/document_loaders/fs/text`

* * *

#### Help us out by providing feedback on this documentation page:

[

Previous

Xata

](/v0.1/docs/integrations/vectorstores/xata/)[

Next

Retrievers

](/v0.1/docs/integrations/retrievers/)

*   [Why Zep's VectorStore? 🤖🚀](#why-zeps-vectorstore-)
    *   [Supported Search Types](#supported-search-types)
*   [Installation](#installation)
*   [Usage](#usage)
    *   [Example: Creating a ZepVectorStore from Documents & Querying](#example-creating-a-zepvectorstore-from-documents--querying)
    *   [Example: Querying a ZepVectorStore using a metadata filter](#example-querying-a-zepvectorstore-using-a-metadata-filter)
    *   [Example: Using a LangChain Embedding Class such as `OpenAIEmbeddings`](#example-using-a-langchain-embedding-class-such-as-openaiembeddings)

Community

*   [Discord](https://discord.gg/cU2adEyC7w)
*   [Twitter](https://twitter.com/LangChainAI)

GitHub

*   [Python](https://github.com/langchain-ai/langchain)
*   [JS/TS](https://github.com/langchain-ai/langchainjs)

More

*   [Homepage](https://langchain.com)
*   [Blog](https://blog.langchain.dev)

Copyright © 2024 LangChain, Inc.