add tools.py
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"""
|
||||
Utility tools used by the agent.
|
||||
|
||||
The assignment requires a single tool – ``get_weather`` – that returns a short
|
||||
string describing the weather for a given city and date. In a real project this
|
||||
would call an external API, but for the purposes of the homework we return a
|
||||
hard‑coded string so that the repository is self‑contained.
|
||||
"""
|
||||
import json
|
||||
from typing import Dict
|
||||
|
||||
def get_weather(city: str = "Москва", date: str = "сегодня") -> str:
|
||||
"""Return a mock weather description.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
city : str, optional
|
||||
Name of the city. Defaults to ``"Москва"``.
|
||||
date : str, optional
|
||||
Date for which the forecast is requested. Defaults to ``"сегодня"``.
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
A short human‑readable weather report.
|
||||
"""
|
||||
# In a real implementation we would query an API here.
|
||||
return f"В городе {city} на {date} ожидается солнечная погода с температурой 25°C."
|
||||
|
||||
__all__ = ["get_weather"]
|
||||
Reference in New Issue
Block a user