Term
DSPy
DSPy is an open-source Python framework from the Stanford NLP group that lets you program LLM applications instead of hand-crafting prompts. Tasks are described through declarative signatures and modules; optimizers automatically derive effective prompts and examples.
DSPy — explained in detail
DSPy (for “Declarative Self-improving Python”) is an open-source framework from the Stanford NLP group that restructures how LLM applications are built. Instead of formulating and refining prompts by hand, with DSPy you programmatically describe what a language model should do and leave it to the framework to determine how the concrete prompt should look.
The framework rests on three abstractions. Signatures are declarative contracts between program and model: they define input fields, output fields and a concise task description. Modules encapsulate proven techniques (such as chain-of-thought) and can be composed into arbitrary pipelines — comparable to layers in a neural network. Optimizers (also called teleprompters) improve such a pipeline automatically by synthesising effective prompt wordings, generating few-shot examples or even fine-tuning model weights.
The underlying idea is an analogy to PyTorch: just as declarative layers and optimizers structure the training of neural networks there, DSPy provides minimalistic, general-purpose modules and handles the optimisation of the prompts. The goal is to replace brittle prompt-engineering tricks with composable, automatically optimisable building blocks. Through its LiteLLM integration, DSPy supports numerous models, from cloud providers to local models.
Example / Practical use
For a question-answering application, a developer defines a signature such as “question -> answer”, chooses a module for multi-step reasoning and provides a few example data points with the desired results. A DSPy optimizer then tries out different prompt variants and example selections and keeps those that perform best on the examples. The developer never has to write the final prompt text themselves.
Distinction from related terms
DSPy differs from classic prompt engineering, where prompts are formulated and tested manually — DSPy automates exactly this step and replaces, for instance, the manual assembly of few-shot examples. Compared with frameworks such as LangChain and LangGraph, which primarily orchestrate the chaining of calls and tools, DSPy focuses on automatically optimising the prompts themselves. It also differs from static prompt templates, which fill fixed placeholders, whereas DSPy actively improves the prompt content.
Entdecke mehr
Saving Tokens with Claude: 6 Principles That Make Experts Twice as Fast
How I turned my CLAUDE.md from a style guide into a token budget — 6 principles for lower cost, less waiting, and more honest reporting.
GlossarFlowise
Flowise is an open-source low-code tool for building LLM applications and AI agents visually via drag-and-drop. It is built on the LangChain ecosystem and connects models, data sources and tools as nodes.
LexikonPipeline Frameworks — LangChain, LlamaIndex and when you actually need them
LangChain, LlamaIndex, LangGraph and Haystack compared. What they're built for, when rolling your own pays off — and the criticisms worth taking seriously.