GattoNero commited on
Commit
4f66704
·
verified ·
1 Parent(s): 9fe1de5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -70,10 +70,10 @@ class BasicAgent:
70
  description="Logs the agent's thought process for debugging purposes."
71
  )
72
 
73
- add_floats_tool = FunctionTool.from_defaults(
74
- name="add_floats",
75
- fn=add_tool,
76
- description="Takes two float numbers and returns their sum."
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, add_floats_tool], llm=llm, verbose=True)
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} {yaml_template} {text}"
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
- def add_tool(a: float, b: float) -> float:
562
- result = a + b
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
 
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