DSPy-Qdrant
Qdrant powered custom retriever module for DSPy.
Installation
pip install dspy-qdrant
Usage
from dspy_qdrant import QdrantRM
The QdrantRM class enables semantic search by retrieving the top-k most relevant documents from a Qdrant collection using a sentence embedding model.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
qdrant_collection_name |
str |
Name of the Qdrant collection used for retrieval. | Required |
qdrant_client |
QdrantClient |
An initialized instance of qdrant_client.QdrantClient. |
Required |
k |
int |
Number of top documents to retrieve per query. | 3 |
document_field |
str |
Field in the Qdrant payload that contains the raw document content. | "document" |
vectorizer |
BaseSentenceVectorizer |
Embedding model for vectorizing queries. Uses FastEmbedVectorizer if not provided. |
None |
vector_name |
str |
Name of the vector field in Qdrant collection to use for search. Defaults to the first found. | None |
Use in a Module's forward() Function
import dspy
from qdrant_client import QdrantClient
from dspy_qdrant import QdrantRM
qdrant_client = QdrantClient()
class MyModule(dspy.Module):
def __init__(self, num_passages: int = 5):
super().__init__()
self.num_passages = num_passages
def forward(self, question: str):
retrieve = QdrantRM(
qdrant_collection_name="my_collection_name",
qdrant_client=qdrant_client,
k=self.num_passages
)
# Do something with results...
📚 See Also
Metadata
Release files for dspy-qdrant 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dspy_qdrant-0.1.4.tar.gz | 120.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dspy_qdrant-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 133.5 kB
Release files / dspy_qdrant-0.1.4.tar.gz
| Download URL | dspy_qdrant-0.1.4.tar.gz |
|---|---|
| Size | 120.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
677b12a62fe2bfe1a52e712d71d596134fbd2d93d39c7fa3ae9b5fd96067ded8
|
|
BLAKE2b-256 checksum How to use checksums |
bd15404edb2da7922c811e7e2d5ad88840390222faad2e732681c98bbcd57eda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.20
|
Release files / dspy_qdrant-0.1.4-py3-none-any.whl
| Download URL | dspy_qdrant-0.1.4-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
929d43ee041ded1263d86d003e55c8ec24f4be15e60090319246422561b02bad
|
|
BLAKE2b-256 checksum How to use checksums |
c645d1fa3fda2a048ecd15661b3662c17ee0d431186a4504bbb0a8ce10ef484a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.20
|
Security for dspy-qdrant 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.