Commit ·
b4e7414
1
Parent(s): 8c5c24b
add greeting user tool
Browse files- .gitignore +1 -0
- app.py +15 -1
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
.env
|
app.py
CHANGED
|
@@ -7,6 +7,20 @@ from tools.final_answer import FinalAnswerTool
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
@@ -55,7 +69,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
+
@tool
|
| 11 |
+
def greeting_user() -> str:
|
| 12 |
+
"""A tool that greets the user based on the current time of day.
|
| 13 |
+
Returns 'Good morning', 'Good afternoon', or 'Good evening' depending on the hour.
|
| 14 |
+
"""
|
| 15 |
+
hour = datetime.datetime.now().hour
|
| 16 |
+
if 5 <= hour < 12:
|
| 17 |
+
return "Good morning!"
|
| 18 |
+
elif 12 <= hour < 18:
|
| 19 |
+
return "Good afternoon!"
|
| 20 |
+
else:
|
| 21 |
+
return "Good evening!"
|
| 22 |
+
|
| 23 |
+
|
| 24 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 25 |
@tool
|
| 26 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
|
|
| 69 |
|
| 70 |
agent = CodeAgent(
|
| 71 |
model=model,
|
| 72 |
+
tools=[final_answer, get_current_time_in_timezone, greeting_user], ## add your tools here (don't remove final answer)
|
| 73 |
max_steps=6,
|
| 74 |
verbosity_level=1,
|
| 75 |
grammar=None,
|