> ## Documentation Index
> Fetch the complete documentation index at: https://docs-v1.latitude.so/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.

<Card title="Live example" href="https://app.latitude.so/share/d/7c9ceb2c-79e8-4928-978d-0f1eadb23294" arrow="true" cta="Copy to your Latitude">
  You can play with this example in the Latitude Playground.
</Card>

## 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

```yaml theme={null}
---
provider: openai
model: gpt-4o
temperature: 0.2
tools:
  - get_weather:
      description: Fetch weather data for a given location.
      parameters:
        type: object
        properties:
          location:
            type: string
            description: The name of the location to fetch weather data for.
        required:
          - location
---

You are a helpful assistant that can provide weather information.
If the user asks for the weather in a specific location, use the
`get_weather` tool to fetch the data.

<user>
  {{ question }}
</user>
```

## 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](/guides/prompt-manager/tools). This allows the model to trigger a custom backend function to fetch weather data, such as by calling the [OpenWeatherMap API](https://openweathermap.org/api). In the Latitude Playground, you can simulate this tool call, as shown in [the screenshot above](/examples/cases/weather-chatbot#demo).

```yaml {5-15} theme={null}
---
provider: openai
model: gpt-4o
temperature: 0.2
tools:
  - get_weather:
      description: Fetch weather data for a given location.
      parameters:
        type: object
        properties:
          location:
            type: string
            description: The name of the location to fetch weather data for.
        required:
          - location
---
```

## Resources

* [Playground docs](/guides/prompt-manager/playground) - Learn how to use the Playground to test and run prompts.
* [Tool calling docs](/guides/prompt-manager/tools) - Learn how to create and use tools in your prompts.
* [Tool call SDK example](/examples/sdk/run-prompt-with-tools) - A simple example of how to run a prompt with tools with Latitude SDK.
* [OpenWeatherMap API](https://openweathermap.org/api) - The API used to fetch weather data.
