So far, we have implemented the text-based
search feature and the image-based search
feature.
We have displayed destination cards with all
the details for travelers to be able to pick
their appropriate destinations.
But one feature is still pending, the weather
display feature and in this section, we'll
be developing this feature.
First let's get a good understanding of how
this feature will be implemented, then we
can proceed to the implementation in the subsequent
videos.
When a user sees the destination card and
then proceeds to clicking the weather button,
the button will trigger an event handler that
will call an endpoint to get the weather information.
This request will carry the destination we
want to query the weather for in its payload.
At the backend, we'll then create a tool that
helps us retrieve this weather information.
This tool will be passed to our Gemini model
in the request configuration to the Gemini
API.
will recognize this tool in our request and
call it to get the weather information.
The model will then package the data returned
by the function and a summary of the weather
as its results.
This information will then be sent back to
the frontend for display.
Now that we understand the process flow for
the implementation of this feature,
let's look at the pieces of the puzzle we
need to develop.
We'll be starting from the backend and there,
we first need to develop the function
that will enable the model retrieve weather
information.
Once we have that in place, we'll then develop
the endpoint that will use the function we
just
created in a function calling workflow with
the Gemini API.
This is the process that will be used by the
Gemini API to get us the weather information.
If you would like to learn more about function
or tool calling using the Gemini API,
you can check out my Gemini API course on
the topic titled Gemini API Tool Calling.
After implementing these pieces on the backend,
we can then move to the frontend
and attach our event handler to our checkWeatherButton.
This will make a request to the
API that we just created, retrieve the results,
and display a modal to properly present our
weather
results.
Sounds straightforward, right?
Great.
Now, let's start implementing this in the
next
video, beginning with the function that will
be used by the modal for function calling.