themeetjani commited on
Commit
8fc65e7
1 Parent(s): 68ed3e8

Update pages/AI_Chatbot.py

Browse files
Files changed (1) hide show
  1. pages/AI_Chatbot.py +3 -4
pages/AI_Chatbot.py CHANGED
@@ -1,10 +1,9 @@
1
- from openai import OpenAI
2
  import streamlit as st
 
3
 
4
  st.title("ChatGPT-like clone")
5
 
6
- client = OpenAI(api_key=st.secrets["OPENAI_API_KEY"])
7
-
8
  if "openai_model" not in st.session_state:
9
  st.session_state["openai_model"] = "gpt-3.5-turbo"
10
 
@@ -21,7 +20,7 @@ if prompt := st.chat_input("What is up?"):
21
  st.markdown(prompt)
22
 
23
  with st.chat_message("assistant"):
24
- stream = client.chat.completions.create(
25
  model=st.session_state["openai_model"],
26
  messages=[
27
  {"role": m["role"], "content": m["content"]}
 
1
+ import openai
2
  import streamlit as st
3
+ openai.api_key = os.getenv("OPENAI_API_KEY")
4
 
5
  st.title("ChatGPT-like clone")
6
 
 
 
7
  if "openai_model" not in st.session_state:
8
  st.session_state["openai_model"] = "gpt-3.5-turbo"
9
 
 
20
  st.markdown(prompt)
21
 
22
  with st.chat_message("assistant"):
23
+ stream = openai.chat.completions.create(
24
  model=st.session_state["openai_model"],
25
  messages=[
26
  {"role": m["role"], "content": m["content"]}