Seth0330 commited on
Commit
6a9dd45
·
verified ·
1 Parent(s): b22ffb2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -106,14 +106,18 @@ if "temp_input" not in st.session_state:
106
  if df is not None:
107
  columns = ", ".join(df.columns)
108
  system_message = {
109
- "role": "system",
110
- "content": (
111
- f"You are an AI agent helping users analyze a CSV file with these columns: {columns}. "
112
- "If you need to search or filter the CSV, call the 'search_csv' function. "
113
- "If the user wants to know how many unique values are in a column, call the 'count_unique' function. "
114
- "If you use 'search_csv', use Pandas query syntax."
115
- ),
116
- }
 
 
 
 
117
  # Ensure the system message is always at the start and up-to-date
118
  if not st.session_state.messages or st.session_state.messages[0]["role"] != "system":
119
  st.session_state.messages.insert(0, system_message)
 
106
  if df is not None:
107
  columns = ", ".join(df.columns)
108
  system_message = {
109
+ "role": "system",
110
+ "content": (
111
+ f"You are an AI data analyst for a CSV file with these columns: {columns}. "
112
+ "When the user asks a question, always use the most relevant function to get the answer directly. "
113
+ "Do not describe your plan or reasoning steps. Do not ask the user for clarification. "
114
+ "Just call the function needed and give the answer, as briefly as possible. "
115
+ "If you need to search or filter the CSV, use the 'search_csv' function. "
116
+ "If you need to count unique values, use the 'count_unique' function. "
117
+ "If you use 'search_csv', use Pandas query syntax."
118
+ ),
119
+ }
120
+
121
  # Ensure the system message is always at the start and up-to-date
122
  if not st.session_state.messages or st.session_state.messages[0]["role"] != "system":
123
  st.session_state.messages.insert(0, system_message)