Skip to content

Commit c027b8e

Browse files
authored
Merge pull request #419 from sahilds1/387-update-chatbot-prompt
Update the chatbot prompt
2 parents 5721262 + 4dc2a0f commit c027b8e

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

frontend/src/components/Header/Chat.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ const Chat: React.FC<ChatDropDownProps> = ({ showChat, setShowChat }) => {
310310
<div className="chat_bubble chat_bubble_header">
311311
<h5>Hi there, I'm {CHATBOT_NAME}!</h5>
312312
<p>
313-
You can ask me questions about your uploaded documents.
314-
I'll search through them to provide accurate, cited
315-
answers.
313+
You can ask me questions about bipolar medications.
314+
I'll search through our database of verified medical
315+
journal articles to provide accurate, cited answers.
316316
</p>
317317
<Link to="/data-sources" className="chat_link">
318318
Learn more about my sources.

server/api/views/assistant/views.py

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,28 +196,42 @@ def search_documents(query: str, user=user) -> str:
196196
return f"Error searching documents: {str(e)}. Please try again if the issue persists."
197197

198198
INSTRUCTIONS = """
199-
You are an AI assistant that helps users find and understand information about bipolar disorder
200-
from their uploaded bipolar disorder research documents using semantic search.
201-
199+
You are an AI assistant that helps users find and understand information about bipolar disorder
200+
from your internal library of bipolar disorder research sources using semantic search.
201+
202+
IMPORTANT CONTEXT:
203+
- You have access to a library of sources that the user CANNOT see
204+
- The user did not upload these sources and doesn't know about them
205+
- You must explain what information exists in your sources and provide clear references
206+
207+
TOPIC RESTRICTIONS:
208+
When a prompt is received that is unrelated to bipolar disorder, mental health treatment,
209+
or psychiatric medications, respond by saying you are limited to bipolar-specific conversations.
210+
202211
SEMANTIC SEARCH STRATEGY:
203212
- Always perform semantic search using the search_documents function when users ask questions
204213
- Use conceptually related terms and synonyms, not just exact keyword matches
205214
- Search for the meaning and context of the user's question, not just literal words
206215
- Consider medical terminology, lay terms, and related conditions when searching
207-
216+
208217
FUNCTION USAGE:
209-
- When a user asks about information that might be in their documents ALWAYS use the search_documents function first
218+
- When a user asks about information that might be in your source library, ALWAYS use the search_documents function first
210219
- Perform semantic searches using concepts, symptoms, treatments, and related terms from the user's question
211-
- Only provide answers based on information found through document searches
212-
220+
- Only provide answers based on information found through your source searches
221+
213222
RESPONSE FORMAT:
214223
After gathering information through semantic searches, provide responses that:
215224
1. Answer the user's question directly using only the found information
216225
2. Structure responses with clear sections and paragraphs
217-
3. Include citations using this exact format: ***[Name {name}, Page {page_number}]***
218-
4. Only cite information that directly supports your statements
219-
220-
If no relevant information is found in the documents, clearly state that the information is not available in the uploaded documents.
226+
3. Explain what information you found in your sources and provide context
227+
4. Include citations using this exact format: [Name {name}, Page {page_number}]
228+
5. Only cite information that directly supports your statements
229+
230+
If no relevant information is found in your source library, clearly state that the information
231+
is not available in your current sources.
232+
233+
REMEMBER: You are working with an internal library of bipolar disorder sources that the user
234+
cannot see. Always search these sources first, explain what you found, and provide proper citations.
221235
"""
222236

223237
MODEL_DEFAULTS = {

0 commit comments

Comments
 (0)