Spaces:
Configuration error
Configuration error
Update crew.py
Browse files
crew.py
CHANGED
|
@@ -193,14 +193,17 @@ def run_crew(question, file_path):
|
|
| 193 |
Raises:
|
| 194 |
RuntimeError: If processing fails"""
|
| 195 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
if file_path:
|
| 197 |
df = read_file(file_path)
|
| 198 |
question = f"Question:\n{question}\nData:\n{df.to_string()}"
|
|
|
|
| 199 |
|
| 200 |
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
|
| 201 |
|
| 202 |
-
file = client.files.upload(file=file_path)
|
| 203 |
-
|
| 204 |
response = client.models.generate_content(
|
| 205 |
model=CODE_GENERATION_MODEL,
|
| 206 |
contents=[question],
|
|
@@ -310,7 +313,7 @@ def run_crew(question, file_path):
|
|
| 310 |
backstory="As an expert Python code generation assistant, you generate and execute code to help answer the question.",
|
| 311 |
allow_delegation=False,
|
| 312 |
llm=AGENT_MODEL,
|
| 313 |
-
max_iter=
|
| 314 |
tools=[code_execution_tool],
|
| 315 |
verbose=False
|
| 316 |
)
|
|
@@ -321,7 +324,7 @@ def run_crew(question, file_path):
|
|
| 321 |
backstory="As an expert Python code execution assistant, you execute the code file to help answer the question.",
|
| 322 |
allow_delegation=False,
|
| 323 |
llm=AGENT_MODEL,
|
| 324 |
-
max_iter=
|
| 325 |
tools=[code_execution_tool],
|
| 326 |
verbose=False
|
| 327 |
)
|
|
|
|
| 193 |
Raises:
|
| 194 |
RuntimeError: If processing fails"""
|
| 195 |
try:
|
| 196 |
+
print("###")
|
| 197 |
+
print(question)
|
| 198 |
+
print(file_path)
|
| 199 |
+
print("###")
|
| 200 |
if file_path:
|
| 201 |
df = read_file(file_path)
|
| 202 |
question = f"Question:\n{question}\nData:\n{df.to_string()}"
|
| 203 |
+
print(question)
|
| 204 |
|
| 205 |
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
|
| 206 |
|
|
|
|
|
|
|
| 207 |
response = client.models.generate_content(
|
| 208 |
model=CODE_GENERATION_MODEL,
|
| 209 |
contents=[question],
|
|
|
|
| 313 |
backstory="As an expert Python code generation assistant, you generate and execute code to help answer the question.",
|
| 314 |
allow_delegation=False,
|
| 315 |
llm=AGENT_MODEL,
|
| 316 |
+
max_iter=2,
|
| 317 |
tools=[code_execution_tool],
|
| 318 |
verbose=False
|
| 319 |
)
|
|
|
|
| 324 |
backstory="As an expert Python code execution assistant, you execute the code file to help answer the question.",
|
| 325 |
allow_delegation=False,
|
| 326 |
llm=AGENT_MODEL,
|
| 327 |
+
max_iter=2,
|
| 328 |
tools=[code_execution_tool],
|
| 329 |
verbose=False
|
| 330 |
)
|