Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 =
|
39 |
temperature=0,
|
40 |
-
|
41 |
-
|
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(
|