[论文解读] RestGPT: Connecting Large Language Models with Real-World RESTful APIs
RestGPT 将 LLM 与现实世界的 RESTful API 整合,使用粗到细的在线规划循环和一个 API 执行器,在 RestBench 的真实场景中得到验证。
Tool-augmented large language models (LLMs) have achieved remarkable progress in tackling a broad range of tasks. However, existing methods are mainly restricted to specifically designed tools and fail to fulfill complex instructions, having great limitations when confronted with real-world scenarios. In this paper, we explore a more realistic scenario by connecting LLMs with RESTful APIs, which adhere to the widely adopted REST software architectural style for web service development. To address the practical challenges of tackling complex instructions, we propose RestGPT, which exploits the power of LLMs and conducts a coarse-to-fine online planning mechanism to enhance the abilities of task decomposition and API selection. RestGPT also contains an API executor tailored for calling RESTful APIs, which can meticulously formulate parameters and parse API responses. To fully evaluate the performance of RestGPT, we propose RestBench, a high-quality benchmark which consists of two real-world scenarios and human-annotated instructions with gold solution paths. Experiments show that RestGPT is able to achieve impressive results in complex tasks and has strong robustness, which paves a new way towards AGI. RestGPT and RestBench is publicly available at https://restgpt.github.io/.
研究动机与目标
- 促进将 LLM 与现实世界的 RESTful API 连接,以处理复杂的用户指令。
- 开发一个粗到细的在线规划框架,用于任务分解和 API 选择。
- 设计一个 API 执行器,能够使用 OpenAPI (OAS) 规范来生成参数并解析 API 响应。
- 创建 RestBench,一个带有现实场景的人类注释基准,用于评估 LLM 对 RESTful API 的使用。
提出的方法
- 核心由三个模块组成:Planner、API Selector 和 Executor,每个模块都由对 LLM 的提示驱动。
- 采用迭代的粗到细在线规划循环,在 NL 子任务规划和 API 选择之间交替。
- API 执行使用 Caller 从 API 文档中生成正确的参数,使用 Response Parser 借助 OAS 规范来生成解析代码。
- 使用由专用提示读取的 OAS/OpenAPI 规范部分,在有限上下文中管理对 API 的理解和响应解析。
- 执行期间,根据响应模式生成 Python 代码以解析 JSON 结果,如果解析失败则使用回退提示。

实验结果
研究问题
- RQ1RestGPT 是否能通过组合多个 RESTful API 调用来解决复杂的用户指令?
- RQ2与基线方法相比,粗到细的在线规划方法是否提升了对 API 的理解、规划和执行?
- RQ3在使用大量 RESTful 端点时,RestGPT 对现实世界 API 的变异性和噪声有多鲁棒?
- RQ4不同的基础 LLM 如何影响 RestGPT 的规划、API 选择和解析能力?
主要发现
- RestGPT 在两个 RestBench 的现实世界场景(TMDB 和 Spotify)上优于基线方法。
- 在 TMDB 上,RestGPT 实现 75.0% 的成功率和 79.0% 的正确路径率,解答长度的 Δ 为 +0.55。
- 在 Spotify 上,RestGPT 实现 72.7% 的成功率和 74.5% 的正确路径率,解答长度的 Δ 为 +0.25。
- 消融实验显示规划器和基于模式的解析器都对性能有贡献,其中规划尤为关键。
- 随着任务复杂度增加和 API 数量增加,RestGPT 仍保持强劲表现,展示了可扩展性。

更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。