Files
landing_page/qdrant-landing/content/documentation/headless/snippets/query-points/hybrid-rrf/python.py
T
Dylan CouzonandClaude Opus 4.7 fc299a0e9c Switch hybrid-rrf snippets to RrfQuery API
Replaces the older `FusionQuery(fusion=Fusion.RRF)` enum form with
`RrfQuery(rrf=Rrf())` across all language tabs (Python, TypeScript,
Rust, Go, Java, C#) plus the REST body in `http.md`, for both the
`hybrid-rrf/` snippet and the inner RRF prefetch inside
`hybrid-formula-decay/`. The newer dedicated `Rrf` message is the
recommended path going forward; the old enum stays supported for
backward compatibility. Server-side both forms converge to the same
`FusionInternal::Rrf { k: 2, weights: None }`, verified against the
qdrant/qdrant source.

`generated/*.md` files in both directories regenerated via
`./docker.sh ./generate-md.py`. `./docker.sh ./check.py build` passes
across all six SDKs.

Also softens the DBSF prose in hybrid-queries.md to drop the
"weighted RRF tends to win" framing. Neither method dominates the
other in general.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 21:04:09 -04:00

21 lines
536 B
Python

from qdrant_client import QdrantClient, models
client = QdrantClient(url="http://localhost:6333")
client.query_points(
collection_name="{collection_name}",
prefetch=[
models.Prefetch(
query=models.SparseVector(indices=[1, 42], values=[0.22, 0.8]),
using="sparse",
limit=20,
),
models.Prefetch(
query=[0.01, 0.45, 0.67], # <-- dense vector
using="dense",
limit=20,
),
],
query=models.RrfQuery(rrf=models.Rrf()),
)