forked from trpc-group/trpc-agent-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools.py
More file actions
56 lines (52 loc) · 1.47 KB
/
Copy pathtools.py
File metadata and controls
56 lines (52 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Tencent is pleased to support the open source community by making tRPC-Agent-Python available.
#
# Copyright (C) 2026 Tencent. All rights reserved.
#
# tRPC-Agent-Python is licensed under Apache-2.0.
"""Tools for the LiteLLM weather agent."""
def get_weather_report(city: str) -> dict:
"""Get weather information for the specified city."""
weather_data = {
"Beijing": {
"temperature": "25°C",
"condition": "Sunny",
"humidity": "60%",
},
"Shanghai": {
"temperature": "28°C",
"condition": "Cloudy",
"humidity": "70%",
},
"Guangzhou": {
"temperature": "32°C",
"condition": "Thunderstorm",
"humidity": "85%",
},
}
return weather_data.get(
city,
{
"temperature": "Unknown",
"condition": "Data not available",
"humidity": "Unknown"
},
)
def get_weather_forecast(city: str, days: int = 3) -> list:
"""Get the multi-day weather forecast for the specified city."""
return [
{
"date": "2024-01-01",
"temperature": "25°C",
"condition": "Sunny"
},
{
"date": "2024-01-02",
"temperature": "23°C",
"condition": "Cloudy"
},
{
"date": "2024-01-03",
"temperature": "20°C",
"condition": "Light rain"
},
][:days]