fixed a proplem
Browse files- app/llm.py +20 -19
app/llm.py
CHANGED
|
@@ -78,24 +78,25 @@ class LLMProcessor:
|
|
| 78 |
|
| 79 |
|
| 80 |
def get_medica_bot_system_instruction(self,rag_context_for_query=None):
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
|
|
|
| 99 |
You are "Medica_Bot", a highly knowledgeable, empathetic, and precise AI assistant. Your sole specialization is providing comprehensive information about cancer. Your primary purpose is to educate users, answer their questions clearly, and help them understand complex cancer-related topics. **Unless the user asks for a detailed explanation, aim for concise, direct answers that get straight to the point.**
|
| 100 |
|
| 101 |
**Core Knowledge & Information Source:**
|
|
@@ -158,7 +159,7 @@ class LLMProcessor:
|
|
| 158 |
|
| 159 |
Remember, your goal is to be a trusted, accurate, and supportive source of cancer information, empowering users with knowledge efficiently, while always guiding them towards professional medical consultation.
|
| 160 |
"""
|
| 161 |
-
|
| 162 |
def call_gemini_llm(self, model, message,rag_context_for_query, token_limit=300, temperature=0.7):
|
| 163 |
"""
|
| 164 |
Call the Google Gemini LLM API with a token limit and temperature.
|
|
|
|
| 78 |
|
| 79 |
|
| 80 |
def get_medica_bot_system_instruction(self,rag_context_for_query=None):
|
| 81 |
+
"""
|
| 82 |
+
Generates the system instruction for Medica_Bot.
|
| 83 |
+
|
| 84 |
+
Args:
|
| 85 |
+
rag_context_for_query (str, optional): Relevant context retrieved
|
| 86 |
+
from the RAG system for the current query.
|
| 87 |
+
Defaults to None.
|
| 88 |
+
Returns:
|
| 89 |
+
str: The complete system instruction string.
|
| 90 |
+
"""
|
| 91 |
+
|
| 92 |
+
# Determine the context string to embed
|
| 93 |
+
if rag_context_for_query:
|
| 94 |
+
context_section = f"# {rag_context_for_query}"
|
| 95 |
+
else:
|
| 96 |
+
context_section = "# No specific context provided for this query. Rely on general knowledge if appropriate for greetings or very broad capability questions."
|
| 97 |
+
|
| 98 |
+
sys_instruct =
|
| 99 |
+
f"""
|
| 100 |
You are "Medica_Bot", a highly knowledgeable, empathetic, and precise AI assistant. Your sole specialization is providing comprehensive information about cancer. Your primary purpose is to educate users, answer their questions clearly, and help them understand complex cancer-related topics. **Unless the user asks for a detailed explanation, aim for concise, direct answers that get straight to the point.**
|
| 101 |
|
| 102 |
**Core Knowledge & Information Source:**
|
|
|
|
| 159 |
|
| 160 |
Remember, your goal is to be a trusted, accurate, and supportive source of cancer information, empowering users with knowledge efficiently, while always guiding them towards professional medical consultation.
|
| 161 |
"""
|
| 162 |
+
return sys_instruct
|
| 163 |
def call_gemini_llm(self, model, message,rag_context_for_query, token_limit=300, temperature=0.7):
|
| 164 |
"""
|
| 165 |
Call the Google Gemini LLM API with a token limit and temperature.
|