Psiska commited on
Commit
014235b
·
1 Parent(s): 9dd3a5f

Deleted memory tool 3

Browse files
crew.py CHANGED
@@ -146,7 +146,17 @@ class GAIACrew():
146
 
147
 
148
  def run_crew(question, file_path):
149
- # 0) Prepend file data if needed
 
 
 
 
 
 
 
 
 
 
150
  final_question = question
151
  if file_path:
152
  if is_ext(file_path, ".csv") or is_ext(file_path, ".xls") \
@@ -156,33 +166,21 @@ def run_crew(question, file_path):
156
  final_question = f"{question} JSON data:\n{json_data}."
157
  else:
158
  final_question = f"{question} File path: {file_path}."
159
-
160
- # 1) Load memory (relevant recall)
161
- history = memory_tool.run("load", question)
162
- # In case some other implementation returns a list, handle it:
163
- if isinstance(history, list):
164
- history = "\n".join(history)
165
-
166
- # 2) Build the prompt we send to Crew
167
- # If there is history, prefix it; otherwise just use the question
168
- full_input = (history + "\n" if history else "") + final_question
169
-
170
- # 3) Run the multi-agent Crew
171
  crew_instance = GAIACrew()
172
- raw_answer = crew_instance.get_crew().kickoff(inputs={"question": full_input})
173
-
174
- # 4) Save only the **user** question for future recall
175
- memory_tool.run("save", question)
176
-
177
- # 5) Post-process for the “final answer”
178
- final_answer = get_final_answer(FINAL_ANSWER_MODEL, question, str(raw_answer))
179
-
180
- # 6) (Optional) print debug traces
181
- print(f"=> History:\n{history}")
182
- print(f"=> Prompt sent:\n{full_input}")
183
- print(f"=> Raw answer:\n{raw_answer}")
184
- print(f"=> Final answer:\n{final_answer}")
185
-
186
  return final_answer
187
 
188
 
 
146
 
147
 
148
  def run_crew(question, file_path):
149
+ """
150
+ Orchestrates the GAIA crew to answer a question, optionally with a file.
151
+
152
+ Args:
153
+ question (str): The user's question.
154
+ file_path (str): Optional path to a data file to include in the prompt.
155
+
156
+ Returns:
157
+ str: The final answer from the manager agent.
158
+ """
159
+ # Build the final prompt, including file JSON if needed
160
  final_question = question
161
  if file_path:
162
  if is_ext(file_path, ".csv") or is_ext(file_path, ".xls") \
 
166
  final_question = f"{question} JSON data:\n{json_data}."
167
  else:
168
  final_question = f"{question} File path: {file_path}."
169
+
170
+ # Instantiate the crew and kick off the workflow
 
 
 
 
 
 
 
 
 
 
171
  crew_instance = GAIACrew()
172
+ crew = crew_instance.get_crew()
173
+ answer = crew.kickoff(inputs={"question": final_question})
174
+
175
+ # Post-process through the final-answer model
176
+ final_answer = get_final_answer(FINAL_ANSWER_MODEL, question, str(answer))
177
+
178
+ # Debug logging
179
+ print(f"=> Initial question: {question}")
180
+ print(f"=> Final question: {final_question}")
181
+ print(f"=> Initial answer: {answer}")
182
+ print(f"=> Final answer: {final_answer}")
183
+
 
 
184
  return final_answer
185
 
186
 
tools/__pycache__/ai_tools.cpython-310.pyc CHANGED
Binary files a/tools/__pycache__/ai_tools.cpython-310.pyc and b/tools/__pycache__/ai_tools.cpython-310.pyc differ