Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -70,8 +70,12 @@ embeddings = OpenAIEmbeddings(
|
|
70 |
from langchain_openai import ChatOpenAI
|
71 |
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
72 |
|
|
|
|
|
|
|
|
|
73 |
llm = ChatOpenAI(
|
74 |
-
model="gpt-4o-mini",
|
75 |
temperature=0,
|
76 |
max_tokens=None,
|
77 |
timeout=None,
|
@@ -82,18 +86,26 @@ llm = ChatOpenAI(
|
|
82 |
# other params...
|
83 |
)
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
default_system_prompt = """
|
86 |
-
You are a
|
87 |
-
Your role is select the best answer for queries related to medical information.
|
88 |
-
YOU WILL ALWAYS ANSWER FROM THE CONTEXT PROVIDED. If answer is not provided, politely say that you are not aware of the answer.
|
89 |
"""
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
Your role is provide the best answer for queries related to medical information.
|
94 |
-
YOU WILL ALWAYS ANSWER FROM THE CONTEXT PROVIDED. If answer is not provided, politely say that you are not aware of the answer.
|
95 |
"""
|
96 |
-
#- Keep answers short and direct.
|
97 |
|
98 |
# Function to ingest PDFs from the directory
|
99 |
def data_ingestion():
|
|
|
70 |
from langchain_openai import ChatOpenAI
|
71 |
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
72 |
|
73 |
+
|
74 |
+
model_options = ["gpt-4o", "gpt-4o-mini"]
|
75 |
+
selected_model = st.selectbox("Choose a GPT model", model_options)
|
76 |
+
|
77 |
llm = ChatOpenAI(
|
78 |
+
model=selected_model,#"gpt-4o-mini",
|
79 |
temperature=0,
|
80 |
max_tokens=None,
|
81 |
timeout=None,
|
|
|
86 |
# other params...
|
87 |
)
|
88 |
|
89 |
+
# default_system_prompt = """
|
90 |
+
# You are a helpful and knowledgeable assistant who is expert on medical question answering.
|
91 |
+
# Your role is select the best answer for queries related to medical information.
|
92 |
+
# YOU WILL ALWAYS ANSWER FROM THE CONTEXT PROVIDED. If answer is not provided, politely say that you are not aware of the answer.
|
93 |
+
# """
|
94 |
+
|
95 |
+
|
96 |
+
# knowledge_base_prompt = """You have been provided with medical notes and books.
|
97 |
+
# Your role is provide the best answer for queries related to medical information.
|
98 |
+
# YOU WILL ALWAYS ANSWER FROM THE CONTEXT PROVIDED. If answer is not provided, politely say that you are not aware of the answer.
|
99 |
+
# """
|
100 |
+
#- Keep answers short and direct.
|
101 |
+
|
102 |
default_system_prompt = """
|
103 |
+
You are a friendly and knowledgeable assistant who is an expert in medical education, particularly for USMLE and NEET PG students. When a multiple-choice question (MCQ) is asked, your role is to select the best answer and explain the entire concept thoroughly, helping students gain a deep understanding. You should also explain why the other options are not correct, encouraging logical thinking in approaching the question. Use a tone that is engaging and relatable to students, so they enjoy learning from you. If needed, you may reference standard textbooks or verified medical sources from your database to provide accurate information. YOU WILL ALWAYS ANSWER FROM THE CONTEXT PROVIDED. If the answer is not provided, politely say that you are not aware of the answer.
|
|
|
|
|
104 |
"""
|
105 |
|
106 |
+
knowledge_base_prompt = """
|
107 |
+
You have been provided with medical notes and books focused on content relevant to USMLE and NEET PG examinations. When a multiple-choice question (MCQ) is asked, your role is to provide the best answer and explain the whole concept in detail, so students can understand it well. Also, explain why the other options are not correct, and encourage logical thinking in solving the question. Use a friendly tone that students love, making the learning experience enjoyable. If needed, you may use data from standard textbooks or verified medical sources from your database to provide accurate and comprehensive explanations. YOU WILL ALWAYS ANSWER FROM THE CONTEXT PROVIDED. If the answer is not provided, politely say that you are not aware of the answer.
|
|
|
|
|
108 |
"""
|
|
|
109 |
|
110 |
# Function to ingest PDFs from the directory
|
111 |
def data_ingestion():
|