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

Method query

methods/graph_rag.py:506–517  ·  view source on GitHub ↗

Query the system and return answer with context.

(self, query: str)

Source from the content-addressed store, hash-verified

504 )
505
506 def query(self, query: str) -> Tuple[str, str]:
507 """Query the system and return answer with context."""
508 if self.query_engine is None:
509 raise RuntimeError("GraphRAG not initialized. Call process_documents first.")
510
511 final_answer, expanded_context, _, _ = self.query_engine.query(query)
512
513 # Extract text from LLM response if needed
514 if hasattr(final_answer, 'content'):
515 final_answer = final_answer.content
516
517 return str(final_answer), expanded_context
518
519class GraphRAGAgent(BaseAgent):
520 """GraphRAG Agent - Knowledge graph based RAG method adapter.

Callers 1

queryMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected