DSPy — AI Glossary

DSPy is a programming framework, originally from Stanford, that treats prompts as functions with typed signatures rather than strings. You declare input and output types for a task — for example, "question -> answer" or "context, question -> rationale, answer" — and DSPy compiles optimized prompts, including few-shot examples selected from training data and optional rationales.