dspy-reasoning-modules
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "dspy-reasoning-modules":https://skillpi.com/zh/skills/deepskill-bd324604380c9197203f44fc94540b82cd91f845a9242bebc854dda3370e721e。安装前核对上游来源和版本:https://github.com/OmidZamani/dspy-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
用于 DSPy 的推理模块集合,包含 RLM、ProgramOfThought、CodeAct、Parallel、沙箱执行与长上下文工作流等推理与执行模式的支持与组织。
介绍来源: third_party · OmidZamani · 1.0.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 适合谁
- 来源文档未说明。
- 输入和输出
- 来源文档未说明。
- 软件、账号及付费要求
- 来源文档未说明。
- 限制与区别
- 来源文档未说明。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: dspy-reasoning-modules
version: "1.0.0"
dspy-compatibility: "3.2.1"
tags: ["reasoning"]
requires-extras: []
description: Use for DSPy reasoning modules including RLM, ProgramOfThought, CodeAct, Parallel, sandboxed execution, and long-context workflows.
allowed-tools:
- Read
- Write
- Glob
- GrepDSPy Reasoning Modules
Goal
Choose the appropriate DSPy reasoning module for long-context exploration, code-assisted reasoning, or parallel execution.
Module Selection
| Module | Use it for | Important constraint |
|---|---|---|
dspy.RLM |
Exploring very large contexts with iterative REPL code and recursive sub-LM calls | Experimental; requires Deno by default |
dspy.ProgramOfThought |
Solving tasks by generating and executing Python | Requires Deno by default |
dspy.CodeAct |
Combining generated Python with predefined tool functions | Functions only; requires Deno |
dspy.Parallel |
Running (module, example) pairs concurrently |
Tune threads and error handling |
RLM for Large Contexts
RLM treats long inputs as external data in a sandbox rather than placing the full context in each LM prompt.
import dspy
dspy.configure(lm=dspy.LM("openai/gpt-4o"))
rlm = dspy.RLM(
"document, question -> answer",
max_iterations=12,
max_llm_calls=30,
sub_lm=dspy.LM("openai/gpt-4o-mini"),
)
result = rlm(
document=very_long_document,
question="What were the main revenue drivers?",
)
print(result.answer)
Use max_iterations, max_llm_calls, and max_output_chars as explicit cost and output bounds.
Sandboxed Execution
The default dspy.PythonInterpreter uses Deno and Pyodide. It denies host filesystem, environment, and network access unless explicitly enabled.
from pathlib import Path
import dspy
with dspy.PythonInterpreter(
enable_read_paths=[Path("./inputs")],
enable_network_access=["api.example.com"],
) as interpreter:
print(interpreter.execute("print('ready')"))
Grant only the minimum paths, environment variables, and network hosts needed by the task.
ProgramOfThought and CodeAct
import dspy
dspy.configure(lm=dspy.LM("openai/gpt-4o-mini"))
math = dspy.ProgramOfThought("question -> answer")
print(math(question="What is the sum of the first 100 integers?").answer)
Use CodeAct when generated code also needs curated host-side tools:
def lookup_rate(currency: str) -> float:
"""Return a trusted exchange rate from the application service."""
return rates[currency]
agent = dspy.CodeAct("amount, currency -> converted", tools=[lookup_rate])
Parallel Execution
parallel = dspy.Parallel(num_threads=8, return_failed_examples=True)
results, failed_examples, exceptions = parallel(
[(program, {"question": question}) for question in questions]
)
Best Practices
- Prefer
PredictorChainOfThoughtuntil code execution or long-context exploration is justified. - Treat
RLMas experimental and load-test before production deployment. - Bound loops and sub-LM calls.
- Keep sandbox permissions narrow.
- Create separate interpreters for concurrent custom-interpreter use.
Official Documentation
- RLM API: https://dspy.ai/api/modules/RLM/
- ProgramOfThought API: https://dspy.ai/api/modules/ProgramOfThought/
- CodeAct API: https://dspy.ai/api/modules/CodeAct/
- Parallel API: https://dspy.ai/api/modules/Parallel/
当前收录版本
1.0.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 DSPy 高级推理模块的完整使用指南
- 包含 RLM、ProgramOfThought、CodeAct、Parallel 四大核心模块
- 面向开发者解决长上下文、代码执行、并行处理等实际痛点
亮点
- description 明确描述技能用途和覆盖模块
- frontmatter 中 description 字段位置正确且内容完整
- 触发词边界清晰,无歧义
亮点
- 结构清晰:模块选择表、各模块示例、最佳实践分层展示
- frontmatter 完整包含版本、兼容性、标签等必要信息
- 提供端到端代码示例和官方文档链接
亮点
- 工具来源明确(DSPy 官方模块)
- 参数约束清晰(max_iterations、sandbox permissions)
- 覆盖异常处理和安全最佳实践
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- dspy.ai
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
来源文档未说明。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。