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

Method __init__

methods/graph_rag.py:466–493  ·  view source on GitHub ↗
(
        self,
        temperature: float = 0.7,
        model_name: str = "gpt-4o-mini",
        retrieve_num: int = DEFAULT_RETRIEVE_NUM,
        max_tokens: int = 100,
        embedding_model: str = None,
        chunk_size: int = DEFAULT_CHUNK_SIZE,
        chunk_overlap: int = DEFAULT_CHUNK_OVERLAP,
        edges_threshold: float = DEFAULT_EDGES_THRESHOLD,
        callbacks: List = None,
    )

Source from the content-addressed store, hash-verified

464 """Main GraphRAG system coordinating document processing, graph building, and querying."""
465
466 def __init__(
467 self,
468 temperature: float = 0.7,
469 model_name: str = "gpt-4o-mini",
470 retrieve_num: int = DEFAULT_RETRIEVE_NUM,
471 max_tokens: int = 100,
472 embedding_model: str = None,
473 chunk_size: int = DEFAULT_CHUNK_SIZE,
474 chunk_overlap: int = DEFAULT_CHUNK_OVERLAP,
475 edges_threshold: float = DEFAULT_EDGES_THRESHOLD,
476 callbacks: List = None,
477 ):
478 self.retrieve_num = retrieve_num
479 self._callbacks = callbacks or []
480
481 # Initialize LLM
482 self.llm = _get_chat_model(
483 model_name=model_name,
484 temperature=temperature,
485 max_tokens=max_tokens,
486 callbacks=self._callbacks,
487 )
488
489 # Initialize components
490 self.embedding_model = _get_embeddings(embedding_model)
491 self.document_processor = DocumentProcessor(embedding_model, chunk_size, chunk_overlap)
492 self.knowledge_graph = KnowledgeGraph(edges_threshold)
493 self.query_engine = None
494
495 def process_documents(self, documents: List[Document]) -> None:
496 """Process documents and build knowledge graph."""

Callers 1

__init__Method · 0.45

Calls 4

_get_chat_modelFunction · 0.85
DocumentProcessorClass · 0.85
_get_embeddingsFunction · 0.70
KnowledgeGraphClass · 0.70

Tested by

no test coverage detected