CreateWithAIHub

Library Stanford NLP

DSPy

Stanford NLP framework for programming language-model pipelines in Python and optimizing their prompts and weights.

Visit website ↗
Save

What it is

DSPy (Declarative Self-improving Python) is a framework for building modular AI systems by writing Python code instead of hand-tuned prompts. You declare tasks as typed signatures, choose modules such as Predict, ChainOfThought or ReAct to run them, and use optimizers like GEPA or MIPROv2 to improve prompts and weights against examples and a metric. It is aimed at developers and researchers building classifiers, RAG pipelines and agent loops.

What it's useful for

Replacing brittle prompt strings with testable modules, or automatically optimizing a multi-step LLM pipeline against a labelled dataset.

Key features

  • Signatures: typed inputs and outputs instead of prompts
  • Modules such as dspy.Predict, dspy.ChainOfThought and dspy.ReAct
  • Optimizers such as GEPA and MIPROv2
  • Works for classifiers, RAG pipelines and agent loops
  • Provider/model string configuration via dspy.LM

How to use it

pip
pip install dspy

Commands are copied from the official documentation. Check the docs for the latest version before running them.

Limitations to know

  • Recent releases changed the LM integration; a migration guide covers breaking changes

Alternatives

Open-source framework for building LLM agents and apps with a standard interface across model providers.

FreeOpen source

Open-source Python framework for building LLM agents, event-driven workflows and RAG over your own data.

FreeOpen source

deepset's open-source Python framework for building RAG pipelines and agent workflows with explicit control over context.

FreeOpen source

MCP servers for this

MCP reference server that gives an AI client controlled read/write access to chosen local directories.

FreeOpen source

Open-source MCP server that gives coding agents simplified Figma layout and styling data to implement designs.

Free plan + paidOpen source

AWS Labs' collection of open-source MCP servers for AWS docs, the AWS API, infrastructure as code, databases, costs and more.

FreeOpen source

Skills for this

Hugging Face's Agent Skills for the Hub CLI, datasets, model training, evaluation, Spaces and SageMaker deployment.

FreeOpen source

Related resources

Anthropic's family of proprietary large language models (Opus, Sonnet, Haiku tiers) for reasoning, coding and agents.

Paid

Open-source Postgres extension that adds a vector type plus exact and approximate nearest-neighbor search.

FreeOpen source

Arize's source-available, self-hosted AI observability tool for OpenTelemetry tracing, evals, datasets and prompts.

Free

Open-source Python library for building AI agents that browse and act on websites, with an optional hosted cloud.

FreeOpen source

Type to search. Use ↑ ↓ and Enter.