MCPcopy Create free account
hub / github.com/TIGER-AI-Lab/LongRAG / predict_hotpotqa

Method predict_hotpotqa

utils/gpt_inference.py:67–78  ·  view source on GitHub ↗
(self, context, question, titles)

Source from the content-addressed store, hash-verified

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 """

Callers 1

eval_qa.pyFile · 0.45

Calls 2

predictMethod · 0.95
extract_answerMethod · 0.95

Tested by

no test coverage detected