Skip to main content

OpenAPI Function Calling

Runbear can construct Assistant to consume arbitrary APIs. You can define custom actions add-on by integrating one or more APIs with Runbear, where APIs are defined using the OpenAPI specification. While our previous approach enabled API Function Calling via custom __api__ field, we have now support utilizing the OpenAPI specification for defining API functions within Runbear. This functionality is similar to Actions in OpenAI GPTs.

Common Use Cases

API function calls enable utilizing external services. For example, you can:

  • Create assistants that answer questions by calling external APIs, e.g., GET https://weatherapi.com/new-york
  • Convert natural language into API calls, e.g., convert "Who are my top customers?" to GET https://internal.service.com/customers/leaderboard and call your internal API

⋯ And much more!

Setting Up Function Calling with OpenAPI

To use OpenAPI function calling, you need to add the OpenAPI specification when you create an LLM app in Runbear. Runbear parses the OpenAPI specification and creates API functions that you can use in your Assistant.

First, navigate to Assistants and create a new assistant. Then, select the OpenAPI Assistants as the type. Enter your OpenAI API key and select the assistant you want to use.

New Assistant

Next, scroll down to find the Add-ons section and click "Configure Add-ons". Enter your OpenAPI specification in the text area If you see list of Add-ons, it means Runbear has successfully parsed the OpenAPI specification.

Configure Add-ons

Click "Done" and then "Create" to create the assistant.

Requirements for OpenAPI Specification

  • OpenAPI 3.0.0 or later.
  • servers field in the OpenAPI specification should be defined.

Authentication

If your API requires authentication, you can define the authentication method while you're configuring the Add-ons. Runbear currently supports header-based authentication, including basic auth, bearer tokens, and customizable headers. It also supports placing API credentials in the query string.