Skip to main content

Qdrant powered retriever for DSPy

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dspy_qdrant-0.1.3.tar.gz (108.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dspy_qdrant-0.1.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file dspy_qdrant-0.1.3.tar.gz.

File metadata

  • Download URL: dspy_qdrant-0.1.3.tar.gz
  • Upload date:
  • Size: 108.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for dspy_qdrant-0.1.3.tar.gz
Algorithm Hash digest
SHA256 515e71f05d206b37be207815946b60e35675d3bc4cac2139e7cf788f146ffa34
MD5 a623c2b343c1c4bda35689dbe7225f15
BLAKE2b-256 375b8fa9b011ed5547111e3102f32814d472e2f18f59cf91decea35fc2d0485b

See more details on using hashes here.

File details

Details for the file dspy_qdrant-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for dspy_qdrant-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 84727736b1fdb313b7e88ade0b9c0d40c76b48a92681c0056926f2ef60e2b5e2
MD5 ef84e55a97af7a178de707a601658c0a
BLAKE2b-256 f58f1c3dd3ff02261a72d38c501f47b1d93abdfe1438a3ecc4c6c236795e336f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page