⚠️ Deprecated ⚠️

Install and import from @langchain/qdrant instead.

This feature is deprecated and will be removed in the future.

It is not recommended for use.

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 (view full)

Constructors

Properties

FilterType: {}

Type declaration

    client: QdrantClient
    collectionName: string
    contentPayloadKey: string
    metadataPayloadKey: string
    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[]

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

        • Optional documentOptions: QdrantAddDocumentOptions

          Optional QdrantAddDocumentOptions 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[]

          Array of Document instances associated with the vectors.

        • Optional documentOptions: QdrantAddDocumentOptions

          Optional QdrantAddDocumentOptions 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.

      • 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.

      • 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, number][]>

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

        • Static method to create a QdrantVectorStore instance from Document instances. The documents are added to the Qdrant database.

          Parameters

          • docs: Document[]

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

          • embeddings: EmbeddingsInterface

            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: EmbeddingsInterface

            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: EmbeddingsInterface

            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