dspy
View on GitHubDSPy: The framework for programming—not prompting—language models
DSPy is a Python framework for programming rather than prompting LLMs: you write declarative modules and signatures, then compilers/optimizers (e.g. GEPA, MIPRO) tune prompts and weights against your metric. Useful for building and optimizing RAG pipelines, classifiers, and agent loops.
Use Cases
Build modular LLM pipelines with declarative PythonAuto-optimize prompts and few-shot demosBuild RAG pipelines with retrieval modulesBuild agent loops with tool useTrain/compile LM programs against metricsMulti-stage NLP systemsClassification and extraction tasksFine-tune plus prompt-optimize combosSelf-refining pipelines with assertionsEvaluate and benchmark LM programs
Built With
- Language
- Python
- Frameworks
- DSPy · LiteLLM · Pydantic · OpenAI SDK · Anthropic SDK · LangChain Core · MCP · Optuna · Weaviate · NumPy · GEPA
Tags
dspy · prompt-optimization · llm-programming · declarative · pipelines · compiler · teleprompters · few-shot · self-improving · gepa · signatures · modules · evaluation · python