Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,10 +70,10 @@ class BasicAgent:
|
|
| 70 |
description="Logs the agent's thought process for debugging purposes."
|
| 71 |
)
|
| 72 |
|
| 73 |
-
|
| 74 |
-
name="
|
| 75 |
-
fn=
|
| 76 |
-
description="Takes
|
| 77 |
)
|
| 78 |
|
| 79 |
final_answer = FunctionTool.from_defaults(
|
|
@@ -93,7 +93,7 @@ class BasicAgent:
|
|
| 93 |
)
|
| 94 |
|
| 95 |
# Prepara l'agente
|
| 96 |
-
self.agent = OpenAIAgent.from_tools([ingredient_tool, search_tool, log_thought_tool,
|
| 97 |
|
| 98 |
# Client OpenAI per chiamate esterne (immagini/audio)
|
| 99 |
|
|
@@ -132,7 +132,7 @@ class BasicAgent:
|
|
| 132 |
print_coso(f"__call__ text: {text}")
|
| 133 |
print_coso(f"__call__ file_info: {file_info}")
|
| 134 |
|
| 135 |
-
text = f"{verification_of_final_answer} {
|
| 136 |
|
| 137 |
# Se è presente un file, gestiscilo
|
| 138 |
|
|
@@ -557,12 +557,12 @@ def log_thought(thought: str) -> str:
|
|
| 557 |
print_coso(f"Tool log_thought: {thought}")
|
| 558 |
return "Thought logged."
|
| 559 |
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
print_coso(f"
|
| 564 |
-
return
|
| 565 |
-
|
| 566 |
def final_answer_tool(answer: str) -> str:
|
| 567 |
print_coso(f"Final answer: {answer}")
|
| 568 |
return answer
|
|
|
|
| 70 |
description="Logs the agent's thought process for debugging purposes."
|
| 71 |
)
|
| 72 |
|
| 73 |
+
sum_list_tool = FunctionTool.from_defaults(
|
| 74 |
+
name="sum_list",
|
| 75 |
+
fn=sum_list,
|
| 76 |
+
description="Takes a list of float numbers and returns their sum."
|
| 77 |
)
|
| 78 |
|
| 79 |
final_answer = FunctionTool.from_defaults(
|
|
|
|
| 93 |
)
|
| 94 |
|
| 95 |
# Prepara l'agente
|
| 96 |
+
self.agent = OpenAIAgent.from_tools([ingredient_tool, search_tool, log_thought_tool, sum_list_tool, final_answer], llm=llm, verbose=True)
|
| 97 |
|
| 98 |
# Client OpenAI per chiamate esterne (immagini/audio)
|
| 99 |
|
|
|
|
| 132 |
print_coso(f"__call__ text: {text}")
|
| 133 |
print_coso(f"__call__ file_info: {file_info}")
|
| 134 |
|
| 135 |
+
text = f"{verification_of_final_answer} {yaml_template2} {text}"
|
| 136 |
|
| 137 |
# Se è presente un file, gestiscilo
|
| 138 |
|
|
|
|
| 557 |
print_coso(f"Tool log_thought: {thought}")
|
| 558 |
return "Thought logged."
|
| 559 |
|
| 560 |
+
def sum_list(numbers: list[float]) -> float:
|
| 561 |
+
total = sum(numbers)
|
| 562 |
+
print_coso(f"[TOOL] sum_list called with: {numbers}")
|
| 563 |
+
print_coso(f"[TOOL] Result: {total}")
|
| 564 |
+
return total
|
| 565 |
+
|
| 566 |
def final_answer_tool(answer: str) -> str:
|
| 567 |
print_coso(f"Final answer: {answer}")
|
| 568 |
return answer
|