Skip to main content
The Qdrant tool lets an agent run vector similarity search for semantic retrieval and RAG.

Overview

Qdrant is a vector similarity search engine. Use it for semantic search, recommendations, and RAG applications.

Installation

pip install "praisonai[tools]"

Environment Variables

export QDRANT_URL=http://localhost:6333
export QDRANT_API_KEY="${QDRANT_API_KEY:?Set QDRANT_API_KEY in your shell}"  # Optional for cloud

How It Works

Quick Start

1

Simple Usage

from praisonai_tools import QdrantTool

# Initialize
qdrant = QdrantTool(url="http://localhost:6333")

# Search
results = qdrant.search("products", query_vector=[0.1, 0.2, ...], limit=5)
print(results)
2

With Configuration

Use the same tool with an agent — see Usage with Agent below, or pass env vars and options from the sections above.

Usage with Agent

from praisonaiagents import Agent
from praisonai_tools import QdrantTool

qdrant = QdrantTool(url="http://localhost:6333")

agent = Agent(
    name="SearchAgent",
    instructions="You perform semantic search using Qdrant.",
    tools=[qdrant]
)

response = agent.chat("Find similar products to item 123")
print(response)

Available Methods

search(collection, query_vector, limit=10)

Search for similar vectors.
from praisonai_tools import QdrantTool

qdrant = QdrantTool(url="http://localhost:6333")
results = qdrant.search("documents", query_vector=[0.1, 0.2, 0.3], limit=5)

upsert(collection, points)

Insert or update points.
qdrant.upsert("documents", [
    {"id": 1, "vector": [0.1, 0.2, 0.3], "payload": {"text": "Hello"}}
])

create_collection(name, vector_size)

Create a new collection.
qdrant.create_collection("my_collection", vector_size=384)

Docker Setup

docker run -d --name qdrant \
    -p 6333:6333 \
    qdrant/qdrant

Common Errors

ErrorCauseSolution
qdrant-client not installedMissing dependencyRun pip install qdrant-client
Connection refusedQdrant not runningStart Qdrant server
Collection not foundCollection doesn’t existCreate collection first

Best Practices

For Qdrant Cloud, set QDRANT_API_KEY in your shell or .env. Local instances need only QDRANT_URL.
create_collection(name, vector_size) must match your embedding model’s dimension. A mismatch causes search errors, so keep the size aligned with the encoder the agent uses.
search(collection, query_vector, limit=10) defaults to 10. Return only as many matches as the agent needs to keep context small.

Pinecone

Managed vector DB

Chroma

Open-source vector DB

Weaviate

Vector search engine