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.

Extracting our function

Extracting our function

- [Instructor] Let's extract our function and its arguments. I'm just going to comment out this print statement. Then down here, we can extract our function_call by saying response. We know that the response has a candidate's property, so we call candidates. This property has one single candidate, which is what the Gemini API currently returns. So we get that candidate. Then we get its content property. There's content property which also contains parts. So we get a parts property of the content property. For a function call response, we only have one, which is for the function call itself, so we get that. And we know that the name of that property is called function_call. Awesome. So we get our function_call. And now we can print our function name. That's the name of the return function. That will be say function name, and that will be function_call.name, because we know that it comes with the name property. We scroll up,…

Contents