ZepCloudVectorStore is a VectorStore implementation that uses the Zep long-term memory store as a backend.

If the collection does not exist, it will be created automatically.

Requires @getzep/zep-cloud to be installed:

Hierarchy

  • VectorStore
    • ZepCloudVectorStore

Constructors

Properties

FilterType: string | object

Defines the filter type used in search and delete operations. Can be an object for structured conditions or a string for simpler filtering.

client: ZepClient

The ZepClient instance used to interact with Zep's API.

collectionName: string
embeddings: EmbeddingsInterface

Embeddings interface for generating vector embeddings from text queries, enabling vector-based similarity searches.

Methods

  • Adds documents to the collection. The documents are first embedded into vectors using the provided embedding model.

    Parameters

    • documents: Document<Record<string, any>>[]

      The documents to add.

    Returns Promise<string[]>

    • A promise that resolves with the UUIDs of the added documents.
  • Adds precomputed vectors and corresponding documents to the vector store.

    Returns Promise<string[]>

    A promise resolving to an array of document IDs or void, based on implementation.

  • Creates a VectorStoreRetriever instance with flexible configuration options.

    Parameters

    • OptionalkOrFields: number | Partial<VectorStoreRetrieverInput<ZepCloudVectorStore>>

      If a number is provided, it sets the k parameter (number of items to retrieve).

      • If an object is provided, it should contain various configuration options.
    • Optionalfilter: string | object

      Optional filter criteria to limit the items retrieved based on the specified filter type.

    • Optionalcallbacks: Callbacks

      Optional callbacks that may be triggered at specific stages of the retrieval process.

    • Optionaltags: string[]

      Tags to categorize or label the VectorStoreRetriever. Defaults to an empty array if not provided.

    • Optionalmetadata: Record<string, unknown>

      Additional metadata as key-value pairs to add contextual information for the retrieval process.

    • Optionalverbose: boolean

      If true, enables detailed logging for the retrieval process. Defaults to false.

    Returns VectorStoreRetriever<ZepCloudVectorStore>

    • A configured VectorStoreRetriever instance based on the provided parameters.

    Basic usage with a k value:

    const retriever = myVectorStore.asRetriever(5);
    

    Usage with a configuration object:

    const retriever = myVectorStore.asRetriever({
    k: 10,
    filter: myFilter,
    tags: ['example', 'test'],
    verbose: true,
    searchType: 'mmr',
    searchKwargs: { alpha: 0.5 },
    });
  • Return documents selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to the query AND diversity among selected documents.

    Parameters

    • query: string

      Text to look up documents similar to.

    • options: MaxMarginalRelevanceSearchOptions<string | object>

    Returns Promise<Document<Record<string, any>>[]>

    • List of documents selected by maximal marginal relevance.
  • Performs a similarity search on the Zep collection.

    Parameters

    • query: string

      The query string to search for.

    • Optionalk: number = 4

      The number of results to return. Defaults to 4.

    • Optionalfilter: string | object = undefined

      An optional set of JSONPath filters to apply to the search.

    • Optional_callbacks: Callbacks = undefined

      Optional callbacks. Currently not implemented.

    Returns Promise<Document<Record<string, any>>[]>

    • A promise that resolves to an array of Documents that are similar to the query.
  • Performs a similarity search using a vector query and returns results along with their similarity scores.

    Returns Promise<[Document<Record<string, any>>, number][]>

    A promise resolving to an array of tuples containing documents and their similarity scores.

  • Searches for documents similar to a text query by embedding the query, and returns results with similarity scores.

    Parameters

    • query: string

      Text query for finding similar documents.

    • k: number = 4

      Number of similar results to return. Defaults to 4.

    • filter: undefined | Record<string, unknown> = undefined

      Optional filter based on FilterType.

    • _callbacks: undefined = undefined

      Optional callbacks for monitoring search progress

    Returns Promise<[Document<Record<string, any>>, number][]>

    A promise resolving to an array of tuples, each containing a document and its similarity score.

  • Returns Serialized

  • Creates a new ZepVectorStore instance from an array of Documents. Each Document is added to a Zep collection.

    Parameters

    • docs: Document<Record<string, any>>[]

      The Documents to add.

    • embeddings: EmbeddingsInterface

      Pass FakeEmbeddings, Zep Cloud will handle text embedding for you.

    • zepConfig: IZepCloudConfig

      The configuration object for the Zep API.

    Returns Promise<ZepCloudVectorStore>

    • A promise that resolves with the new ZepVectorStore instance.
  • Creates a new ZepVectorStore instance from an array of texts. Each text is converted into a Document and added to the collection.

    Parameters

    • texts: string[]

      The texts to convert into Documents.

    • metadatas: object | object[]

      The metadata to associate with each Document. If an array is provided, each element is associated with the corresponding Document. If an object is provided, it is associated with all Documents.

    • embeddings: EmbeddingsInterface

      Pass FakeEmbeddings, Zep Cloud will handle text embedding for you.

    • zepConfig: IZepCloudConfig

      The configuration object for the Zep API.

    Returns Promise<ZepCloudVectorStore>

    • A promise that resolves with the new ZepVectorStore instance.