Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -50,7 +50,7 @@ embeddings = HuggingFaceEmbeddings(model_name="all-MiniLM-L6-v2",
|
|
50 |
foo = Document(page_content='foo is fou!',metadata={"source":'foo source'})
|
51 |
|
52 |
@spaces.GPU
|
53 |
-
def similarity_search(db,query, k=
|
54 |
return db.similarity_search(query, k)
|
55 |
|
56 |
@spaces.GPU
|
@@ -322,7 +322,7 @@ def ask_gpt(query, ui_session_id, history):
|
|
322 |
print(f"SESSION: {session_id} database does not exist")
|
323 |
return f"SESSION: {session_id} database does not exist","",""
|
324 |
|
325 |
-
docs = similarity_search(db,query, k=
|
326 |
|
327 |
documents = "\n\n*-*-*-*-*-*\n\n".join(f"Content: {doc.page_content}\n" for doc in docs)
|
328 |
system = f"# Instructions\nTake a deep breath and resonate step by step.\nYou are a helpful standard assistant. Your have only one mission and that consists in answering to the user input based on the **provided documents**. If the answer to the question that is asked by the user isn't contained in the **provided documents**, say so but **don't make up an answer**. I chose you because you can say 'I don't know' so please don't do like the other LLMs and don't define acronyms that aren\'t present in the following **PROVIDED DOCUMENTS** double check if it is present before answering. If some of the information can be useful for the user you can tell him.\nFinish your response by **ONE** follow up question that the provided documents could answer.\n\nThe documents are separated by the string \'*-*-*-*-*-*\'. Do not provide any explanations or details.\n\n# **Provided documents**: {documents}."
|
|
|
50 |
foo = Document(page_content='foo is fou!',metadata={"source":'foo source'})
|
51 |
|
52 |
@spaces.GPU
|
53 |
+
def similarity_search(db,query, k=4):
|
54 |
return db.similarity_search(query, k)
|
55 |
|
56 |
@spaces.GPU
|
|
|
322 |
print(f"SESSION: {session_id} database does not exist")
|
323 |
return f"SESSION: {session_id} database does not exist","",""
|
324 |
|
325 |
+
docs = similarity_search(db,query, k=4)
|
326 |
|
327 |
documents = "\n\n*-*-*-*-*-*\n\n".join(f"Content: {doc.page_content}\n" for doc in docs)
|
328 |
system = f"# Instructions\nTake a deep breath and resonate step by step.\nYou are a helpful standard assistant. Your have only one mission and that consists in answering to the user input based on the **provided documents**. If the answer to the question that is asked by the user isn't contained in the **provided documents**, say so but **don't make up an answer**. I chose you because you can say 'I don't know' so please don't do like the other LLMs and don't define acronyms that aren\'t present in the following **PROVIDED DOCUMENTS** double check if it is present before answering. If some of the information can be useful for the user you can tell him.\nFinish your response by **ONE** follow up question that the provided documents could answer.\n\nThe documents are separated by the string \'*-*-*-*-*-*\'. Do not provide any explanations or details.\n\n# **Provided documents**: {documents}."
|