Skip to main content

Overview

The Qdrant Vector Search Tool enables semantic search capabilities in your CrewAI agents by leveraging Qdrant, a vector similarity search engine. This tool allows your agents to search through documents stored in a Qdrant collection using semantic similarity.

Installation

Install the required packages:

Basic Usage

Here’s a minimal example of how to use the tool:

Complete Working Example

Here’s a complete example showing how to:
  1. Extract text from a PDF
  2. Generate embeddings using OpenAI
  3. Store in Qdrant
  4. Create a CrewAI agentic RAG workflow for semantic search

Tool Parameters

Required Parameters

  • qdrant_config (QdrantConfig): Configuration object containing all Qdrant settings

QdrantConfig Parameters

  • qdrant_url (str): The URL of your Qdrant server
  • qdrant_api_key (str, optional): API key for authentication with Qdrant
  • collection_name (str): Name of the Qdrant collection to search
  • limit (int): Maximum number of results to return (default: 3)
  • score_threshold (float): Minimum similarity score threshold (default: 0.35)
  • filter (Any, optional): Qdrant Filter instance for advanced filtering (default: None)

Optional Tool Parameters

  • custom_embedding_fn (Callable[[str], list[float]]): Custom function for text vectorization
  • qdrant_package (str): Base package path for Qdrant (default: “qdrant_client”)
  • client (Any): Pre-initialized Qdrant client (optional)

Advanced Filtering

The QdrantVectorSearchTool supports powerful filtering capabilities to refine your search results:

Dynamic Filtering

Use filter_by and filter_value parameters in your search to filter results on-the-fly:

Preset Filters with QdrantConfig

For complex filtering, use Qdrant Filter instances in your configuration:

Combining Filters

The tool automatically combines preset filters from QdrantConfig with dynamic filters from filter_by and filter_value:

Search Parameters

The tool accepts these parameters in its schema:
  • query (str): The search query to find similar documents
  • filter_by (str, optional): Metadata field to filter on
  • filter_value (Any, optional): Value to filter by

Return Format

The tool returns results in JSON format:

Default Embedding

By default, the tool uses OpenAI’s text-embedding-3-large model for vectorization. This requires:
  • OpenAI API key set in environment: OPENAI_API_KEY

Custom Embeddings

Instead of using the default embedding model, you might want to use your own embedding function in cases where you:
  1. Want to use a different embedding model (e.g., Cohere, HuggingFace, Ollama models)
  2. Need to reduce costs by using open-source embedding models
  3. Have specific requirements for vector dimensions or embedding quality
  4. Want to use domain-specific embeddings (e.g., for medical or legal text)
Here’s an example using a HuggingFace model:

Error Handling

The tool handles these specific errors:
  • Raises ImportError if qdrant-client is not installed (with option to auto-install)
  • Raises ValueError if QDRANT_URL is not set
  • Prompts to install qdrant-client if missing using uv add qdrant-client

Environment Variables

Required environment variables: