文档: DSPy 文档
DSPy 是一个用于编程(而非提示)语言模型的框架。它允许你快速迭代构建模块化 AI 系统,并提供优化其提示和权重的算法,无论你是构建简单的分类器、复杂的 RAG 管道还是智能体循环。
DSPy 代表声明式自改进 Python。你无需编写脆弱的提示词,而是编写组合式的 Python 代码,并使用 DSPy 来教导你的语言模型输出高质量的结果。你可以通过我们的官方文档网站了解更多信息,或通过此 GitHub 仓库和我们的 Discord 服务器与社区交流、寻求帮助或开始贡献。
请访问 DSPy 文档 dspy.ai
pip install dspy
要从 main 分支安装最新版本:
pip install git+https://github.com/stanfordnlp/dspy.git
如果你想了解该框架,请访问 DSPy 文档 dspy.ai。
如果你想了解底层研究,以下是我们的一系列论文:
[2025年7月] GEPA: 反思式提示进化可以超越强化学习
[2024年6月] 优化多阶段语言模型程序的指令和示例
[2023年10月] DSPy: 将声明式语言模型调用编译为自改进管道
[2024年7月] 微调与提示优化:两个相辅相成的绝佳步骤
[2024年6月] 提示作为自动优化的训练超参数
[2024年2月] 使用大语言模型辅助从零开始撰写维基百科式文章
[2024年1月] 用于极端多标签分类的上下文学习
[2023年12月] DSPy 断言:自改进语言模型管道的计算约束
[2022年12月] Demonstrate-Search-Predict: 组合检索与语言模型用于知识密集型 NLP
要获取最新信息或了解更多,请在 Twitter 上关注 @DSPyOSS 或在 LinkedIn 上关注 DSPy 页面。
DSPy 徽标由 Chuyi Zhang 设计。
如果你在研究中使用了 DSPy 或 DSP,请按以下方式引用我们的工作:
@inproceedings{khattab2024dspy,
title={DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines},
author={Khattab, Omar and Singhvi, Arnav and Maheshwari, Paridhi and Zhang, Zhiyuan and Santhanam, Keshav and Vardhamanan, Sri and Haq, Saiful and Sharma, Ashutosh and Joshi, Thomas T. and Moazam, Hanna and Miller, Heather and Zaharia, Matei and Potts, Christopher},
journal={The Twelfth International Conference on Learning Representations},
year={2024}
}
@article{khattab2022demonstrate,
title={Demonstrate-Search-Predict: Composing Retrieval and Language Models for Knowledge-Intensive {NLP}},
author={Khattab, Omar and Santhanam, Keshav and Li, Xiang Lisa and Hall, David and Liang, Percy and Potts, Christopher and Zaharia, Matei},
journal={arXiv preprint arXiv:2212.14024},
year={2022}
}