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 - Gemini Tutorial
From the course: Gemini API: Tool and Function Calling
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
-
-
-
-
About declaring basic functions5m 1s
-
(Locked)
Declare our first function6m 9s
-
(Locked)
Exploring a function call response3m 19s
-
(Locked)
Initializing our client4m 28s
-
(Locked)
Extracting our function3m 58s
-
(Locked)
Declaring multiple functions3m 56s
-
(Locked)
Querying for a single user4m 21s
-
(Locked)
How function calling modes work3m 20s
-
(Locked)
Using function calling modes11m 39s
-
-
-
-
-