arithescientist commited on
Commit
865d538
·
verified ·
1 Parent(s): b6f0b52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -60,7 +60,7 @@ agent_executor = create_sql_agent(
60
  llm=llm,
61
  toolkit=toolkit,
62
  verbose=True,
63
- return_intermediate_steps=True
64
  )
65
 
66
  # Step 4: Define the callback function
@@ -74,7 +74,10 @@ def process_input():
74
 
75
  # Use the agent to get the response
76
  with st.spinner("Processing..."):
77
- response = agent_executor(user_prompt)
 
 
 
78
 
79
  # Extract the final answer and the data from intermediate steps
80
  final_answer = response['output']
@@ -93,7 +96,7 @@ def process_input():
93
  # Convert the result to a DataFrame for better formatting
94
  if sql_result:
95
  # Adjust the column names based on your query
96
- df_result = pd.DataFrame(sql_result, columns=['Region', 'Total_Sales'])
97
  sql_result_formatted = df_result.to_markdown(index=False)
98
  else:
99
  sql_result_formatted = "No results found."
 
60
  llm=llm,
61
  toolkit=toolkit,
62
  verbose=True,
63
+ agent_executor_kwargs={"return_intermediate_steps": True}
64
  )
65
 
66
  # Step 4: Define the callback function
 
74
 
75
  # Use the agent to get the response
76
  with st.spinner("Processing..."):
77
+ response = agent_executor(user_prompt, return_intermediate_steps=True)
78
+
79
+ # Log the response keys for debugging
80
+ logging.info(f"Response keys: {response.keys()}")
81
 
82
  # Extract the final answer and the data from intermediate steps
83
  final_answer = response['output']
 
96
  # Convert the result to a DataFrame for better formatting
97
  if sql_result:
98
  # Adjust the column names based on your query
99
+ df_result = pd.DataFrame(sql_result)
100
  sql_result_formatted = df_result.to_markdown(index=False)
101
  else:
102
  sql_result_formatted = "No results found."