Weather Chatbot: Ask the Clouds!
Build a chatbot that answers weather questions using Latitude and a custom weather tool. Fun, fast, and just a bit magical.
Live example
You can play with this example in the Latitude Playground.
Overview
Curious if you need an umbrella before heading out? In this example, you’ll build a Weather Chatbot that fetches real-time weather information whenever users ask. Powered by Latitude prompts and your custom backend code, this bot delivers instant updates on sunshine, rain, or snow—with just a dash of magic.
The prompt
Breakdown
The main concept to learn in this example is tool calling. This tool fetches weather data from the OpenWeatherMap API using the specified location. It returns the location name, temperature, and a description of the current weather conditions.
Tool calling
The key feature in this prompt is the use of a tool call. This allows the model to trigger a custom backend function to fetch weather data, such as by calling the OpenWeatherMap API. In the Latitude Playground, you can simulate this tool call, as shown in the screenshot above.
Resources
- Playground docs - Learn how to use the Playground to test and run prompts.
- Tool calling docs - Learn how to create and use tools in your prompts.
- Tool call SDK example - A simple example of how to run a prompt with tools with Latitude SDK.
- OpenWeatherMap API - The API used to fetch weather data.