- Connect to your existing APIs without creating new simplified interfaces
- Fetch real-time data from your backend systems
- Perform actions like creating records, updating accounts, or processing transactions
- Leverage your current infrastructure without additional development
- Create a function
- Select an API connection
- Specify name and purpose
- Configure optional settings
- Use the function in a task
Step 1: Create a New Function
Navigate to the Functions page and click “Create Function.”- Select “Connect to an API” and click “Next: Choose an API”
Step 2: Select an API Connection
Under “Choose an API”:- Select one of your existing API connections
- Click “Next: Function details”
If you don’t have any API connections yet, you’ll need to create one first or create a Mock API Function.
Step 3: Specify the Name and Purpose of the Function
- Function Name: Provide a concise, unique name, using underscores (e.g.,
get_account_balance
). By default, the function name will be the same as the API connection name. - Function Purpose: Briefly describe what the function does (e.g., “Retrieves the current account balance for a customer”).
- GenerativeAgent uses this description to determine if/when it should call the function.
Step 4: Configure Optional Settings
After creating the function, you can configure additional fields to enhance the function’s behavior:- Message before sending: Display a message to the user before calling the API
- Confirmation message: Show confirmation after successful API calls
- Reference variables: The API function response will be part of the conversation context for GenerativeAgent to reference, but you can optionally specify a specific field as a reference variable to either reference it in a Conditional Template, or for it to be included when a System Transfer Function is called.
The function will call the real API during interactions. Make sure your API connection is properly configured and accessible.
Step 5: Using the API Function in a Task
Once you have created your API function, you must add the function to the task’s list of available functions for GenerativeAgent to use it. GenerativeAgent will call the function when it determines the API call is needed to complete the task. Here’s how the function works within a task and conversation flow:- GenerativeAgent analyzes the user’s request and determines if an API call is needed
- (Optional) A “Message before Sending” can be displayed to the user
- GenerativeAgent calls the API function with the appropriate parameters
- The API response is processed and can be used to generate a response to the user
- (Optional) A “Confirmation Message” can be displayed after successful API calls
Example scenario using an API Function
Example scenario using an API Function
Next Steps
API Connections
Learn how to create and configure API connections for your functions.
Mock API Functions
Start with mock APIs for testing before connecting to real systems.
Set Variable Functions
Learn how to store and manipulate conversation data with Set Variable Functions.
Previewer
Test your API functions in real-time with the Previewer tool.