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:- Extract text from a PDF
- Generate embeddings using OpenAI
- Store in Qdrant
- Create a CrewAI agentic RAG workflow for semantic search
Tool Parameters
Required Parameters
qdrant_url
(str): The URL of your Qdrant serverqdrant_api_key
(str): API key for authentication with Qdrantcollection_name
(str): Name of the Qdrant collection to search
Optional Parameters
limit
(int): Maximum number of results to return (default: 3)score_threshold
(float): Minimum similarity score threshold (default: 0.35)custom_embedding_fn
(Callable[[str], list[float]]): Custom function for text vectorization
Search Parameters
The tool accepts these parameters in its schema:query
(str): The search query to find similar documentsfilter_by
(str, optional): Metadata field to filter onfilter_value
(str, optional): Value to filter by
Return Format
The tool returns results in JSON format:Default Embedding
By default, the tool uses OpenAI’stext-embedding-3-small
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:- Want to use a different embedding model (e.g., Cohere, HuggingFace, Ollama models)
- Need to reduce costs by using open-source embedding models
- Have specific requirements for vector dimensions or embedding quality
- Want to use domain-specific embeddings (e.g., for medical or legal text)
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 usinguv add qdrant-client