Spaces:
Sleeping
Sleeping
Thomas Hatting commited on
Update app.py
Browse filesUpdate CodeAgent
app.py
CHANGED
|
@@ -9,14 +9,24 @@ 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
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
-
"""
|
|
|
|
|
|
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
arg2: the second argument
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -56,7 +66,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 56 |
|
| 57 |
agent = CodeAgent(
|
| 58 |
model=model,
|
| 59 |
-
tools=[DuckDuckGoSearchTool(),final_answer], ## add your tools here (don't remove final answer)
|
| 60 |
max_steps=6,
|
| 61 |
verbosity_level=1,
|
| 62 |
grammar=None,
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def restaurant_service_tool(query: str) -> str: #it's import to specify the return type
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
+
"""
|
| 15 |
+
This tool returns the highest-rated restaurant in Copenhagen.
|
| 16 |
+
|
| 17 |
Args:
|
| 18 |
+
query: A search term for finding restaurant.
|
|
|
|
| 19 |
"""
|
| 20 |
+
# Example list of catering services and their ratings
|
| 21 |
+
services = {
|
| 22 |
+
"Geranium": 4.7,
|
| 23 |
+
"Alchemist": 4.9,
|
| 24 |
+
"Maple Casual Dining": 4.8,
|
| 25 |
+
}
|
| 26 |
+
# Find the highest rated catering service (simulating search query filtering)
|
| 27 |
+
best_service = max(services, key=services.get)
|
| 28 |
+
|
| 29 |
+
return best_service
|
| 30 |
|
| 31 |
@tool
|
| 32 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 66 |
|
| 67 |
agent = CodeAgent(
|
| 68 |
model=model,
|
| 69 |
+
tools=[DuckDuckGoSearchTool(),restaurant_service_tool, final_answer], ## add your tools here (don't remove final answer)
|
| 70 |
max_steps=6,
|
| 71 |
verbosity_level=1,
|
| 72 |
grammar=None,
|