Files
wehub-resource-sync bcbd1bdb22
Integ / changes (push) Has been skipped
Pre-commit / pre-commit (push) Failing after 1s
CLI exit codes / changes (push) Has been skipped
Test (Install) / changes (push) Has been skipped
Test (Python) / changes (push) Has been skipped
Test (TypeScript) / changes (push) Has been skipped
CLI exit codes / cli-gate (push) Has been cancelled
Test (Install) / test-install-gate (push) Has been cancelled
Integ / integ-gate (push) Has been cancelled
Test (Python) / test-python-gate (push) Has been cancelled
Test (TypeScript) / test-typescript-gate (push) Has been cancelled
Test (Install) / python-minimal (3.12) (push) Has been cancelled
Test (Install) / python-minimal (3.11) (push) Has been cancelled
Test (Install) / python-extra (agno, mirage.agents.agno) (push) Has been cancelled
Test (Install) / python-extra (chroma, mirage.resource.chroma) (push) Has been cancelled
Test (Install) / python-extra (pdf, mirage.core.filetype.pdf) (push) Has been cancelled
Integ / integ (push) Has been cancelled
Integ / integ-database (push) Has been cancelled
Integ / integ-database-ts (push) Has been cancelled
Integ / integ-data (push) Has been cancelled
Integ / integ-ssh (push) Has been cancelled
Integ / integ-ssh-ts (push) Has been cancelled
Test (Python) / audit (push) Has been cancelled
Test (TypeScript) / test (push) Has been cancelled
Test (TypeScript) / python-fs-shim (push) Has been cancelled
CLI exit codes / Python CLI (push) Has been cancelled
CLI exit codes / TypeScript CLI (push) Has been cancelled
CLI exit codes / Cross-language snapshot interop (push) Has been cancelled
Test (Python) / test (push) Has been cancelled
Test (Python) / import-isolation (deepagents, openai, mirage.agents.openai_agents) (push) Has been cancelled
Test (Python) / import-isolation (deepagents, pydantic-ai, mirage.agents.pydantic_ai) (push) Has been cancelled
Integ / integ-ts (push) Has been cancelled
Integ / integ-fuse (push) Has been cancelled
Test (Install) / python-extra (databricks, mirage.resource.databricks_volume) (push) Has been cancelled
Test (Install) / python-extra (deepagents, mirage.agents.langchain) (push) Has been cancelled
Test (Install) / python-extra (email, mirage.resource.email) (push) Has been cancelled
Test (Install) / python-extra (fuse, mirage.fuse.mount) (push) Has been cancelled
Test (Install) / python-extra (hdf5, mirage.core.filetype.hdf5) (push) Has been cancelled
Test (Install) / python-extra (hf, mirage.resource.hf_buckets) (push) Has been cancelled
Test (Install) / python-extra (lancedb, mirage.resource.lancedb) (push) Has been cancelled
Test (Install) / python-extra (langfuse, mirage.resource.langfuse) (push) Has been cancelled
Test (Install) / python-extra (mongodb, mirage.resource.mongodb) (push) Has been cancelled
Test (Install) / python-extra (nextcloud, mirage.resource.nextcloud) (push) Has been cancelled
Test (Install) / python-extra (openai, mirage.agents.openai_agents) (push) Has been cancelled
Test (Install) / python-extra (openhands, mirage.agents.openhands, 3.12) (push) Has been cancelled
Test (Install) / python-extra (parquet, mirage.core.filetype.parquet) (push) Has been cancelled
Test (Install) / python-extra (postgres, mirage.resource.postgres) (push) Has been cancelled
Test (Install) / python-extra (pydantic-ai, mirage.agents.pydantic_ai) (push) Has been cancelled
Test (Install) / python-extra (qdrant, mirage.resource.qdrant) (push) Has been cancelled
Test (Install) / python-extra (redis, mirage.resource.redis) (push) Has been cancelled
Test (Install) / python-extra (s3, mirage.resource.s3) (push) Has been cancelled
Test (Install) / python-extra (ssh, mirage.resource.ssh) (push) Has been cancelled
Test (Install) / ts-minimal (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:30:44 +08:00

113 lines
5.2 KiB
Plaintext

---
title: Qdrant
icon: database
description: Set up the Qdrant resource in Python, including self-hosted Qdrant and Qdrant Cloud, with local or server-side semantic search.
---
The Qdrant resource mounts a [Qdrant](https://qdrant.tech/) collection as a filesystem: group-by payload
fields become folders, points become files, and semantic search is the `search`
command. See [Qdrant Resource](/python/resource/qdrant) for the full layout and
command list.
## Dependencies
```bash
uv add 'mirage-ai[qdrant]'
```
The `qdrant` extra installs `qdrant-client[fastembed]`. `fastembed` powers
local, in-process query embedding for the `search` command; filesystem browsing
(`ls`/`cat`/`find`/`grep`) needs only the base client.
## Connection
The same `QdrantConfig` works for self-hosted and cloud.
### Self-hosted
```python
from mirage import MountMode, Workspace
from mirage.resource.qdrant import QdrantConfig, QdrantResource
config = QdrantConfig(
host="localhost",
port=6333,
collection="fashion",
group_by=["gender", "articleType", "baseColour"],
id_field="id",
text_field="productDisplayName",
blob_field="image_b64",
blob_ext="jpg",
)
ws = Workspace({"/fashion/": QdrantResource(config)}, mode=MountMode.READ)
```
### Qdrant Cloud
Use `url` plus an `api_key`:
```python
import os
config = QdrantConfig(
url="https://xyz.cloud.qdrant.io",
api_key=os.environ["QDRANT_API_KEY"],
collection="fashion",
group_by=["gender", "articleType", "baseColour"],
id_field="id",
)
ws = Workspace({"/fashion/": QdrantResource(config)}, mode=MountMode.READ)
```
## Search setup
The `search` command embeds the query and runs Qdrant vector search. The
collection must already store vectors produced by the same model
(`embedding_model`, default `sentence-transformers/all-MiniLM-L6-v2`). Query
embedding happens one of two ways:
- **Local (default):** `fastembed` embeds the query in process.
- **Server-side:** set `cloud_inference=True` to have an inference-enabled
Qdrant Cloud cluster embed the query. The query text is sent to the server
instead of being embedded locally.
```python
config = QdrantConfig(
url="https://xyz.cloud.qdrant.io",
api_key=os.environ["QDRANT_API_KEY"],
collection="fashion",
group_by=["gender"],
cloud_inference=True,
embedding_model="sentence-transformers/all-MiniLM-L6-v2",
)
```
```bash
search "red running shoes" /fashion # ranked <path>.txt:score + content
cat /fashion/Men/Shoes/White/3.txt # follow a result to the real file
```
## Config reference
| Field | Required | Default | Description |
| ------------------ | -------- | ------------------------------------------- | ------------------------------------------------------------ |
| `url` | No | | Qdrant URL (Cloud or self-hosted); overrides `host`/`port` |
| `host` | No | `localhost` | Host when `url` is unset |
| `port` | No | `6333` | Port when `url` is unset |
| `https` | No | `false` | Use TLS for `host`/`port` connections |
| `api_key` | No | | Qdrant Cloud API key |
| `collection` | No | | Pin one collection; the mount root becomes that collection |
| `group_by` | No | `[]` | Payload fields that become nested folder levels |
| `id_field` | No | `id` | Field name shown for the point id; names point files |
| `text_field` | No | | Payload field served as the `<id>.txt` embedded source text |
| `blob_field` | No | | Payload field served as the raw blob/image file |
| `blob_ext` | No | `bin` | Extension for the blob file (`jpg`, `png`, ...) |
| `vector_field` | No | | Payload field holding a vector, omitted from `<id>.json` |
| `search_limit` | No | `10` | Default top-k returned by `search` |
| `max_rows` | No | `1000` | Cap on points scanned per folder listing |
| `embedding_model` | No | `sentence-transformers/all-MiniLM-L6-v2` | Model used to embed the query |
| `cloud_inference` | No | `false` | Embed the query server-side instead of with local fastembed |
The mount is read-only. See [Qdrant Resource](/python/resource/qdrant) for the
filesystem layout and supported commands.