A very common use case is to provide the LLM with the ability to perform API calls via function calling.
In this example the LLM will retrieve the weather forecast for the next 5 days.
To do so a getWeather function is defined that is passed to the LLM as tool.
The getWeatherfunction extracts the user’s location from the request and calls the external weather API via the Workers’ Fetch API and returns the result.