Initial commit

This commit is contained in:
2024-08-16 12:43:59 -05:00
commit ae4f06d0b4
6 changed files with 182 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
# tools/weather_tool.py
from .base_tool import BaseTool
class WeatherTool(BaseTool):
def get_functions(self):
return [{
"name": "get_weather",
"description": "Get the current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
}
},
"required": ["location"]
}
}]
def execute(self, function_name, **kwargs):
if function_name == "get_weather":
location = kwargs.get("location")
# In a real implementation, you would call a weather API here
return f"The weather in {location} is sunny and 72°F"