Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ def get_vectorstore_from_url(url):
|
|
| 32 |
return vector_store
|
| 33 |
|
| 34 |
def get_context_retriever_chain(vector_store):
|
| 35 |
-
llm = HuggingFaceHub(repo_id = "
|
| 36 |
retriever = vector_store.as_retriever()
|
| 37 |
|
| 38 |
prompt = ChatPromptTemplate.from_messages([
|
|
@@ -46,7 +46,7 @@ def get_context_retriever_chain(vector_store):
|
|
| 46 |
return retriever_chain
|
| 47 |
|
| 48 |
def get_conversational_rag_chain(retriever_chain):
|
| 49 |
-
llm = HuggingFaceHub(repo_id = "
|
| 50 |
|
| 51 |
prompt = ChatPromptTemplate.from_messages([
|
| 52 |
("system", "Answer the user's questions based on the below context:\n\n{context}"),
|
|
@@ -67,8 +67,7 @@ def get_response(user_input):
|
|
| 67 |
"input": user_input
|
| 68 |
})
|
| 69 |
|
| 70 |
-
|
| 71 |
-
return response
|
| 72 |
|
| 73 |
# app config
|
| 74 |
st.set_page_config(page_title="Chat with websites", page_icon="🤖")
|
|
|
|
| 32 |
return vector_store
|
| 33 |
|
| 34 |
def get_context_retriever_chain(vector_store):
|
| 35 |
+
llm = HuggingFaceHub(repo_id = "meta-llama/Meta-Llama-3-8B", model_kwargs = {"temperature":0.5, "max_length":512})
|
| 36 |
retriever = vector_store.as_retriever()
|
| 37 |
|
| 38 |
prompt = ChatPromptTemplate.from_messages([
|
|
|
|
| 46 |
return retriever_chain
|
| 47 |
|
| 48 |
def get_conversational_rag_chain(retriever_chain):
|
| 49 |
+
llm = HuggingFaceHub(repo_id = "meta-llama/Meta-Llama-3-8B", model_kwargs = {"temperature":0.5, "max_length":512})
|
| 50 |
|
| 51 |
prompt = ChatPromptTemplate.from_messages([
|
| 52 |
("system", "Answer the user's questions based on the below context:\n\n{context}"),
|
|
|
|
| 67 |
"input": user_input
|
| 68 |
})
|
| 69 |
|
| 70 |
+
return response['answer']
|
|
|
|
| 71 |
|
| 72 |
# app config
|
| 73 |
st.set_page_config(page_title="Chat with websites", page_icon="🤖")
|