From the course: Gemini API: Tool and Function Calling

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Single-turn calls with automatic function calling

Single-turn calls with automatic function calling - Gemini Tutorial

From the course: Gemini API: Tool and Function Calling

Single-turn calls with automatic function calling

- [Instructor] Back in VS Code. we'll be rebuilding our email validation function calling demo that we built in our single turn example. But this time, we'll be using automatic function calling. First, let's quickly take a mental picture of the code we had to write in the first version of this example. If we scroll up, as you can see, first, we have to declare our function, then we have to implement the function, then create the function declaration as a tool, pass it to our configuration, use our prompts. We set up the content parts. Then we write the request to our client, we get the function call response, and we extract the name and the arguments. We call the function. We then take the result of the function to create a functional response part. We build our conversation history with our first prompt, our function call object, and the function response part. Then we send our final response. 160 lines of…

Contents