DSPy
Stanford framework that treats prompts as compilable code — you declare input/output signatures, provide examples, and DSPy optimises the prompt for you.
Instead of hand-tuning prompt strings you define class GenerateAnswer(dspy.Signature) with typed fields. Modules like ChainOfThought and ReAct compose them. A "teleprompter" (BootstrapFewShot, MIPRO, COPRO) searches over few-shot examples and prompt phrasings against a validation set.
The idea: when you swap models (GPT-4 → Claude → Llama) you just recompile, you don't rewrite prompts. Steep learning curve but powerful for non-trivial pipelines.