Class that extends the VectorStore base class to interact with a Qdrant database. It includes methods for adding documents and vectors to the Qdrant database, searching for similar vectors, and ensuring the existence of a collection in the database.

Hierarchy

Constructors

Properties

FilterType: string | object
client: QdrantClient
collectionName: string
embeddings: Embeddings
collectionConfig?: {}

Type declaration

    Methods

    • Method to add documents to the Qdrant database. It generates vectors from the documents using the Embeddings instance and then adds the vectors to the database.

      Parameters

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

        Array of Document instances to be added to the Qdrant database.

      • Optional documentOptions: AddDocumentOptions

        Optional AddDocumentOptions which has a list of JSON objects for extra querying

      Returns Promise<void>

      Promise that resolves when the documents have been added to the database.

    • Method to add vectors to the Qdrant database. Each vector is associated with a document, which is stored as the payload for a point in the database.

      Parameters

      • vectors: number[][]

        Array of vectors to be added to the Qdrant database.

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

        Array of Document instances associated with the vectors.

      • Optional documentOptions: AddDocumentOptions

        Optional AddDocumentOptions which has a list of JSON objects for extra querying

      Returns Promise<void>

      Promise that resolves when the vectors have been added to the database.

    • Parameters

      • Optional _params: Record<string, any>

      Returns Promise<void>

    • Method to ensure the existence of a collection in the Qdrant database. If the collection does not exist, it is created.

      Returns Promise<void>

      Promise that resolves when the existence of the collection has been ensured.

    • Parameters

      • query: string
      • k: number = 4
      • filter: undefined | string | object = undefined
      • _callbacks: undefined | Callbacks = undefined

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

    • Method to search for vectors in the Qdrant database that are similar to a given query vector. The search results include the score and payload (metadata and content) for each similar vector.

      Parameters

      • query: number[]

        Query vector to search for similar vectors in the Qdrant database.

      • Optional k: number

        Optional number of similar vectors to return. If not specified, all similar vectors are returned.

      • Optional filter: {}

        Optional filter to apply to the search results.

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

        Promise that resolves with an array of tuples, where each tuple includes a Document instance and a score for a similar vector.

      • Parameters

        • query: string
        • k: number = 4
        • filter: undefined | string | object = undefined
        • _callbacks: undefined | Callbacks = undefined

        Returns Promise<[Document<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<Document<Record<string, any>>[]>

        • List of documents selected by maximal marginal relevance.
      • Static method to create a QdrantVectorStore instance from Document instances. The documents are added to the Qdrant database.

        Parameters

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

          Array of Document instances to be added to the Qdrant database.

        • embeddings: Embeddings

          Embeddings instance used to generate vectors from the documents.

        • dbConfig: QdrantLibArgs

          QdrantLibArgs instance specifying the configuration for the Qdrant database.

        Returns Promise<QdrantVectorStore>

        Promise that resolves with a new QdrantVectorStore instance.

      • Static method to create a QdrantVectorStore instance from an existing collection in the Qdrant database.

        Parameters

        • embeddings: Embeddings

          Embeddings instance used to generate vectors from the documents in the collection.

        • dbConfig: QdrantLibArgs

          QdrantLibArgs instance specifying the configuration for the Qdrant database.

        Returns Promise<QdrantVectorStore>

        Promise that resolves with a new QdrantVectorStore instance.

      • Static method to create a QdrantVectorStore instance from texts. Each text is associated with metadata and converted to a Document instance, which is then added to the Qdrant database.

        Parameters

        • texts: string[]

          Array of texts to be converted to Document instances and added to the Qdrant database.

        • metadatas: object | object[]

          Array or single object of metadata to be associated with the texts.

        • embeddings: Embeddings

          Embeddings instance used to generate vectors from the texts.

        • dbConfig: QdrantLibArgs

          QdrantLibArgs instance specifying the configuration for the Qdrant database.

        Returns Promise<QdrantVectorStore>

        Promise that resolves with a new QdrantVectorStore instance.

      Generated using TypeDoc