(self, context, question, titles)
| 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 " |
| 69 | f"The context is a list of Wikipedia documents titled: {titles}. " |
| 70 | f"There are two types of questions: comparison questions, which require a yes or no answer or a selection from two candidates, " |
| 71 | f"and general questions, which demand a concise response. " |
| 72 | f"The context is: {context}. " |
| 73 | f"Find the useful documents from the context, then answer the question: {question}." |
| 74 | f"For general questions, you should use the exact words from the context as the answer to avoid ambiguity. " |
| 75 | f"Answer the question directly and don't output other thing. ") |
| 76 | long_answer = self.predict(prompt) |
| 77 | short_answer = self.extract_answer(question, long_answer) |
| 78 | return long_answer, short_answer |
| 79 | |
| 80 | def generate_demo_examples(self, num_demo=8): |
| 81 | """ |
no test coverage detected