bstraehle commited on
Commit
1b1d06e
Β·
verified Β·
1 Parent(s): 0e1322c

Update agents/crew.py

Browse files
Files changed (1) hide show
  1. agents/crew.py +4 -21
agents/crew.py CHANGED
@@ -12,7 +12,7 @@ from agents.models.llms import (
12
  THINKING_LEVEL_FINAL_ANSWER
13
  )
14
  from agents.models.prompts import PROMPT_FINAL_ANSWER
15
- from agents.tools.ai_tools import AITools
16
  from agents.tools.arithmetic_tools import ArithmeticTools
17
  from agents.tools.chess_tools import ChessTools
18
  from crewai import Agent, Crew, Task
@@ -209,28 +209,11 @@ def run_crew(question, file_path):
209
  final_question = f"{question} File path: {file_path}."
210
 
211
  answer = GAIACrew().crew().kickoff(inputs={"question": final_question})
212
- #final_answer = get_final_answer(question, str(answer))
213
 
214
  print(f"πŸ€– Initial question: {question}")
215
  print(f"πŸ€– Final question: {final_question}")
216
- #print(f"πŸ€– Initial answer: {answer}")
217
  print(f"πŸ€– Final answer: {final_answer}")
218
 
219
- return final_answer
220
-
221
- def get_final_answer(question, answer):
222
- client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
223
-
224
- prompt = PROMPT_FINAL_ANSWER.format(question=question, answer=answer)
225
-
226
- response = client.models.generate_content(
227
- model=LLM_FINAL_ANSWER,
228
- contents=[prompt],
229
- config=types.GenerateContentConfig(
230
- thinking_config=types.ThinkingConfig(
231
- thinking_level=THINKING_LEVEL_FINAL_ANSWER
232
- )
233
- )
234
- )
235
-
236
- return response.text
 
12
  THINKING_LEVEL_FINAL_ANSWER
13
  )
14
  from agents.models.prompts import PROMPT_FINAL_ANSWER
15
+ from agents.tools.ai_tools import AITools, get_final_answer
16
  from agents.tools.arithmetic_tools import ArithmeticTools
17
  from agents.tools.chess_tools import ChessTools
18
  from crewai import Agent, Crew, Task
 
209
  final_question = f"{question} File path: {file_path}."
210
 
211
  answer = GAIACrew().crew().kickoff(inputs={"question": final_question})
212
+ final_answer = get_final_answer(question, str(answer))
213
 
214
  print(f"πŸ€– Initial question: {question}")
215
  print(f"πŸ€– Final question: {final_question}")
216
+ print(f"πŸ€– Initial answer: {answer}")
217
  print(f"πŸ€– Final answer: {final_answer}")
218
 
219
+ return final_answer