Modern applications use programmatic pipelines (like DSPy or LangChain) where prompts are compiled dynamically from templates, few-shot examples are fetched based on embedding matches, and model routing is managed in code.
Instead of treating prompts as static text strings, programmatic pipelines treat them as components of an execution pipeline, dynamically compiling prompts based on task inputs.
import dspy
class QA(dspy.Signature): context = dspy.InputField(desc="retrieved documents") question = dspy.InputField() answer = dspy.OutputField(desc="fact-grounded summary")
qa_pipeline = dspy.ChainOfThought(QA) prediction = qa_pipeline(context=doc_list, question="what is X?")
Anthropic pipelines benefit from strict JSON schemas generated programmatically by pipelines to handle tool routing.