Prompts2026年4月8日·1 分钟阅读

DSPy — Programming Foundation Models Declaratively

Replace hand-written prompts with modular programs. DSPy compiles declarative AI pipelines into optimized prompts automatically, boosting reliability and performance.

What is DSPy?

DSPy replaces hand-written prompts with modular programs. Declaratively define AI pipelines that are automatically compiled into optimized prompts. Built by Stanford NLP.

In one sentence: Programmatic LLM framework — declaratively define AI pipelines and auto-compile to optimized prompts. By Stanford NLP — 22k+ stars.

For: AI engineers building reliable LLM pipelines.

Core Concepts

1. Signatures

Declare input/output format.

2. Modules

Composable LLM call units, similar to PyTorch layers.

3. Optimizers

Automatically compile to generate optimal prompts.

FAQ

Q: Does it support Claude? A: Yes — via dspy.LM("anthropic/claude-sonnet-4-20250514").

Q: How is it different from LangChain? A: LangChain chains hand-written prompts; DSPy automatically optimizes prompts through compilation.

🙏

来源与感谢

stanfordnlp/dspy — 22k+ stars, MIT

讨论

登录后参与讨论。
还没有评论,来写第一条吧。