MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / _create_answer_check_chain

Method _create_answer_check_chain

methods/graph_rag.py:292–304  ·  view source on GitHub ↗

Create chain to check if context provides complete answer.

(self)

Source from the content-addressed store, hash-verified

290 self.answer_check_chain = self._create_answer_check_chain()
291
292 def _create_answer_check_chain(self):
293 """Create chain to check if context provides complete answer."""
294 prompt = PromptTemplate(
295 input_variables=["query", "context"],
296 template=(
297 "Given the query: '{query}'\n\n"
298 "And the current context:\n{context}\n\n"
299 "Does this context provide a complete answer to the query? "
300 "If yes, provide the answer. If no, state that the answer is incomplete.\n\n"
301 "Is complete answer (Yes/No):\nAnswer (if complete):"
302 )
303 )
304 return prompt | self.llm.with_structured_output(AnswerCheck)
305
306 def _truncate_context(self, text: str, max_tokens: int = LLM_CONTEXT_LIMIT) -> str:
307 """Truncate text to fit within token limit."""

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected