Update crew.py
Browse files
crew.py
CHANGED
|
@@ -340,7 +340,8 @@ def run_crew(question, file_path):
|
|
| 340 |
|
| 341 |
document_analysis_agent = Agent(
|
| 342 |
role="Document Analysis Agent",
|
| 343 |
-
goal="Given a question and document file, analyze the document and answer the question: {question}"
|
|
|
|
| 344 |
backstory="As an expert document analysis assistant, you analyze the document to answer the question.",
|
| 345 |
allow_delegation=False,
|
| 346 |
llm=AGENT_MODEL,
|
|
@@ -419,14 +420,14 @@ def run_crew(question, file_path):
|
|
| 419 |
if file_path:
|
| 420 |
question = f"{question} File path: {file_path}."
|
| 421 |
|
|
|
|
|
|
|
| 422 |
initial_answer = crew.kickoff(inputs={"question": question})
|
| 423 |
final_answer = get_final_answer(FINAL_ANSWER_MODEL, question, str(initial_answer))
|
| 424 |
|
| 425 |
-
print("###")
|
| 426 |
-
print(f"
|
| 427 |
-
print(f"
|
| 428 |
-
print(f"Final answer: {final_answer}")
|
| 429 |
-
print("###")
|
| 430 |
|
| 431 |
return final_answer
|
| 432 |
|
|
|
|
| 340 |
|
| 341 |
document_analysis_agent = Agent(
|
| 342 |
role="Document Analysis Agent",
|
| 343 |
+
goal="Given a question and document file, analyze the document and answer the question: {question}\n"
|
| 344 |
+
"If the question refers to a file, ignore this part, the file data are provided here:",
|
| 345 |
backstory="As an expert document analysis assistant, you analyze the document to answer the question.",
|
| 346 |
allow_delegation=False,
|
| 347 |
llm=AGENT_MODEL,
|
|
|
|
| 420 |
if file_path:
|
| 421 |
question = f"{question} File path: {file_path}."
|
| 422 |
|
| 423 |
+
print(f"### Question: {question}")
|
| 424 |
+
|
| 425 |
initial_answer = crew.kickoff(inputs={"question": question})
|
| 426 |
final_answer = get_final_answer(FINAL_ANSWER_MODEL, question, str(initial_answer))
|
| 427 |
|
| 428 |
+
print(f"### Question: {question}")
|
| 429 |
+
print(f"### Initial answer: {initial_answer}")
|
| 430 |
+
print(f"### Final answer: {final_answer}")
|
|
|
|
|
|
|
| 431 |
|
| 432 |
return final_answer
|
| 433 |
|