Andrii Bidochko
  • February 16, 2024
  • 3 min read

RestGPT: Connecting Large Language Models with Real-World RESTful APIs

RestGPT is an innovative project that aims to construct a large language model-based autonomous agent capable of controlling real-world applications, such as movie databases and music players. Developed by a team of researchers from Peking University and Huawei Technologies, RestGPT connects Language Models (LLMs) with RESTful APIs to overcome the practical challenges of planning, API calling, and response parsing.

RESTful APIs

RESTful APIs have gained popularity as a means of exposing functionalities and data of web services to client applications. With millions of RESTful APIs available on the internet, including popular platforms like Spotify, Twitter, and Gmail, developers have a wide range of options to integrate into their applications. These APIs typically follow the OpenAPI Specification (OAS), which provides a standardized way to describe the operations, parameters, and response schemas of each API endpoint.

The Components of RestGPT

RestGPT consists of three main components: a Planner, an API Selector, and an Executor. The core functionality of each component is powered by prompting a Language Model.

  1. Planner: The Planner component decomposes user instructions into sub-tasks using natural language. These sub-tasks are then mapped to API calls by the API Selector, enabling a coarse-to-fine task planning approach. Unlike previous static planning approaches, RestGPT’s Planner is adaptable to environment feedback, allowing for dynamic adjustments based on the Executor’s response.
  2. API Selector: The API Selector component maps the sub-tasks generated by the Planner to specific API calls. By leveraging the OpenAPI Specification, the API Selector ensures that the API calls are aligned with the defined operations, parameters, and response schemas.
  3. Executor: The Executor component is responsible for executing the RESTful API calls. It is further divided into two modules: the Caller and the Response Parser. The Caller module reads the complete API documentation to organize the API call parameters, while the Response Parser generates Python code that parses the API responses based on the response schema defined in the OpenAPI Specification.

RestBench: A High-Quality Test Set

To fully evaluate the performance of RestGPT, the researchers propose RestBench, a high-quality test set consisting of two real-world scenarios and human-annotated instructions with gold solution paths. RestBench serves as a benchmark for assessing the capabilities and effectiveness of RestGPT in real-world applications.

Conclusion

RestGPT represents a significant advancement in the integration of large language models with real-world RESTful APIs. By connecting LLMs with RESTful APIs and addressing the challenges of planning, API calling, and response parsing, RestGPT opens up new possibilities for AI-powered applications. Developers and tech enthusiasts interested in AI and RESTful APIs can explore the potential of RestGPT to create intelligent and interactive applications.


Andrii Bidochko

CEO/CTO at UBOS

Welcome! I'm the CEO/CTO of UBOS.tech, a low-code/no-code application development platform designed to simplify the process of creating custom Generative AI solutions. With an extensive technical background in AI and software development, I've steered our team towards a single goal - to empower businesses to become autonomous, AI-first organizations.

Sign up for our newsletter

Stay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.