Class representing a RedisVectorStore. It extends the VectorStore class and includes methods for adding documents and vectors, performing similarity searches, managing the index, and more.

Hierarchy

Constructors

Properties

contentKey: string
createIndexOptions: CreateOptions
indexName: string
keyPrefix: string
metadataKey: string
vectorKey: string

Methods

  • Method for adding documents to the RedisVectorStore. It first converts the documents to texts and then adds them as vectors.

    Parameters

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

      The documents to add.

    • Optional options: RedisAddOptions

      Optional parameters for adding the documents.

    Returns Promise<void>

    A promise that resolves when the documents have been added.

  • Method for adding vectors to the RedisVectorStore. It checks if the index exists and creates it if it doesn't, then adds the vectors in batches.

    Parameters

    • vectors: number[][]

      The vectors to add.

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

      The documents associated with the vectors.

    • __namedParameters: RedisAddOptions = {}

    Returns Promise<void>

    A promise that resolves when the vectors have been added.

  • Method for creating an index in the RedisVectorStore. If the index already exists, it does nothing.

    Parameters

    • dimensions: number = 1536

      The dimensions of the index

    Returns Promise<void>

    A promise that resolves when the index has been created.

  • Method for dropping an index from the RedisVectorStore.

    Parameters

    • Optional deleteDocuments: boolean

      Optional boolean indicating whether to drop the associated documents.

    Returns Promise<boolean>

    A promise that resolves to a boolean indicating whether the index was dropped.

  • Parameters

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

  • Parameters

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

  • Return documents selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to the query AND diversity among selected documents.

    Parameters

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

    • List of documents selected by maximal marginal relevance.

Generated using TypeDoc