GattoNero commited on
Commit
842adf4
·
verified ·
1 Parent(s): cd43852

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -69,6 +69,13 @@ class BasicAgent:
69
  fn=log_thought,
70
  description="Logs the agent's thought process for debugging purposes."
71
  )
 
 
 
 
 
 
 
72
 
73
  # Registra il tool
74
  #Settings.tools = [ingredient_tool]
@@ -80,7 +87,7 @@ class BasicAgent:
80
  )
81
 
82
  # Prepara l'agente
83
- self.agent = OpenAIAgent.from_tools([ingredient_tool, search_tool, log_thought_tool], llm=llm, verbose=True)
84
 
85
  # Client OpenAI per chiamate esterne (immagini/audio)
86
 
@@ -119,7 +126,7 @@ class BasicAgent:
119
  print_coso(f"__call__ text: {text}")
120
  print_coso(f"__call__ file_info: {file_info}")
121
 
122
- text = f"{text} {verification_of_final_answer} {yaml_template}"
123
 
124
  # Se è presente un file, gestiscilo
125
 
@@ -561,9 +568,20 @@ def web_search(query: str) -> str:
561
  return formattedResult
562
 
563
  def log_thought(thought: str) -> str:
564
- print_coso(f"[THOUGHT] {thought}")
565
  return "Thought logged."
566
 
 
 
 
 
 
 
 
 
 
 
 
567
 
568
  def print_coso(scritta: str):
569
  print(f"coso {scritta}")
 
69
  fn=log_thought,
70
  description="Logs the agent's thought process for debugging purposes."
71
  )
72
+
73
+ add = FunctionTool.from_defaults(
74
+ name="add floats",
75
+ fn=add,
76
+ description="Takes two float numbers and returns their sum"
77
+ )
78
+
79
 
80
  # Registra il tool
81
  #Settings.tools = [ingredient_tool]
 
87
  )
88
 
89
  # Prepara l'agente
90
+ self.agent = OpenAIAgent.from_tools([ingredient_tool, search_tool, log_thought_tool, add], llm=llm, verbose=True)
91
 
92
  # Client OpenAI per chiamate esterne (immagini/audio)
93
 
 
126
  print_coso(f"__call__ text: {text}")
127
  print_coso(f"__call__ file_info: {file_info}")
128
 
129
+ text = f"{verification_of_final_answer} {yaml_template} {text}"
130
 
131
  # Se è presente un file, gestiscilo
132
 
 
568
  return formattedResult
569
 
570
  def log_thought(thought: str) -> str:
571
+ print_coso(f"Tool log_thought: {thought}")
572
  return "Thought logged."
573
 
574
+
575
+ def add(a: float, b: float) -> float:
576
+ print_coso(f"Tool add: {a} + {b}")
577
+ """Add two numbers.
578
+
579
+ Args:
580
+ a: first float
581
+ b: second float
582
+ """
583
+ return a + b
584
+
585
 
586
  def print_coso(scritta: str):
587
  print(f"coso {scritta}")