bhaskartripathi commited on
Commit
85846d1
·
1 Parent(s): 30e7b52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -147,16 +147,14 @@ 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 "\
154
  "don't add any additional information. Make sure the answer is correct and don't output false content. "\
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
 
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 "\
154
  "don't add any additional information. Make sure the answer is correct and don't output false content. "\
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
  prompt += f"Query: {question}\nAnswer:"
159
  answer = generate_text(openAI_key, prompt, "text-davinci-003")
160
  return answer