Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -76,6 +76,12 @@ class BasicAgent:
|
|
76 |
description="Takes two float numbers and returns their sum."
|
77 |
)
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
# Registra il tool
|
81 |
#Settings.tools = [ingredient_tool]
|
@@ -87,7 +93,7 @@ class BasicAgent:
|
|
87 |
)
|
88 |
|
89 |
# Prepara l'agente
|
90 |
-
self.agent = OpenAIAgent.from_tools([ingredient_tool, search_tool, log_thought_tool, add_floats_tool], llm=llm, verbose=True)
|
91 |
|
92 |
# Client OpenAI per chiamate esterne (immagini/audio)
|
93 |
|
@@ -557,6 +563,9 @@ def add_tool(a: float, b: float) -> float:
|
|
557 |
print_coso(f"Tool add: {a} + {b} = {result}")
|
558 |
return result
|
559 |
|
|
|
|
|
|
|
560 |
|
561 |
def print_coso(scritta: str):
|
562 |
print(f"coso {scritta}")
|
|
|
76 |
description="Takes two float numbers and returns their sum."
|
77 |
)
|
78 |
|
79 |
+
final_answer = FunctionTool.from_defaults(
|
80 |
+
name="final_answer",
|
81 |
+
fn=final_answer_tool,
|
82 |
+
description="Returns the final answer to the user as a string."
|
83 |
+
)
|
84 |
+
|
85 |
|
86 |
# Registra il tool
|
87 |
#Settings.tools = [ingredient_tool]
|
|
|
93 |
)
|
94 |
|
95 |
# Prepara l'agente
|
96 |
+
self.agent = OpenAIAgent.from_tools([ingredient_tool, search_tool, log_thought_tool, add_floats_tool, final_answer], llm=llm, verbose=True)
|
97 |
|
98 |
# Client OpenAI per chiamate esterne (immagini/audio)
|
99 |
|
|
|
563 |
print_coso(f"Tool add: {a} + {b} = {result}")
|
564 |
return result
|
565 |
|
566 |
+
def final_answer_tool(answer: str) -> str:
|
567 |
+
print_coso(f"Final answer: {answer}")
|
568 |
+
return answer
|
569 |
|
570 |
def print_coso(scritta: str):
|
571 |
print(f"coso {scritta}")
|