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

Method predict_nq

utils/gemini_inference.py:56–65  ·  view source on GitHub ↗
(self, context, question, titles)

Source from the content-addressed store, hash-verified

54 return self.post_process(response.text)
55
56 def predict_nq(self, context, question, titles):
57 prompt = (f"Go through the following context and then extract the answer of the question from the context. "
58 f"The context is a list of Wikipedia documents, ordered by title: {titles}. "
59 f"Each Wikipedia document contains a title field and a text field. "
60 f"The context is: {context}. "
61 f"Find the useful documents from the context, then extract the answer to answer the question: {question}."
62 f"Answer the question directly. Your response should be very concise. ")
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 "

Callers

nothing calls this directly

Calls 2

predictMethod · 0.95
extract_answerMethod · 0.95

Tested by

no test coverage detected