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
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
collectionConfig?: {}

Type declaration

    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(): {
          [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 {
          [key: string]: string;
      }

      • [key: string]: string

    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.

      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.

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

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

      • 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