# Qdrant Qdrant is a high-performance vector similarity search engine and database. It offers a robust, production-ready service with an intuitive API that allows users to store, search, and manage vectors, along with additional payloads. Qdrant supports advanced filtering, making it ideal for applications involving neural network or semantic-based matching, faceted search, and more. Its capabilities are particularly beneficial for developing applications that require efficient and scalable vector search solutions. ## Configuration To use the Qdrant vector database, you need to configure it in your YAML configuration file. Here's an example configuration: ```yaml - name: openai_embed_3_large db_type: qdrant embedding_model: openai_embed_3_large collection_name: openai_embed_3_large client_type: docker embedding_batch: 50 similarity_metric: cosine dimension: 1536 ``` 1. `embedding_model: str` - Purpose: Specifies the name or identifier of the embedding model to be used. - Example: "openai_embed_3_large" - Note: This should correspond to a valid embedding model that your system can use to generate vector embeddings. For more information see [custom your embedding model](https://docs.auto-rag.com/local_model.html#configure-the-embedding-model) documentation. 2. `collection_name: str` - Purpose: Sets the name of the Qdrant collection where the vectors will be stored. - Example: "my_vector_collection" - Note: If the collection doesn't exist, it will be created. If it exists, it will be loaded. 3. `embedding_batch: int = 100` - Purpose: Determines the number of embeddings to process in a single batch. - Default: 100 - Note: Adjust this based on your system's memory and processing capabilities. Larger batches may be faster but require more memory. 4. `similarity_metric: str = "cosine"` - Purpose: Specifies the metric used to calculate similarity between vectors. - Default: "cosine" - Options: "cosine", "l2" (Euclidean distance), "ip" (Inner Product) - Note: Choose the metric that best suits your use case and data characteristics. - Not support "manhattan" 5. `client_type = "docker"` - Purpose: Specifies the type of client you're using to connect to Weaviate. - Default: "docker" - Options: "docker", "cloud" - Note: Choose the appropriate client type based on your deployment. - [docker quick start](https://qdrant.tech/documentation/quickstart/) - [cloud quick start](https://qdrant.tech/documentation/quickstart-cloud/) 6. `url: str = "http://localhost:6333"` - Purpose: The URL of the Qdrant server. - Default: "http://localhost:6333" - Note: Use only `client_type: docker`. You can see full information at [here](https://qdrant.tech/documentation/quickstart/) 7. `host: str` - Purpose: The host of the Qdrant server. - Default: "" - Note: Use only `client_type: cloud`. You can see full information at [here](https://qdrant.tech/documentation/quickstart-cloud/) 8. `api_key: str` - Purpose: The API key for authentication with the Qdrant server. - Default: "" - Note: Use only `client_type: cloud`. You can see full information at [here](https://qdrant.tech/documentation/quickstart-cloud/) 9. `dimension: int = 1536` - Purpose: Specifies the dimension of the vector embeddings. - Default: 1536 - Note: This should correspond to the dimension of the embeddings generated by the specified embedding model. 10. `ingest_batch: int = 64` - Purpose: Determines the number of vectors to ingest in a single batch. - Default: 64 - Note: Adjust this based on your system's memory and processing capabilities. Larger batches may be faster but require more memory. 11. `parallel: int = 1` - Purpose: Determines the number of parallel requests to the Qdrant server. - Default: 1 - Note: Adjust this based on your system's processing capabilities. Increasing parallel requests can improve performance. 12. `max_retries: int = 3` - Purpose: Specifies the maximum number of retries for failed requests to the Qdrant server. - Default: 3 - Note: Set this based on your system's network reliability and the expected failure rate. #### Usage Here's a brief overview of how to use the main functions of the Qdrant vector database: 1. **Adding Vectors**: ```python await qdrant_db.add(ids, texts) ``` This method adds new vectors to the database. It takes a list of IDs and corresponding texts, generates embeddings, and inserts them into the Qdrant collection. 2. **Querying**: ```python ids, distances = await qdrant_db.query(queries, top_k) ``` Performs a similarity search on the stored vectors. It returns the IDs of the most similar vectors and their distances. 3. **Fetching Vectors**: ```python vectors = await qdrant_db.fetch(ids) ``` Retrieves the vectors associated with the given IDs. 4. **Checking Existence**: ```python exists = await qdrant_db.is_exist(ids) ``` Checks if the given IDs exist in the database. 5. **Deleting Vectors**: ```python await qdrant_db.delete(ids) ``` Deletes the vectors associated with the given IDs from the database. 6. **Deleting the Collection**: ```python qdrant_db.delete_collection() ``` Deletes the collection from the Qdrant server.