Update crew.py
Browse files
crew.py
CHANGED
|
@@ -61,7 +61,7 @@ def run_crew(question, file_name):
|
|
| 61 |
backstory="As an expert image analysis assistant, you analyze the image to help answer the question.",
|
| 62 |
allow_delegation=False,
|
| 63 |
llm=AGENT_MODEL,
|
| 64 |
-
max_iter=
|
| 65 |
tools=[image_analysis_tool],
|
| 66 |
verbose=False
|
| 67 |
)
|
|
@@ -132,14 +132,16 @@ def run_crew(question, file_name):
|
|
| 132 |
|
| 133 |
if file_name:
|
| 134 |
question = f"{question} File name: data/{file_name}."
|
|
|
|
| 135 |
if file_name.endswith(".py"):
|
| 136 |
with open(f"data/{file_name}", "r") as file:
|
| 137 |
question = f"{question} File data:\n{file.read()}"
|
| 138 |
|
| 139 |
-
print(f"Question: {question}")
|
| 140 |
initial_answer = crew.kickoff(inputs={"question": question})
|
| 141 |
-
print(f"Initial answer: {initial_answer}")
|
| 142 |
final_answer = get_final_answer(question, str(initial_answer))
|
|
|
|
|
|
|
|
|
|
| 143 |
print(f"Final answer: {final_answer}")
|
| 144 |
|
| 145 |
return final_answer
|
|
|
|
| 61 |
backstory="As an expert image analysis assistant, you analyze the image to help answer the question.",
|
| 62 |
allow_delegation=False,
|
| 63 |
llm=AGENT_MODEL,
|
| 64 |
+
max_iter=3,
|
| 65 |
tools=[image_analysis_tool],
|
| 66 |
verbose=False
|
| 67 |
)
|
|
|
|
| 132 |
|
| 133 |
if file_name:
|
| 134 |
question = f"{question} File name: data/{file_name}."
|
| 135 |
+
|
| 136 |
if file_name.endswith(".py"):
|
| 137 |
with open(f"data/{file_name}", "r") as file:
|
| 138 |
question = f"{question} File data:\n{file.read()}"
|
| 139 |
|
|
|
|
| 140 |
initial_answer = crew.kickoff(inputs={"question": question})
|
|
|
|
| 141 |
final_answer = get_final_answer(question, str(initial_answer))
|
| 142 |
+
|
| 143 |
+
print(f"Question: {question}")
|
| 144 |
+
print(f"Initial answer: {initial_answer}")
|
| 145 |
print(f"Final answer: {final_answer}")
|
| 146 |
|
| 147 |
return final_answer
|