Skip to main content
QUICK REVIEW

[Paper Review] RestGPT: Connecting Large Language Models with Real-World RESTful APIs

Yifan Song, Weimin Xiong|arXiv (Cornell University)|Jun 11, 2023
Topic ModelingComputer Science14 citations
TL;DR

RestGPT integrates LLMs with real-world RESTful APIs using a coarse-to-fine online planning loop and an API executor, demonstrated on RestBench with real scenarios.

ABSTRACT

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/.

Motivation & Objective

  • Motivate connecting LLMs with real-world RESTful APIs to handle complex user instructions.
  • Develop a coarse-to-fine online planning framework for task decomposition and API selection.
  • Design an API executor that can formulate parameters and parse API responses using OpenAPI (OAS) schemas.
  • Create RestBench, a human-annotated benchmark with real-world scenarios to evaluate RESTful API usage by LLMs.

Proposed method

  • Three modules form the core: Planner, API Selector, and Executor, each driven by prompting an LLM.
  • Employ an iterative coarse-to-fine online planning loop that alternates between NL sub-task planning and API selection.
  • API execution uses a Caller to generate correct parameters from API docs and a Response Parser that uses OAS schemas to generate parsing code.
  • Use OAS/OpenAPI specification parts read by specialized prompts to manage API understanding and response parsing within limited context.
  • During execution, generate Python code from response schemas to parse JSON results, with a fallback prompt if parsing fails.
Figure 1: Overview of RestGPT. The planner, API selector, executor collaborate to form the coarse-to-fine online planning framework. The caller and response parser in the executor provides robust execution of the RESTful API calling plan.
Figure 1: Overview of RestGPT. The planner, API selector, executor collaborate to form the coarse-to-fine online planning framework. The caller and response parser in the executor provides robust execution of the RESTful API calling plan.

Experimental results

Research questions

  • RQ1Can RestGPT solve complex user instructions by composing multiple RESTful API calls?
  • RQ2Does the coarse-to-fine online planning approach improve API understanding, planning, and execution compared to baselines?
  • RQ3How robust is RestGPT to real-world API variability and noise when using many RESTful endpoints?
  • RQ4How do different base LLMs affect RestGPT’s planning, API selection, and parsing capabilities?

Key findings

  • RestGPT outperforms baselines on two RestBench real-world scenarios (TMDB and Spotify).
  • On TMDB, RestGPT achieves a 75.0% success rate and 79.0% correct path rate with a Δ of +0.55 in solution length.
  • On Spotify, RestGPT achieves a 72.7% success rate and 74.5% correct path rate with a Δ of +0.25 in solution length.
  • Ablations show the planner and schema-based parser both contribute to performance, with planning being particularly crucial.
  • RestGPT maintains strong performance as task complexity grows and as the number of APIs increases, demonstrating extensibility.
Figure 2: Example output of the caller.
Figure 2: Example output of the caller.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.