ZepVectorStore 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 zep-js to be installed:

npm install @getzep/zep-js

Hierarchy

Constructors

Properties

FilterType: string | object
client: default

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

collection: default

The Zep document collection.

embeddings: Embeddings
lc_kwargs: SerializedFields
lc_namespace: string[] = ...

A path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.

lc_serializable: boolean = false

Accessors

  • get lc_aliases(): undefined | {
        [key: string]: string;
    }
  • A map of aliases for constructor args. Keys are the attribute names, e.g. "foo". Values are the alias that will replace the key in serialization. This is used to eg. make argument names match Python.

    Returns undefined | {
        [key: string]: string;
    }

  • get lc_attributes(): undefined | SerializedFields
  • A map of additional attributes to merge with constructor args. Keys are the attribute names, e.g. "foo". Values are the attribute values, which will be serialized. These attributes need to be accepted by the constructor as arguments.

    Returns undefined | SerializedFields

  • get lc_secrets(): undefined | {
        [key: string]: string;
    }
  • A map of secrets, which will be omitted from serialization. Keys are paths to the secret in constructor args, e.g. "foo.bar.baz". Values are the secret ids, which will be used when deserializing.

    Returns undefined | {
        [key: string]: string;
    }

Methods

  • Parameters

    • query: string
    • k: number
    • Optional filter: Record<string, unknown>

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

  • 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 vectors and corresponding documents to the collection.

    Parameters

    • vectors: number[][]

      The vectors to add.

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

      The corresponding documents to add.

    Returns Promise<string[]>

    • A promise that resolves with the UUIDs of the added documents.
  • Performs a similarity search on the Zep collection.

    Parameters

    • query: string

      The query string to search for.

    • Optional k: number = 4

      The number of results to return. Defaults to 4.

    • Optional filter: 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.

    Async

  • Performs a similarity search in the collection and returns the results with their scores.

    Parameters

    • query: number[]

      The query vector.

    • k: number

      The number of results to return.

    • Optional filter: Record<string, unknown>

      The filter to apply to the search. Zep only supports Record<string, unknown> as filter.

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

    • A promise that resolves with the search results and their scores.
  • 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: Embeddings

      The embeddings to use for vectorizing the texts.

    • zepConfig: IZepConfig

      The configuration object for the Zep API.

    Returns Promise<ZepVectorStore>

    • A promise that resolves with the new ZepVectorStore instance.
  • The name of the serializable. Override to provide an alias or to preserve the serialized module name in minified environments.

    Implemented as a static method to support loading logic.

    Returns string

Generated using TypeDoc