Update app.py
Browse files
app.py
CHANGED
|
@@ -67,7 +67,7 @@ with st.sidebar:
|
|
| 67 |
# Store LLM generated responses
|
| 68 |
if "messages" not in st.session_state:
|
| 69 |
st.session_state.chain = init_chain()
|
| 70 |
-
st.session_state.messages = [{"role": "assistant", "content": "How may I
|
| 71 |
st.session_state.query_counter = 0 # Track the number of user queries
|
| 72 |
st.session_state.conversation_history = "" # Keep track of history for the LLM
|
| 73 |
|
|
@@ -79,6 +79,12 @@ def generate_response(prompt_input):
|
|
| 79 |
|
| 80 |
# Format the input for the chain with the retrieved context
|
| 81 |
formatted_input = (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
f"Context:\n"
|
| 83 |
f"{' '.join([doc.page_content for doc in relevant_context])}\n\n"
|
| 84 |
f"Conversation:\n{st.session_state.conversation_history}user: {prompt_input}\n"
|
|
|
|
| 67 |
# Store LLM generated responses
|
| 68 |
if "messages" not in st.session_state:
|
| 69 |
st.session_state.chain = init_chain()
|
| 70 |
+
st.session_state.messages = [{"role": "assistant", "content": "Hello! I am your Conversational Agent for the Citizens Charter of Camarines Sur Polytechnic Colleges (CSPC). How may I assist you today?"}]
|
| 71 |
st.session_state.query_counter = 0 # Track the number of user queries
|
| 72 |
st.session_state.conversation_history = "" # Keep track of history for the LLM
|
| 73 |
|
|
|
|
| 79 |
|
| 80 |
# Format the input for the chain with the retrieved context
|
| 81 |
formatted_input = (
|
| 82 |
+
f"You are a Conversational Agent for the Citizens Charter of Camarines Sur Polytechnic Colleges (CSPC). "
|
| 83 |
+
f"Your purpose is to provide accurate and helpful information about CSPC's policies, procedures, and services as outlined in the Citizens Charter. "
|
| 84 |
+
f"When responding to user queries:\n"
|
| 85 |
+
f"1. Always prioritize information from the provided context (Citizens Charter or other CSPC resources).\n"
|
| 86 |
+
f"2. Be concise, clear, and professional in your responses.\n"
|
| 87 |
+
f"3. If the user's question is outside the scope of the Citizens Charter, politely inform them and suggest relevant resources or departments they can contact.\n\n"
|
| 88 |
f"Context:\n"
|
| 89 |
f"{' '.join([doc.page_content for doc in relevant_context])}\n\n"
|
| 90 |
f"Conversation:\n{st.session_state.conversation_history}user: {prompt_input}\n"
|