Update djezzy.py
Browse files
djezzy.py
CHANGED
@@ -147,6 +147,7 @@ def pip(question,docs_text, docs_embeddings,mots_a_verifier,vector_db):
|
|
147 |
|
148 |
else:
|
149 |
context="\n---------------------\n".join([doc for doc,_ in similar_docs[:4]]if len(similar_docs) >=3 else [doc for doc, _ in similar_docs[:1]])
|
|
|
150 |
system_message=" "
|
151 |
prompt = f"As Djezzy's chatbot\nread each paraphrase in the context and Answer the question .\ndo not take into consideration the paragraphs which have no relation to the question\n if there is not a paragraph that is related to the question, respond that for this question it's best to reach out to our customer service team . They'll be able to assist you with your needs\n just give me the answer I don't want any other details \n dont' mention that you used the provided context ###context:{context}\n ###question: {query_text} "
|
152 |
if lang=='fr':
|
@@ -161,6 +162,7 @@ def pip(question,docs_text, docs_embeddings,mots_a_verifier,vector_db):
|
|
161 |
#print(result[0]['generated_text'])
|
162 |
else:
|
163 |
context = "\n---------------------\n".join([doc for doc, _ in similar_docs2[:2]] if len(similar_docs2) >= 2 else [doc for doc, _ in similar_docs2[:1]])
|
|
|
164 |
system_message=" "
|
165 |
prompt = f" As Djezzy's chatbot\nread each paraphrase in the context and Answer the question .\ndo not take into consideration the paragraphs which have no relation to the question\n if there is not a paragraph that is related to the question, respond that for this question it's best to reach out to our customer service team . They'll be able to assist you with your needs\n just give me the answer I don't want any other details \n ###context:{context}\n ###question: {query_text} "
|
166 |
if lang=='fr':
|
@@ -177,6 +179,7 @@ def pip(question,docs_text, docs_embeddings,mots_a_verifier,vector_db):
|
|
177 |
|
178 |
else:
|
179 |
context="\n---------------------\n".join([doc for doc,_ in similar_docs1[:1]])
|
|
|
180 |
system_message=" "
|
181 |
prompt = f"As Djezzy's chatbot\nread 3 times each paraphrase in the context and Answer the question .\ndo not take into consideration the paragraphs which have no relation to the question\n if there is not a paragraph that is related to the question, respond that for this question it's best to reach out to our customer service team . They'll be able to assist you with your needs\n just give me the answer I don't want any other details \n differentiates between each price and gives the correct answer and does not distinguish between the offers of each price\n ###context:{context}\n {query_text}"
|
182 |
if lang=='fr':
|
@@ -202,6 +205,7 @@ def pip(question,docs_text, docs_embeddings,mots_a_verifier,vector_db):
|
|
202 |
)
|
203 |
similar_docs.append(result[0])
|
204 |
context="\n---------------------\n".join([similar_docs[i].page_content for i in range(len(similar_docs))])
|
|
|
205 |
system_message=" "
|
206 |
prompt = f" As Djezzy's chatbot\nread each paraphrase in the context and Answer the question .\ndo not take into consideration the paragraphs which have no relation to the question\n if there is not a paragraph that is related to the question, respond that for this question it's best to reach out to our customer service team . They'll be able to assist you with your needs\n just give me the answer I don't want any other details \n ###context:{context}\n ###question: {query_text} "
|
207 |
if lang=='fr':
|
|
|
147 |
|
148 |
else:
|
149 |
context="\n---------------------\n".join([doc for doc,_ in similar_docs[:4]]if len(similar_docs) >=3 else [doc for doc, _ in similar_docs[:1]])
|
150 |
+
print(context)
|
151 |
system_message=" "
|
152 |
prompt = f"As Djezzy's chatbot\nread each paraphrase in the context and Answer the question .\ndo not take into consideration the paragraphs which have no relation to the question\n if there is not a paragraph that is related to the question, respond that for this question it's best to reach out to our customer service team . They'll be able to assist you with your needs\n just give me the answer I don't want any other details \n dont' mention that you used the provided context ###context:{context}\n ###question: {query_text} "
|
153 |
if lang=='fr':
|
|
|
162 |
#print(result[0]['generated_text'])
|
163 |
else:
|
164 |
context = "\n---------------------\n".join([doc for doc, _ in similar_docs2[:2]] if len(similar_docs2) >= 2 else [doc for doc, _ in similar_docs2[:1]])
|
165 |
+
print(context)
|
166 |
system_message=" "
|
167 |
prompt = f" As Djezzy's chatbot\nread each paraphrase in the context and Answer the question .\ndo not take into consideration the paragraphs which have no relation to the question\n if there is not a paragraph that is related to the question, respond that for this question it's best to reach out to our customer service team . They'll be able to assist you with your needs\n just give me the answer I don't want any other details \n ###context:{context}\n ###question: {query_text} "
|
168 |
if lang=='fr':
|
|
|
179 |
|
180 |
else:
|
181 |
context="\n---------------------\n".join([doc for doc,_ in similar_docs1[:1]])
|
182 |
+
print(context)
|
183 |
system_message=" "
|
184 |
prompt = f"As Djezzy's chatbot\nread 3 times each paraphrase in the context and Answer the question .\ndo not take into consideration the paragraphs which have no relation to the question\n if there is not a paragraph that is related to the question, respond that for this question it's best to reach out to our customer service team . They'll be able to assist you with your needs\n just give me the answer I don't want any other details \n differentiates between each price and gives the correct answer and does not distinguish between the offers of each price\n ###context:{context}\n {query_text}"
|
185 |
if lang=='fr':
|
|
|
205 |
)
|
206 |
similar_docs.append(result[0])
|
207 |
context="\n---------------------\n".join([similar_docs[i].page_content for i in range(len(similar_docs))])
|
208 |
+
print(context)
|
209 |
system_message=" "
|
210 |
prompt = f" As Djezzy's chatbot\nread each paraphrase in the context and Answer the question .\ndo not take into consideration the paragraphs which have no relation to the question\n if there is not a paragraph that is related to the question, respond that for this question it's best to reach out to our customer service team . They'll be able to assist you with your needs\n just give me the answer I don't want any other details \n ###context:{context}\n ###question: {query_text} "
|
211 |
if lang=='fr':
|