WEBVTT

1
00:00:00.000 --> 00:00:05.000
Hi, and welcome to another AI and C-Sharp video on the Microsoft 18 Framework.

2
00:00:05.500 --> 00:00:08.500
In today's video, we're going to look at Google Gemini

3
00:00:08.500 --> 00:00:12.500
and how we can use Google Search inside Gemini.

4
00:00:14.000 --> 00:00:20.000
So, here we are in a sample called Google Gemini Web Search,

5
00:00:20.500 --> 00:00:26.500
and if we bring up to the console here,

6
00:00:26.500 --> 00:00:31.500
we can see that if we make a normal client for Google Gemini,

7
00:00:32.000 --> 00:00:36.000
and we just use it as is,

8
00:00:36.500 --> 00:00:38.500
it is just like any other model,

9
00:00:38.500 --> 00:00:42.000
that it can't really tell anything about,

10
00:00:42.000 --> 00:00:45.000
for example, in this case, today's Space News.

11
00:00:46.000 --> 00:00:50.000
So, I'm asking for Space News, just as it shows the date,

12
00:00:50.000 --> 00:00:53.000
and max 20 words, so it's not too long.

13
00:00:53.500 --> 00:00:56.000
And if we do that via a normal agent,

14
00:00:57.000 --> 00:01:02.000
we get the usual way of responding,

15
00:01:02.000 --> 00:01:07.500
in that it will be some news at its cutoff date.

16
00:01:08.000 --> 00:01:11.500
And in terms of this Gemini tree flash,

17
00:01:11.500 --> 00:01:15.500
that was May 21st, 2024,

18
00:01:16.000 --> 00:01:21.500
and they show some news, that news not being from today.

19
00:01:21.500 --> 00:01:25.000
So, of course, if we don't give a model anything,

20
00:01:25.000 --> 00:01:28.000
it can only know up to its cutoff date.

21
00:01:29.000 --> 00:01:32.000
So, we of course need to give it Web Search,

22
00:01:32.000 --> 00:01:37.000
and luckily that's very, very easy for us in Agent Framework,

23
00:01:38.000 --> 00:01:43.500
in that in the OpenAI versions we have seen of this,

24
00:01:43.500 --> 00:01:47.000
we just give something called Hosted Web Search Tool.

25
00:01:47.500 --> 00:01:51.000
And that actually works as well for Gemini.

26
00:01:52.500 --> 00:01:55.000
So, we just give that tool,

27
00:01:55.000 --> 00:01:57.500
and then we ask exactly the same question,

28
00:01:57.500 --> 00:01:59.500
what is today's Space News?

29
00:02:02.000 --> 00:02:04.000
Now it takes a little longer because it goes out

30
00:02:04.000 --> 00:02:06.500
and actually do a search,

31
00:02:07.000 --> 00:02:11.500
and we get back with, in my case, the 24th of March,

32
00:02:11.500 --> 00:02:13.500
which is the day of this recording,

33
00:02:13.500 --> 00:02:17.500
where it gives back the real news from today.

34
00:02:19.000 --> 00:02:20.500
So, that's great.

35
00:02:21.500 --> 00:02:25.000
We see that input and output tool looks very, very low.

36
00:02:25.500 --> 00:02:28.000
We'll talk a little about cost at the end.

37
00:02:30.000 --> 00:02:35.500
This, however, is behind the scenes something more advanced,

38
00:02:35.500 --> 00:02:38.000
and we can go the advanced route,

39
00:02:38.000 --> 00:02:41.500
not really that it gives us anything further,

40
00:02:42.000 --> 00:02:43.500
but you can see we can go in

41
00:02:43.500 --> 00:02:45.500
and make the ChatClientAgentOptions

42
00:02:45.500 --> 00:02:50.000
and the normal breaking glass with RawRepresentationFactory.

43
00:02:50.500 --> 00:02:55.000
And inside that, we have the Google way of defining tools,

44
00:02:55.000 --> 00:02:57.500
which is a tool instead of an AI tool,

45
00:02:58.000 --> 00:03:01.500
and we get a Google search with a search type,

46
00:03:02.000 --> 00:03:05.500
and then we can set the web search.

47
00:03:06.000 --> 00:03:11.000
This object have a lot of extra features,

48
00:03:11.500 --> 00:03:14.000
but unfortunately they don't work in Gemini,

49
00:03:14.000 --> 00:03:16.000
so we can't exclude domains.

50
00:03:16.000 --> 00:03:19.000
We can't do something called blogging confidence.

51
00:03:19.000 --> 00:03:23.500
Search type we have, the time range feature won't work either.

52
00:03:24.000 --> 00:03:27.000
So, it seems like Google have these things

53
00:03:27.000 --> 00:03:30.000
that they can use other places, but not in AI.

54
00:03:30.500 --> 00:03:34.000
In the same manner, the search type, there is an image search here,

55
00:03:34.000 --> 00:03:35.500
but we can't use it here.

56
00:03:35.500 --> 00:03:39.000
If we set these, it will simply just say,

57
00:03:39.000 --> 00:03:42.500
Google, Gemini doesn't support these settings.

58
00:03:43.000 --> 00:03:46.500
So, in reality, you don't really need to do this,

59
00:03:46.500 --> 00:03:50.000
unless at some point we get further things.

60
00:03:52.000 --> 00:03:54.500
But we just use the hosted web tool,

61
00:03:54.500 --> 00:03:57.500
but in the end, this can do exactly the same,

62
00:03:57.500 --> 00:04:03.500
and will give more or less the same result being AI, of course.

63
00:04:06.500 --> 00:04:09.500
So, we get our third response,

64
00:04:10.000 --> 00:04:14.500
and it's a different news, because there's multiple news today.

65
00:04:17.500 --> 00:04:20.500
What we can see is a little about the cost.

66
00:04:21.500 --> 00:04:25.500
Web search tools are fairly generous, being Google.

67
00:04:27.000 --> 00:04:30.000
If you go to their pricing page, they mention that you can get

68
00:04:30.000 --> 00:04:32.500
5,000 prompts per month for free,

69
00:04:33.000 --> 00:04:38.500
and then after that it's $14 per 1,000 search queries.

70
00:04:39.000 --> 00:04:43.000
It doesn't work with their free models, but only with their paid models.

71
00:04:44.000 --> 00:04:49.500
But fairly generous compared to what you pay for OpenAI.

72
00:04:50.000 --> 00:04:53.500
So, Google being Google, of course it makes sense

73
00:04:53.500 --> 00:04:55.500
that they are good at web search,

74
00:04:55.500 --> 00:05:02.000
and luckily for us, we have it very simple to work with those search tools.

75
00:05:02.500 --> 00:05:06.000
So, that was it, short one today.

76
00:05:06.000 --> 00:05:07.500
See you on the next one.

