Skip to main content

llama-index tools weather integration

Project description

Open Weather Map Tool

This tool connects to the OpenWeatherMap's OneCall API, using the pyowm Python package. You must initialize the tool with your OpenWeatherMap API token

The tool has access to the following functions:

  • the current weather
  • the weather tomorrow

Usage

Here's an example usage of the OpenWeatherMapToolSpec.

from llama_index.tools.weather import OpenWeatherMapToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

tool_spec = OpenWeatherMapToolSpec(key="...")

agent = FunctionAgent(
    tools=tool_spec.to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)

print(await agent.run("What is the temperature like in Paris?"))
print(await agent.run("What is the wind like in Budapest tomorrow?"))

weather_at_location: Use pyowm to get current weather details at a location

forecast_tomorrow_at_location: Use pyowm to get the forecast for tomorrow at a location.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_tools_weather-0.4.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_tools_weather-0.4.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_weather-0.4.1.tar.gz.

File metadata

File hashes

Hashes for llama_index_tools_weather-0.4.1.tar.gz
Algorithm Hash digest
SHA256 70cf443e87e8f6be8076934e8e508629a91b94a6fdd041a81de4b57c13626518
MD5 3c19857d0ab5e1cb46961321273e3fc6
BLAKE2b-256 4a760cc0edebc25c70cb82bd3721f9a51b9eb93c4e8e49a8f68e74d1001390c3

See more details on using hashes here.

File details

Details for the file llama_index_tools_weather-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_tools_weather-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fef69e8be55cb1f474ee4c742b9c2cda5b9253f746fca1190bce7ac8310d5944
MD5 27912ba03b42cd34951c74e4f0296d3c
BLAKE2b-256 b105959ed4ffd5c8e1ebad01417e475fa51fdd4aa4a5a636e01736a29596ebda

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page