Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,7 +51,7 @@ def format_docs(docs):
|
|
| 51 |
retriever = vectorstore.as_retriever()
|
| 52 |
|
| 53 |
prompt = hub.pull("rlm/rag-prompt")
|
| 54 |
-
llm = HuggingFaceEndpoint(repo_id="mistralai/
|
| 55 |
rag_chain = (
|
| 56 |
{"context": retriever | format_docs, "question": RunnablePassthrough()}
|
| 57 |
| prompt
|
|
@@ -77,10 +77,8 @@ history_aware_retriever = create_history_aware_retriever(
|
|
| 77 |
|
| 78 |
|
| 79 |
### Answer question ###
|
| 80 |
-
qa_system_prompt = """
|
| 81 |
-
|
| 82 |
-
If you don't know the answer, just say that you don't know. Only use data from the context.
|
| 83 |
-
|
| 84 |
Use markdown with spaces in between sentences for readability.
|
| 85 |
|
| 86 |
{context}"""
|
|
@@ -138,7 +136,7 @@ async def echo(websocket):
|
|
| 138 |
while response.startswith("\n"):
|
| 139 |
response = response[1:]
|
| 140 |
await websocket.send(json.dumps({"response": response}))
|
| 141 |
-
print(
|
| 142 |
|
| 143 |
async def main():
|
| 144 |
async with serve(echo, "0.0.0.0", 7860):
|
|
|
|
| 51 |
retriever = vectorstore.as_retriever()
|
| 52 |
|
| 53 |
prompt = hub.pull("rlm/rag-prompt")
|
| 54 |
+
llm = HuggingFaceEndpoint(repo_id="mistralai/Mistral-7B-Instruct-v0.3")
|
| 55 |
rag_chain = (
|
| 56 |
{"context": retriever | format_docs, "question": RunnablePassthrough()}
|
| 57 |
| prompt
|
|
|
|
| 77 |
|
| 78 |
|
| 79 |
### Answer question ###
|
| 80 |
+
qa_system_prompt = """Use the following pieces of retrieved context to answer the question.
|
| 81 |
+
If you don't know the answer, just say that you don't know. Only use data from the context. Refer to the provided context only as my data
|
|
|
|
|
|
|
| 82 |
Use markdown with spaces in between sentences for readability.
|
| 83 |
|
| 84 |
{context}"""
|
|
|
|
| 136 |
while response.startswith("\n"):
|
| 137 |
response = response[1:]
|
| 138 |
await websocket.send(json.dumps({"response": response}))
|
| 139 |
+
print(rawresponse)
|
| 140 |
|
| 141 |
async def main():
|
| 142 |
async with serve(echo, "0.0.0.0", 7860):
|