Hi, and welcome to another AI and C-Sharp video on the Microsoft 18 Framework.
In today's video, we're going to look at Google Gemini
and how we can use Google Search inside Gemini.
So, here we are in a sample called Google Gemini Web Search,
and if we bring up to the console here,
we can see that if we make a normal client for Google Gemini,
and we just use it as is,
it is just like any other model,
that it can't really tell anything about,
for example, in this case, today's Space News.
So, I'm asking for Space News, just as it shows the date,
and max 20 words, so it's not too long.
And if we do that via a normal agent,
we get the usual way of responding,
in that it will be some news at its cutoff date.
And in terms of this Gemini tree flash,
that was May 21st, 2024,
and they show some news, that news not being from today.
So, of course, if we don't give a model anything,
it can only know up to its cutoff date.
So, we of course need to give it Web Search,
and luckily that's very, very easy for us in Agent Framework,
in that in the OpenAI versions we have seen of this,
we just give something called Hosted Web Search Tool.
And that actually works as well for Gemini.
So, we just give that tool,
and then we ask exactly the same question,
what is today's Space News?
Now it takes a little longer because it goes out
and actually do a search,
and we get back with, in my case, the 24th of March,
which is the day of this recording,
where it gives back the real news from today.
So, that's great.
We see that input and output tool looks very, very low.
We'll talk a little about cost at the end.
This, however, is behind the scenes something more advanced,
and we can go the advanced route,
not really that it gives us anything further,
but you can see we can go in
and make the ChatClientAgentOptions
and the normal breaking glass with RawRepresentationFactory.
And inside that, we have the Google way of defining tools,
which is a tool instead of an AI tool,
and we get a Google search with a search type,
and then we can set the web search.
This object have a lot of extra features,
but unfortunately they don't work in Gemini,
so we can't exclude domains.
We can't do something called blogging confidence.
Search type we have, the time range feature won't work either.
So, it seems like Google have these things
that they can use other places, but not in AI.
In the same manner, the search type, there is an image search here,
but we can't use it here.
If we set these, it will simply just say,
Google, Gemini doesn't support these settings.
So, in reality, you don't really need to do this,
unless at some point we get further things.
But we just use the hosted web tool,
but in the end, this can do exactly the same,
and will give more or less the same result being AI, of course.
So, we get our third response,
and it's a different news, because there's multiple news today.
What we can see is a little about the cost.
Web search tools are fairly generous, being Google.
If you go to their pricing page, they mention that you can get
5,000 prompts per month for free,
and then after that it's $14 per 1,000 search queries.
It doesn't work with their free models, but only with their paid models.
But fairly generous compared to what you pay for OpenAI.
So, Google being Google, of course it makes sense
that they are good at web search,
and luckily for us, we have it very simple to work with those search tools.
So, that was it, short one today.
See you on the next one.