Note: For a complete Jupyter notebook walkthrough, see the DSPy cookbook.
Why use Moss with DSPy?
DSPy’s retrieval modules connect external knowledge sources to composable LLM programs. Moss delivers sub-10ms semantic search through a standardRetrieve interface, giving your DSPy pipelines fast, accurate retrieval without managing vector database infrastructure.
Required tools
Integration guide
Use as a configured retriever
The cookbook provides a
MossRM class that extends dspy.Retrieve. Register it as DSPy’s default retriever, then use dspy.Retrieve throughout your programs.Configuration
MossRM
| Parameter | Type | Default | Description |
|---|---|---|---|
index_name | str | Required | The name of the Moss index to query. |
moss_client | MossClient | Required | An initialized Moss client instance. |
k | int | 3 | Default number of passages to retrieve. |
alpha | float | 0.5 | Hybrid search weighting. 0.0 = keyword only, 1.0 = semantic only. |