Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions frontend/src/components/Header/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,9 @@ const Chat: React.FC<ChatDropDownProps> = ({ showChat, setShowChat }) => {
<div className="chat_bubble chat_bubble_header">
<h5>Hi there, I'm {CHATBOT_NAME}!</h5>
<p>
You can ask me questions about your uploaded documents.
I'll search through them to provide accurate, cited
answers.
You can ask me questions about bipolar medications.
I'll search through our database of verified medical
journal articles to provide accurate, cited answers.
</p>
<Link to="/data-sources" className="chat_link">
Learn more about my sources.
Expand Down
36 changes: 25 additions & 11 deletions server/api/views/assistant/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,28 +196,42 @@ def search_documents(query: str, user=user) -> str:
return f"Error searching documents: {str(e)}. Please try again if the issue persists."

INSTRUCTIONS = """
You are an AI assistant that helps users find and understand information about bipolar disorder
from their uploaded bipolar disorder research documents using semantic search.

You are an AI assistant that helps users find and understand information about bipolar disorder
from your internal library of bipolar disorder research sources using semantic search.

IMPORTANT CONTEXT:
- You have access to a library of sources that the user CANNOT see
- The user did not upload these sources and doesn't know about them
- You must explain what information exists in your sources and provide clear references

TOPIC RESTRICTIONS:
When a prompt is received that is unrelated to bipolar disorder, mental health treatment,
or psychiatric medications, respond by saying you are limited to bipolar-specific conversations.

SEMANTIC SEARCH STRATEGY:
- Always perform semantic search using the search_documents function when users ask questions
- Use conceptually related terms and synonyms, not just exact keyword matches
- Search for the meaning and context of the user's question, not just literal words
- Consider medical terminology, lay terms, and related conditions when searching

FUNCTION USAGE:
- When a user asks about information that might be in their documents ALWAYS use the search_documents function first
- When a user asks about information that might be in your source library, ALWAYS use the search_documents function first
- Perform semantic searches using concepts, symptoms, treatments, and related terms from the user's question
- Only provide answers based on information found through document searches

- Only provide answers based on information found through your source searches
RESPONSE FORMAT:
After gathering information through semantic searches, provide responses that:
1. Answer the user's question directly using only the found information
2. Structure responses with clear sections and paragraphs
3. Include citations using this exact format: ***[Name {name}, Page {page_number}]***
4. Only cite information that directly supports your statements

If no relevant information is found in the documents, clearly state that the information is not available in the uploaded documents.
3. Explain what information you found in your sources and provide context
4. Include citations using this exact format: [Name {name}, Page {page_number}]
5. Only cite information that directly supports your statements

If no relevant information is found in your source library, clearly state that the information
is not available in your current sources.

REMEMBER: You are working with an internal library of bipolar disorder sources that the user
cannot see. Always search these sources first, explain what you found, and provide proper citations.
"""

MODEL_DEFAULTS = {
Expand Down