Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -71,20 +71,20 @@ 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 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
)
|
| 88 |
|
| 89 |
# default_system_prompt = """
|
| 90 |
# You are a helpful and knowledgeable assistant who is expert on medical question answering.
|
|
@@ -267,6 +267,7 @@ def main():
|
|
| 267 |
page_title="Medical Chatbot",
|
| 268 |
page_icon=favicon_image,
|
| 269 |
)
|
|
|
|
| 270 |
# Create two columns for the logo and title text
|
| 271 |
col1, col2 = st.columns([1, 8]) # Adjust the column width ratios as needed
|
| 272 |
|
|
@@ -316,6 +317,20 @@ def main():
|
|
| 316 |
|
| 317 |
|
| 318 |
user_question = st.chat_input("Ask a Question")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
|
| 320 |
# Initialize or load chat history into session state
|
| 321 |
if "messages" not in st.session_state:
|
|
|
|
| 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,
|
| 82 |
+
# max_retries=2,
|
| 83 |
+
# api_key=os.getenv("OPENAI_API_KEY"), # if you prefer to pass api key in directly instaed of using env vars
|
| 84 |
+
# # base_url="...",
|
| 85 |
+
# # organization="...",
|
| 86 |
+
# # other params...
|
| 87 |
+
# )
|
| 88 |
|
| 89 |
# default_system_prompt = """
|
| 90 |
# You are a helpful and knowledgeable assistant who is expert on medical question answering.
|
|
|
|
| 267 |
page_title="Medical Chatbot",
|
| 268 |
page_icon=favicon_image,
|
| 269 |
)
|
| 270 |
+
|
| 271 |
# Create two columns for the logo and title text
|
| 272 |
col1, col2 = st.columns([1, 8]) # Adjust the column width ratios as needed
|
| 273 |
|
|
|
|
| 317 |
|
| 318 |
|
| 319 |
user_question = st.chat_input("Ask a Question")
|
| 320 |
+
model_options = ["gpt-4o", "gpt-4o-mini"]
|
| 321 |
+
selected_model = st.selectbox("Choose a GPT model", model_options)
|
| 322 |
+
|
| 323 |
+
llm = ChatOpenAI(
|
| 324 |
+
model=selected_model,#"gpt-4o-mini",
|
| 325 |
+
temperature=0,
|
| 326 |
+
max_tokens=None,
|
| 327 |
+
timeout=None,
|
| 328 |
+
max_retries=2,
|
| 329 |
+
api_key=os.getenv("OPENAI_API_KEY"), # if you prefer to pass api key in directly instaed of using env vars
|
| 330 |
+
# base_url="...",
|
| 331 |
+
# organization="...",
|
| 332 |
+
# other params...
|
| 333 |
+
)
|
| 334 |
|
| 335 |
# Initialize or load chat history into session state
|
| 336 |
if "messages" not in st.session_state:
|