Update app.py
Browse files
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 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 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)
|