You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
926 B
35 lines
926 B
import random
|
|
import datetime
|
|
from tool_helper import tool
|
|
|
|
@tool
|
|
def current_time():
|
|
"""Get the current local date and time as a string."""
|
|
return datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
|
|
|
|
# @tool
|
|
# def random_float():
|
|
# """Generate a random float from 0..1."""
|
|
# return str(random.random())
|
|
|
|
@tool
|
|
def random_float(a: float=0.0, b: float=1.0):
|
|
"""Generate a random float in range [a, b], including both end points. Optional pass no parameter and range 0..1 will be used.
|
|
Args:
|
|
a: minimum possible value
|
|
b: maximum possible value"""
|
|
return str(random.randint(a, b))
|
|
|
|
@tool
|
|
def random_int(a: int, b: int):
|
|
"""Generate a random integer in range [a, b], including both end points.
|
|
Args:
|
|
a: minimum possible value
|
|
b: maximum possible value"""
|
|
return str(random.randint(a, b))
|
|
|
|
|
|
|
|
|
|
def register_dummy():
|
|
pass # dummy function to run and be sure the decorators have run
|