Spaces:
Sleeping
Sleeping
Commit
·
5d53914
1
Parent(s):
3bb5d33
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,12 +33,14 @@ db = lcvs.Chroma.from_documents(splits, sentence_embeddings)
|
|
| 33 |
retriever = db.as_retriever(search_type="mmr")
|
| 34 |
|
| 35 |
template = """
|
| 36 |
-
|
| 37 |
|
| 38 |
-----------------------------
|
| 39 |
Context : {context}
|
| 40 |
-----------------------------
|
| 41 |
|
|
|
|
|
|
|
| 42 |
{question}
|
| 43 |
"""
|
| 44 |
|
|
@@ -52,8 +54,8 @@ qa_chain = lcchains.RetrievalQA.from_chain_type(
|
|
| 52 |
)
|
| 53 |
|
| 54 |
def rag_interface(ques, history):
|
| 55 |
-
prev_chat = " ".join([f"
|
| 56 |
-
current_ques = f'\
|
| 57 |
|
| 58 |
query = prev_chat + current_ques
|
| 59 |
|
|
|
|
| 33 |
retriever = db.as_retriever(search_type="mmr")
|
| 34 |
|
| 35 |
template = """
|
| 36 |
+
Based of following Context, complete the conversation followed afterwards:
|
| 37 |
|
| 38 |
-----------------------------
|
| 39 |
Context : {context}
|
| 40 |
-----------------------------
|
| 41 |
|
| 42 |
+
Conversation:
|
| 43 |
+
|
| 44 |
{question}
|
| 45 |
"""
|
| 46 |
|
|
|
|
| 54 |
)
|
| 55 |
|
| 56 |
def rag_interface(ques, history):
|
| 57 |
+
prev_chat = " ".join([f"Human: {q} \nAI: {a} \n" for q, a in history])
|
| 58 |
+
current_ques = f'\nHuman: {ques} \nAI:'
|
| 59 |
|
| 60 |
query = prev_chat + current_ques
|
| 61 |
|