Function call
Execute functions to help your AI generate dynamic answers.
Available in the ULTIMATE plan and above.
AIs were limited to answering questions from your static knowledge base.
With function calling, you can have your AI execute Javascript function which invoke third-party APIs to generate a dynamic answer.
Creating a function
First, we create a function form the AI Studio -> Function Call screen
Each function is made up of 3 things:
Prompt
A brief description that helps the AI understand what this function does.
Parameters
The list of parameters that are required for this function to be executed. The parameters need to be provided in the form of a JSON array.
Function handler
This is the Javascript code executed to generate the response to the question asked.
This function would generally consist of
API endpoint that is to be invoked
Conditions and logic to ask follow-up questions if parameters are missing
Testing the function
On the function, click on 'Save & Run function' to open the test window.
You can customize the LLM model used and see the response generated by it.
Also, to view the exact execution of the function, you can click the 'Show log' to view the entire log.
Here you can view the arguments detected by the function and the output generated by the function.
Last updated