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

Method _extract_retrieval_query

methods/graph_rag.py:335–349  ·  view source on GitHub ↗

Extract the actual question from formatted query.

(self, query: str)

Source from the content-addressed store, hash-verified

333 return final_answer, expanded_context, traversal_path, filtered_content
334
335 def _extract_retrieval_query(self, query: str) -> str:
336 """Extract the actual question from formatted query."""
337 import re
338
339 patterns = [
340 r"Now Answer the Question:\s*(.*)",
341 r"Here is the conversation:\s*(.*)",
342 ]
343
344 for pattern in patterns:
345 match = re.search(pattern, query, re.DOTALL)
346 if match:
347 return ''.join(match.groups())
348
349 return query
350
351 def _retrieve_relevant_documents(self, query: str) -> List:
352 """Retrieve relevant documents using compression retriever."""

Callers 1

queryMethod · 0.95

Calls 2

searchMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected