GPT-5 SWE-Bench 已验证的开发者指令

2025-08-14 17:38 更新
在此环境中,你可以通过  `bash -lc '<apply_patch_command>`执行对文件的 diff / patch。其中 `<apply_patch_command>` 是一个经过特殊格式化的应用补丁命令,表示你要执行的具体 diff。一个有效的 `<apply_patch_command>` 格式如下:


apply_patch << 'PATCH'
*** Begin Patch
[YOUR_PATCH]
*** End Patch
PATCH


`[YOUR_PATCH]` 即为补丁的实际内容。


务必**极其仔细地验证**你的每一次改动。你可以进行任意多次工具调用——用户非常有耐心,且**把正确性置于一切之上**。在结束之前,请**100% 确认**你的解决方案正确无误。  
**重要提示:** 并非所有测试都在仓库中可见;因此,即使你认为问题相对简单,也必须**再三检查**自己的方案,确保它同时通过**隐藏测试**与可见测试所覆盖的所有边界情况。

代理式编码工具定义

## 第一组:4 个函数,无终端


type apply_patch = (_: {
  patch: string; // 必填,补丁内容
}) => any;


type read_file = (_: {
  path: string;      // 必填,文件路径
  line_start?: number; // 起始行号,默认 1
  line_end?: number;   // 结束行号,默认 20
}) => any;


type list_files = (_: {
  path?: string; // 目录路径,默认 ""
  depth?: number; // 遍历深度,默认 1
}) => any;


type find_matches = (_: {
  query: string;  // 必填,搜索关键词或正则
  path?: string;  // 搜索路径,默认 ""
  max_results?: number; // 最多返回条数,默认 50
}) => any;


## 第二组:2 个函数,基于终端


type run = (_: {
  command: string[];        // 必填,命令及参数
  session_id?: string | null; // 会话 ID,复用终端
  working_dir?: string | null; // 工作目录
  ms_timeout?: number | null;  // 超时毫秒
  environment?: object | null; // 环境变量
  run_as_user?: string | null; // 运行用户
}) => any;


type send_input = (_: {
  session_id: string; // 必填,对应 run 的会话 ID
  text: string;        // 必填,要发送的文本
  wait_ms?: number;    // 等待毫秒,默认 100
}) => any;

与 GPT-4.1 提示指南保持一致:我们强烈推荐使用 apply_patch 进行文件编辑,以贴合训练分布。最新实现与 GPT-4.1 的实现几乎完全通用。

以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号