Update crew.py
Browse files
crew.py
CHANGED
@@ -112,28 +112,18 @@ def run_crew(question, file_name):
|
|
112 |
verbose=True
|
113 |
)
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
if file_name.endswith(".py"):
|
118 |
-
with open(f"data/{file_name}", "r") as file:
|
119 |
-
file_data = file.read()
|
120 |
-
|
121 |
-
question = f"{question} File data:\n{file_data}"
|
122 |
-
else:
|
123 |
-
question = f"{question} File name: data/{file_name}."
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
128 |
|
|
|
129 |
initial_answer = crew.kickoff(inputs={"topic": question})
|
130 |
-
|
131 |
-
print("###")
|
132 |
print(f"Initial answer: {initial_answer}")
|
133 |
-
|
134 |
final_answer = get_final_answer(question, str(initial_answer))
|
135 |
-
|
136 |
print(f"Final answer: {final_answer}")
|
137 |
-
print("###")
|
138 |
|
139 |
return final_answer
|
|
|
112 |
verbose=True
|
113 |
)
|
114 |
|
115 |
+
# Processing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
+
if file_name:
|
118 |
+
question = f"{question} File name: data/{file_name}. "
|
119 |
+
if file_name.endswith(".py"):
|
120 |
+
with open(f"data/{file_name}", "r") as file:
|
121 |
+
question = f"{question} File data:\n{file.read()}"
|
122 |
|
123 |
+
print(f"Question: {question}")
|
124 |
initial_answer = crew.kickoff(inputs={"topic": question})
|
|
|
|
|
125 |
print(f"Initial answer: {initial_answer}")
|
|
|
126 |
final_answer = get_final_answer(question, str(initial_answer))
|
|
|
127 |
print(f"Final answer: {final_answer}")
|
|
|
128 |
|
129 |
return final_answer
|