Skip to main content

Weather Tool

Usage

Portia offers both open source tools as well as a cloud-hosted library of tools to save you development time. You can dig into the specs of those tools in our open source repo (SDK repo ↗).

You can import our open source tools into your project using from portia.open_source_tools.registry import open_source_tool_registry and load them into an InMemoryToolRegistry object. You can also combine their use with cloud or custom tools as explained in the docs (Add custom tools ↗).

Tool details

Tool ID: portia:openweathermap::weather

Tool description: Get the weather for a given city

Usage notes:

This tool uses a simple GET endpoint from OpenWeatherMap. Please sign up to obtain an API key from them () and set it in the environment variable OPENWEATHERMAP_API_KEY.

Args schema:

{
"description": "Input for WeatherTool.",
"properties": {
"city": {
"description": "The city to get the weather for",
"title": "City",
"type": "string"
}
},
"required": [
"city"
],
"title": "WeatherToolSchema",
"type": "object"
}

Output schema:

('str', 'String output of the weather with temp and city')