-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtools.py
55 lines (52 loc) · 1.64 KB
/
tools.py
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
from datetime import datetime
import requests
def get_current_date():
"""Get the current date and time."""
current_datetime = datetime.now()
return {
"date": current_datetime.strftime("%Y-%m-%d"),
"time": current_datetime.strftime("%H:%M:%S"),
"weekday": current_datetime.strftime("%A")
}
def get_weather(location: str):
"""Get the current weather for a location."""
# This is a mock implementation - replace with actual weather API call
return {
"location": location,
"temperature": "20°C",
"condition": "sunny"
}
# Define available tools/functions for the model
tools = [
{
"type": "function",
"function": {
"name": "get_current_date",
"description": "Get the current date and time. Use this when someone asks about the current date, time, or day of the week.",
"parameters": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": False
}
}
},
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather conditions for a location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city or location to get weather for"
}
},
"required": ["location"],
"additionalProperties": False
}
}
}
]