lorentz commited on
Commit
0ba97f2
·
verified ·
1 Parent(s): 8b2f146

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -25,9 +25,9 @@ ChatMate is an advanced conversational AI interface, expertly crafted to demonst
25
  ChatMate is developed by Lorentz Yeung
26
  """, unsafe_allow_html=True)
27
 
28
- if 'API_Key' not in st.session_state:
29
- st.session_state['API_Key'] =''
30
- st.session_state['API_Key']= st.text_input("First, to get it work, put your OpenAI API Key here please, the system will enter for you automatically.",type="password")
31
 
32
 
33
  # uploaded_file = st.sidebar.file_uploader("upload", type="csv")
@@ -36,13 +36,13 @@ persist_directory = "chroma/db"
36
 
37
 
38
  if persist_directory :
39
- embeddings = OpenAIEmbeddings(openai_api_key=st.session_state['API_Key'])
40
 
41
  KaggleX_courses_db = Chroma(persist_directory = persist_directory, embedding_function=embeddings)
42
  retriever = KaggleX_courses_db.as_retriever() # search_kwargs={"k": 4}
43
 
44
  chain = ConversationalRetrievalChain.from_llm(llm = ChatOpenAI(temperature=0.0,model_name='gpt-3.5-turbo',
45
- openai_api_key=st.session_state['API_Key']),
46
  retriever = retriever)
47
 
48
  def conversational_chat(query):
 
25
  ChatMate is developed by Lorentz Yeung
26
  """, unsafe_allow_html=True)
27
 
28
+ #if 'API_Key' not in st.session_state:
29
+ # st.session_state['API_Key'] =''
30
+ #st.session_state['API_Key']= st.text_input("First, to get it work, put your OpenAI API Key here please, the system will enter for you automatically.",type="password")
31
 
32
 
33
  # uploaded_file = st.sidebar.file_uploader("upload", type="csv")
 
36
 
37
 
38
  if persist_directory :
39
+ embeddings = OpenAIEmbeddings()
40
 
41
  KaggleX_courses_db = Chroma(persist_directory = persist_directory, embedding_function=embeddings)
42
  retriever = KaggleX_courses_db.as_retriever() # search_kwargs={"k": 4}
43
 
44
  chain = ConversationalRetrievalChain.from_llm(llm = ChatOpenAI(temperature=0.0,model_name='gpt-3.5-turbo',
45
+ ),
46
  retriever = retriever)
47
 
48
  def conversational_chat(query):