Spaces:
Runtime error
Runtime error
Commit
·
30e7b52
1
Parent(s):
b160a8b
Update app.py
Browse files
app.py
CHANGED
@@ -147,7 +147,7 @@ def generate_answer(question, openAI_key):
|
|
147 |
for c in topn_chunks:
|
148 |
prompt += c + '\n\n'
|
149 |
|
150 |
-
prompt += "Instructions: Compose a comprehensive reply to the query using the search results given. "\
|
151 |
"Cite each reference using [PDF FILE NAME, PAGE NUMBER:] notation (every result has this number at the beginning). "\
|
152 |
"Citation should be done at the end of each sentence. If the search results mention multiple subjects "\
|
153 |
"with the same name, create separate answers for each. Only include information found in the results and "\
|
@@ -155,7 +155,8 @@ def generate_answer(question, openAI_key):
|
|
155 |
"If the text does not relate to the query, simply state 'Text Not Found in PDF'. Ignore outlier "\
|
156 |
"search results which have nothing to do with the question. Only answer what is asked. The "\
|
157 |
"answer should be short and concise. Answer step-by-step. \n\nQuery: {question}\nAnswer: "
|
158 |
-
|
|
|
159 |
prompt += f"Query: {question}\nAnswer:"
|
160 |
answer = generate_text(openAI_key, prompt, "text-davinci-003")
|
161 |
return answer
|
|
|
147 |
for c in topn_chunks:
|
148 |
prompt += c + '\n\n'
|
149 |
|
150 |
+
'''prompt += "Instructions: Compose a comprehensive reply to the query using the search results given. "\
|
151 |
"Cite each reference using [PDF FILE NAME, PAGE NUMBER:] notation (every result has this number at the beginning). "\
|
152 |
"Citation should be done at the end of each sentence. If the search results mention multiple subjects "\
|
153 |
"with the same name, create separate answers for each. Only include information found in the results and "\
|
|
|
155 |
"If the text does not relate to the query, simply state 'Text Not Found in PDF'. Ignore outlier "\
|
156 |
"search results which have nothing to do with the question. Only answer what is asked. The "\
|
157 |
"answer should be short and concise. Answer step-by-step. \n\nQuery: {question}\nAnswer: "
|
158 |
+
'''
|
159 |
+
prompt += ``Instruct:Composcomprehensrepliqueriusesearchresultgiven.``\``Citereferuse[PDFFILENAME,PAGENUMBER:]notat(everiresultnumberbegin).``\``Citatdoneendsentenc.searchresultmentionmultiplsubject``\``name,creatseparanswer.includinformfoundresult``\``dontaddadditinform.Makesureanswercorrectdontoutputfalscontent.``\``textnotrelatqueri,simplistateTextNotFoundPDF.Ignoroutlier``\``searchresultnothquestion.answerask.``\``answershortconcis.Answerstep-by-step.\n\nqueri:{question}\nanswer:``
|
160 |
prompt += f"Query: {question}\nAnswer:"
|
161 |
answer = generate_text(openAI_key, prompt, "text-davinci-003")
|
162 |
return answer
|