Skip to main content

1. Use Cases

The Function Calling feature enables the model to call external tools to enhance its capabilities. This capability can leverage external tools through the large model, such as searching for external knowledge, checking itineraries, or using specific domain tools, effectively addressing issues like hallucination and Knowledge Timeliness.

2. Usage

2.1 Adding tools Request Parameters via REST API

Add in the request body:
For example, complete payload information:

2.2 Request via OpenAI Library

This feature is compatible with OpenAI. When using the OpenAI library, add tools=[corresponding tools] to the corresponding request parameters. For example:

3. List of Supported Models

Check out Model Square to view the supported models.
Note: The list of supported models is constantly being adjusted. Please refer to this document for the latest list of supported models.

4. Usage Examples

4.1. Example 1: Extending Large Language Model’s Numerical Computation Capability via Function Calling

his code inputs 4 functions: addition, subtraction, comparison, and counting duplicate letters in a string. It demonstrates how to use function calling to address execution issues in domains where token prediction is not strong for large language models.
The model will output:

4.2. Example 2: Extending Large Language Model’s Understanding of External Environments via Function Calling This code inputs 1 function to query external information via an external API.

The model will output: