Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,8 +63,8 @@ def main():
|
|
| 63 |
"""
|
| 64 |
|
| 65 |
# Create the Pandas Agent with enhanced error handling
|
| 66 |
-
# Fix:
|
| 67 |
-
#
|
| 68 |
agent = create_pandas_dataframe_agent(
|
| 69 |
llm,
|
| 70 |
df,
|
|
@@ -72,10 +72,9 @@ def main():
|
|
| 72 |
agent_type="zero-shot-react-description",
|
| 73 |
allow_dangerous_code=True,
|
| 74 |
prefix=custom_prefix,
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
}
|
| 79 |
)
|
| 80 |
|
| 81 |
# --- 4. EXECUTION ---
|
|
|
|
| 63 |
"""
|
| 64 |
|
| 65 |
# Create the Pandas Agent with enhanced error handling
|
| 66 |
+
# Fix: Pass 'handle_parsing_errors' directly and avoid passing 'max_iterations'
|
| 67 |
+
# inside agent_executor_kwargs if it conflicts with the toolkit's defaults.
|
| 68 |
agent = create_pandas_dataframe_agent(
|
| 69 |
llm,
|
| 70 |
df,
|
|
|
|
| 72 |
agent_type="zero-shot-react-description",
|
| 73 |
allow_dangerous_code=True,
|
| 74 |
prefix=custom_prefix,
|
| 75 |
+
handle_parsing_errors=True,
|
| 76 |
+
# We omit agent_executor_kwargs here to resolve the TypeError
|
| 77 |
+
# as the function already handles execution parameters internally.
|
|
|
|
| 78 |
)
|
| 79 |
|
| 80 |
# --- 4. EXECUTION ---
|