File size: 402 Bytes
0f6fdc4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import datetime

def function_tool(func):
    func._is_tool = True
    return func

@function_tool
def get_weather(city: str) -> str:
    '''fetches weather information for a given city.'''
    return f"The weather in {city} is sunny with 75°F"

@function_tool
def get_time() -> str:
    '''fetches the current time.'''
    return f"The current time is {datetime.datetime.now().strftime('%H:%M:%S')}"