Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -317,10 +317,36 @@ def main():
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
# model=selected_model,#"gpt-4o-mini",
|
325 |
# temperature=0,
|
326 |
# max_tokens=None,
|
@@ -331,17 +357,6 @@ def main():
|
|
331 |
# # organization="...",
|
332 |
# # other params...
|
333 |
# )
|
334 |
-
llm = OpenAI(
|
335 |
-
model=selected_model,#"gpt-4o-mini",
|
336 |
-
temperature=0,
|
337 |
-
max_tokens=None,
|
338 |
-
timeout=None,
|
339 |
-
max_retries=2,
|
340 |
-
api_key=os.getenv("OPENAI_API_KEY"), # if you prefer to pass api key in directly instaed of using env vars
|
341 |
-
# base_url="...",
|
342 |
-
# organization="...",
|
343 |
-
# other params...
|
344 |
-
)
|
345 |
|
346 |
# Initialize or load chat history into session state
|
347 |
if "messages" not in st.session_state:
|
|
|
317 |
|
318 |
|
319 |
user_question = st.chat_input("Ask a Question")
|
320 |
+
model_options = ["gpt-4o", "gpt-4o-mini","deepseek-chat"]
|
321 |
selected_model = st.selectbox("Choose a GPT model", model_options)
|
322 |
+
|
323 |
+
if selected_model == "deepseek-chat":
|
324 |
|
325 |
+
llm = ChatOpenAI(
|
326 |
+
model=selected_model,#"gpt-4o-mini",
|
327 |
+
temperature=0,
|
328 |
+
max_tokens=None,
|
329 |
+
timeout=None,
|
330 |
+
max_retries=2,
|
331 |
+
api_key=os.getenv("DeepSeek_API_KEY"), # if you prefer to pass api key in directly instaed of using env vars
|
332 |
+
base_url="https://api.deepseek.com",
|
333 |
+
# organization="...",
|
334 |
+
# other params...
|
335 |
+
)
|
336 |
+
else:
|
337 |
+
llm = ChatOpenAI(
|
338 |
+
model=selected_model,#"gpt-4o-mini",
|
339 |
+
temperature=0,
|
340 |
+
max_tokens=None,
|
341 |
+
timeout=None,
|
342 |
+
max_retries=2,
|
343 |
+
api_key=os.getenv("OPENAI_API_KEY"), # if you prefer to pass api key in directly instaed of using env vars
|
344 |
+
# base_url="...",
|
345 |
+
# organization="...",
|
346 |
+
# other params...
|
347 |
+
)
|
348 |
+
|
349 |
+
# llm = OpenAI(
|
350 |
# model=selected_model,#"gpt-4o-mini",
|
351 |
# temperature=0,
|
352 |
# max_tokens=None,
|
|
|
357 |
# # organization="...",
|
358 |
# # other params...
|
359 |
# )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
|
361 |
# Initialize or load chat history into session state
|
362 |
if "messages" not in st.session_state:
|