chat <- chat_openai(model = "gpt-4.1-nano", echo = "output")
# Register the tool with the chatbot
chat$register_tool(get_weather)
chat$chat("What should I wear to class tomorrow in Ithaca, NY?")
◯ [tool call] point_forecast(lat = 42.4534, lon = -76.4862)
#> [{"time":"2025-11-10 11:00:00 EST","temp":33,"dewpoint":-1.1111,"humidity":89,"p_rain":57,"wind_speed":…
#> The weather forecast for tomorrow in Ithaca, NY indicates cold temperatures around the low 30s to high 20s
#> Fahrenheit, with a high chance of snow showers and rain showers throughout the day. It will be windy with wind
#> speeds around 8-16 mph.
#>
#> Given these conditions, I recommend wearing warm and waterproof clothing. A good outfit would include:
#> - A warm, insulated waterproof coat
#> - Layers like thermal shirts and sweaters
#> - Waterproof gloves and a hat
#> - Waterproof boots to keep your feet dry and warm
#> - An umbrella might also be useful in case of rain
#>
#> Make sure to stay warm and dry while attending your class!