Spaces:
Sleeping
Sleeping
Update app.py
#1
by pnoid - opened
app.py
CHANGED
|
@@ -9,14 +9,14 @@ 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:
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
-
"""A tool that
|
| 15 |
Args:
|
| 16 |
-
arg1:
|
| 17 |
-
arg2:
|
| 18 |
"""
|
| 19 |
-
return
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -34,6 +34,23 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
|
| 39 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
|
|
|
| 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:int, arg2:int)-> int: #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 |
+
"""A tool that is a calculator
|
| 15 |
Args:
|
| 16 |
+
arg1: input nr one
|
| 17 |
+
arg2: input nr two
|
| 18 |
"""
|
| 19 |
+
return arg1 * arg2
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
|
| 37 |
+
@tool
|
| 38 |
+
def search_tool = DuckDuckGoSearchTool()
|
| 39 |
+
model = HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct")
|
| 40 |
+
|
| 41 |
+
agent = CodeAgent(
|
| 42 |
+
tools=[search_tool],
|
| 43 |
+
model=model,
|
| 44 |
+
max_steps=3,
|
| 45 |
+
verbosity_level=2,
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
query = "What are the latest updates on the Falcon 9 launch schedule?"
|
| 49 |
+
result = agent.run(query)
|
| 50 |
+
|
| 51 |
+
print("\n--- Final Answer ---\n")
|
| 52 |
+
print(result)
|
| 53 |
+
|
| 54 |
final_answer = FinalAnswerTool()
|
| 55 |
|
| 56 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|