Qdrant Vector Database Add-on

High-performance vector database designed for AI applications, providing both REST and gRPC APIs for vector search and storage.

Features

Use Cases

Build search systems that understand context and meaning rather than just keywords.

2. Recommendation Systems

Create personalized recommendations based on user preferences and behavior patterns.

3. RAG Applications

Retrieval-Augmented Generation for enhancing LLM responses with relevant context.

Find similar images based on visual features using image embeddings.

5. Anomaly Detection

Identify outliers in your data by finding vectors that are dissimilar to the norm.

Installation

  1. Add the J0rsa repository to your Home Assistant
  2. Search for β€œQdrant” in the Add-on Store
  3. Click Install and wait for the download to complete
  4. Configure the add-on (see Configuration below)
  5. Start the add-on

Configuration

# Example configuration
web_ui_enabled: true           # Enable web dashboard
api_key: ""                    # Optional API key for authentication
read_only_api_key: ""          # Optional read-only API key
read_only: false               # Enable read-only mode
log_level: "INFO"              # Logging level
max_request_size_mb: 32        # Maximum request size in MB

Configuration Options

Option Description Default Required
web_ui_enabled Enable the web dashboard interface true No
api_key API key for full access (leave empty for no auth) "" No
read_only_api_key API key for read-only access "" No
read_only Enable read-only mode (prevents modifications) false No
log_level Logging verbosity (TRACE/DEBUG/INFO/WARN/ERROR) INFO No
max_request_size_mb Maximum request size in megabytes (1-1024) 32 No

Usage

Accessing the Services

After starting the add-on, you can access:

API Examples

Create a Collection

Collections are the primary way to organize vectors in Qdrant:

curl -X PUT 'http://homeassistant.local:6333/collections/my_collection' \
  -H 'Content-Type: application/json' \
  -H 'api-key: your-api-key' \
  -d '{
    "vectors": {
      "size": 384,
      "distance": "Cosine"
    }
  }'

Distance metrics available:

Insert Vectors

Add vectors with associated metadata:

curl -X PUT 'http://homeassistant.local:6333/collections/my_collection/points' \
  -H 'Content-Type: application/json' \
  -H 'api-key: your-api-key' \
  -d '{
    "points": [
      {
        "id": 1,
        "vector": [0.1, 0.2, 0.3, ...],
        "payload": {
          "text": "Example document",
          "category": "tutorial",
          "timestamp": 1700000000
        }
      }
    ]
  }'

Search for Similar Vectors

Find the most similar vectors:

curl -X POST 'http://homeassistant.local:6333/collections/my_collection/points/search' \
  -H 'Content-Type: application/json' \
  -H 'api-key: your-api-key' \
  -d '{
    "vector": [0.1, 0.2, 0.3, ...],
    "limit": 5,
    "filter": {
      "must": [
        {
          "key": "category",
          "match": {
            "value": "tutorial"
          }
        }
      ]
    }
  }'

List Collections

View all collections in your database:

curl -X GET 'http://homeassistant.local:6333/collections' \
  -H 'api-key: your-api-key'

Integration with Home Assistant

REST Sensor Example

Monitor collection statistics:

sensor:
  - platform: rest
    name: "Qdrant Collection Count"
    resource: http://localhost:6333/collections
    method: GET
    headers:
      api-key: "your-api-key"
    value_template: ""
    scan_interval: 300

REST Command Example

Create a service to search vectors:

rest_command:
  search_qdrant:
    url: "http://localhost:6333/collections//points/search"
    method: POST
    headers:
      Content-Type: "application/json"
      api-key: "your-api-key"
    payload: '{"vector": , "limit": }'

Python Integration Example

from qdrant_client import QdrantClient
from qdrant_client.http.models import Distance, VectorParams, PointStruct

# Connect to Qdrant
client = QdrantClient(
    host="homeassistant.local",
    port=6333,
    api_key="your-api-key"
)

# Create collection
client.create_collection(
    collection_name="test_collection",
    vectors_config=VectorParams(size=384, distance=Distance.COSINE),
)

# Insert points
points = [
    PointStruct(
        id=1,
        vector=[0.1] * 384,
        payload={"text": "Hello world"}
    )
]
client.upsert(collection_name="test_collection", points=points)

# Search
search_result = client.search(
    collection_name="test_collection",
    query_vector=[0.1] * 384,
    limit=5
)

Hardware Requirements

Minimum Requirements

Memory Guidelines by Dataset Size

Performance Optimization

1. Index Configuration

2. Batch Operations

3. Filtering

4. Memory Management

Data Persistence

Creating a Snapshot

curl -X POST 'http://homeassistant.local:6333/collections/my_collection/snapshots' \
  -H 'api-key: your-api-key'

Security Best Practices

  1. Always use API keys in production environments
  2. Use read-only keys for query-only applications
  3. Limit network exposure - only expose ports if needed
  4. Regular backups of your vector data
  5. Monitor logs for unauthorized access attempts

Troubleshooting

Add-on Won’t Start

Connection Refused

Slow Performance

Web UI Not Loading

Advanced Features

Quantization

Reduce memory usage with scalar quantization:

{
  "vectors": {
    "size": 384,
    "distance": "Cosine"
  },
  "quantization_config": {
    "scalar": {
      "type": "int8",
      "quantile": 0.99,
      "always_ram": true
    }
  }
}

Payload Indexing

Create indexes for faster filtering:

curl -X PUT 'http://homeassistant.local:6333/collections/my_collection/index' \
  -H 'Content-Type: application/json' \
  -H 'api-key: your-api-key' \
  -d '{
    "field_name": "category",
    "field_schema": "keyword"
  }'

Support


← Back to Add-ons View on GitHub