🧬DSPy
Also known as DSPy Framework, Stanford DSPy
A Python kit. You say what goes in and out, and it writes the prompts.
Think of it like
It is like a cook who tries a dish many ways and keeps the best.
Example
Jack's team declares email in, event name and date out. The optimizer tries prompt wording on 50 labeled emails and keeps the version that scores best.
Why it matters
Hand-written prompts often break when you change models. DSPy keeps the task the same and tunes the wording again for the new model.
Definition
Example code
python
import dspy
dspy.configure(lm=dspy.LM("openai/gpt-5.4-nano"))
extract = dspy.Predict("email -> event_name, date")
result = extract(email="Lunch with Emma on May 3 at noon")Common mistake
Key takeaways
- 1Signatures. Inputs and outputs, not wording.
- 2Modules. How the task is run.
- 3Optimizers. Tune prompts from examples.