samim2024 commited on
Commit
45bc115
·
verified ·
1 Parent(s): 943d943

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,7 +1,9 @@
1
  import streamlit as st
2
  from streamlit_chat import message
3
  # from langchain.llms import OpenAI #This import has been replaced by the below import please
4
- from langchain_openai import OpenAI
 
 
5
  from langchain.chains import ConversationChain
6
  from langchain.chains.conversation.memory import (ConversationBufferMemory,
7
  ConversationSummaryMemory,
@@ -35,10 +37,10 @@ def getresponse(userInput, api_key):
35
 
36
  if st.session_state['conversation'] is None:
37
 
38
- llm = OpenAI(
39
  temperature=0,
40
- openai_api_key=api_key,
41
- model_name='gpt-3.5-turbo-instruct' # 'text-davinci-003' model is depreciated now, so we are using the openai's recommended model
42
  )
43
 
44
  st.session_state['conversation'] = ConversationChain(
 
1
  import streamlit as st
2
  from streamlit_chat import message
3
  # from langchain.llms import OpenAI #This import has been replaced by the below import please
4
+ #from langchain_openai import OpenAI
5
+ from langchain_community.llms import HuggingFaceEndpoint
6
+
7
  from langchain.chains import ConversationChain
8
  from langchain.chains.conversation.memory import (ConversationBufferMemory,
9
  ConversationSummaryMemory,
 
37
 
38
  if st.session_state['conversation'] is None:
39
 
40
+ llm = HuggingFaceEndpoint(
41
  temperature=0,
42
+ token=api_key,
43
+ repo_id="mistralai/Mistral-7B-Instruct-v0.2" # 'text-davinci-003' model is depreciated now, so we are using the openai's recommended model
44
  )
45
 
46
  st.session_state['conversation'] = ConversationChain(