Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,7 +49,7 @@ def main():
|
|
| 49 |
|
| 50 |
if st.button("Run Agent") and query:
|
| 51 |
llm = ChatGoogleGenerativeAI(
|
| 52 |
-
model="gemini-2.5-flash",
|
| 53 |
google_api_key=GEMINI_API_KEY,
|
| 54 |
temperature=0,
|
| 55 |
)
|
|
@@ -63,6 +63,8 @@ def main():
|
|
| 63 |
"""
|
| 64 |
|
| 65 |
# Create the Pandas Agent with enhanced error handling
|
|
|
|
|
|
|
| 66 |
agent = create_pandas_dataframe_agent(
|
| 67 |
llm,
|
| 68 |
df,
|
|
@@ -70,8 +72,6 @@ def main():
|
|
| 70 |
agent_type="zero-shot-react-description",
|
| 71 |
allow_dangerous_code=True,
|
| 72 |
prefix=custom_prefix,
|
| 73 |
-
# Pass handle_parsing_errors here AND in agent_executor_kwargs for maximum stability
|
| 74 |
-
handle_parsing_errors=True,
|
| 75 |
agent_executor_kwargs={
|
| 76 |
"handle_parsing_errors": True,
|
| 77 |
"max_iterations": 5
|
|
|
|
| 49 |
|
| 50 |
if st.button("Run Agent") and query:
|
| 51 |
llm = ChatGoogleGenerativeAI(
|
| 52 |
+
model="gemini-2.5-flash-preview-09-2025",
|
| 53 |
google_api_key=GEMINI_API_KEY,
|
| 54 |
temperature=0,
|
| 55 |
)
|
|
|
|
| 63 |
"""
|
| 64 |
|
| 65 |
# Create the Pandas Agent with enhanced error handling
|
| 66 |
+
# Fix: Removed redundant 'handle_parsing_errors' from top level to avoid conflicts
|
| 67 |
+
# with agent_executor_kwargs in some versions.
|
| 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 |
agent_executor_kwargs={
|
| 76 |
"handle_parsing_errors": True,
|
| 77 |
"max_iterations": 5
|