Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -48,9 +48,9 @@ vectorstore = Chroma.from_documents(documents=splits, embedding=embedding)
|
|
48 |
def format_docs(docs):
|
49 |
return "\n\n".join(doc.page_content for doc in docs)
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
retriever = vectorstore.as_retriever(k = 4)
|
54 |
|
55 |
prompt = hub.pull("rlm/rag-prompt")
|
56 |
llm = HuggingFaceEndpoint(repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1", stop_sequences=["Human:"])
|
@@ -97,7 +97,7 @@ Make your answer at least three sentences and very comprehensive.
|
|
97 |
Make your message in markdown with lots lines in between sentences.
|
98 |
|
99 |
Please use only the documents/text provided below to answer the question.
|
100 |
-
If the documents/text provided cannot answer the question, please say that the answer might not be present in the available database of information
|
101 |
"""
|
102 |
qa_prompt = ChatPromptTemplate.from_messages(
|
103 |
[
|
@@ -157,13 +157,13 @@ async def echo(websocket):
|
|
157 |
while response.startswith("\n"):
|
158 |
response = response[1:]
|
159 |
await websocket.send(json.dumps({"response": response}))
|
160 |
-
except
|
161 |
pass
|
162 |
|
163 |
async def main():
|
164 |
try:
|
165 |
async with serve(echo, "0.0.0.0", 7860):
|
166 |
await asyncio.Future()
|
167 |
-
except
|
168 |
pass
|
169 |
asyncio.run(main())
|
|
|
48 |
def format_docs(docs):
|
49 |
return "\n\n".join(doc.page_content for doc in docs)
|
50 |
|
51 |
+
search_kwargs={"score_threshold": 0.3}
|
52 |
+
search_type="similarity_score_threshold"
|
53 |
+
retriever = vectorstore.as_retriever(k = 4, )
|
54 |
|
55 |
prompt = hub.pull("rlm/rag-prompt")
|
56 |
llm = HuggingFaceEndpoint(repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1", stop_sequences=["Human:"])
|
|
|
97 |
Make your message in markdown with lots lines in between sentences.
|
98 |
|
99 |
Please use only the documents/text provided below to answer the question.
|
100 |
+
If the documents/text provided cannot answer the question, please say that the answer might not be present in the available database of information.
|
101 |
"""
|
102 |
qa_prompt = ChatPromptTemplate.from_messages(
|
103 |
[
|
|
|
157 |
while response.startswith("\n"):
|
158 |
response = response[1:]
|
159 |
await websocket.send(json.dumps({"response": response}))
|
160 |
+
except Exception:
|
161 |
pass
|
162 |
|
163 |
async def main():
|
164 |
try:
|
165 |
async with serve(echo, "0.0.0.0", 7860):
|
166 |
await asyncio.Future()
|
167 |
+
except Exception:
|
168 |
pass
|
169 |
asyncio.run(main())
|