(self, context, question, titles)
| 53 | return answer |
| 54 | |
| 55 | def predict_nq(self, context, question, titles): |
| 56 | titles = ['"' + title + '"' for title in titles] |
| 57 | prompt = (f"Go through the following context and then extract the answer of the question from the context. " |
| 58 | f"Answer the question directly. Your answer should be very concise. " |
| 59 | f"The context is a list of Wikipedia documents, ordered by title: {titles}. " |
| 60 | f"Each Wikipedia document contains a 'title' field and a 'text' field. " |
| 61 | f"The context is: {context}. " |
| 62 | f"The question: {question}. ") |
| 63 | long_answer = self.predict(prompt) |
| 64 | short_answer = self.extract_answer(question, long_answer) |
| 65 | return long_answer, short_answer |
| 66 | |
| 67 | def predict_hotpotqa(self, context, question, titles): |
| 68 | prompt = (f"Go through the following context and then answer the question " |
no test coverage detected