Function call
Execute functions to help your AI generate dynamic answers.
Last updated
Execute functions to help your AI generate dynamic answers.
Last updated
AIs were limited to answering questions from your static knowledge base.
With function calling, you can have your AI execute a Javascript function that invokes third-party APIs to generate a dynamic answer.
First, we create a function from the AI Studio -> Function Call screen
Each function is made up of 3 things:
A brief description that helps the AI understand what this function does.
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.
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
On the function, click on the '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.