dspy
Installation
SKILL.md
DSPy — Skill Router
Program — don't prompt — foundation models. DSPy lets you define LLM pipelines as typed Python modules with declarative
Signatures, then compile (optimize) them against a metric using optimizers likeBootstrapFewShotandMIPROv2.
Source: dspy.ai | Python: v2.5.x | License: MIT | GitHub: stanfordnlp/dspy
Reference Files
| Reference | File | Read When |
|---|---|---|
| Overview & Quickstart | references/00-overview.md |
First install, core concepts, dspy.configure, the compile loop |
| Signatures | references/01-signatures.md |
Inline "q -> a" strings, class-based signatures, InputField/OutputField, typed fields |
| Modules (Predict, CoT, ReAct, PoT) | references/02-modules.md |
dspy.Predict, ChainOfThought, ReAct, ProgramOfThought, composing dspy.Module |
| LM Configuration | references/03-lm-configuration.md |
dspy.LM, providers (OpenAI, Anthropic, Ollama, vLLM), caching, temperature, context settings |
| Optimizers (Compilers) | references/04-optimizers.md |
BootstrapFewShot, BootstrapFewShotWithRandomSearch, MIPROv2, COPRO, BootstrapFinetune |
| Metrics & Evaluation | references/05-metrics-evaluation.md |
Writing metric functions, dspy.Evaluate, answer-exact-match, LLM-as-judge metrics |
| Retrieval & RAG | references/06-rag-retrieval.md |
dspy.Retrieve, ColBERTv2, Qdrant/Chroma/Weaviate integrations, multi-hop RAG patterns |
| Assertions & Suggestions | references/07-assertions.md |
dspy.Assert, dspy.Suggest, self-refinement loops, constraint-driven retries |
| Deployment & Production | references/08-deployment.md |
Saving/loading compiled programs, streaming, async, FastAPI serving, observability |