MCPcopy Create free account
hub / github.com/NanGePlus/LightRAGTest / LightRAG

Class LightRAG

LightRAG/lightrag/lightrag.py:67–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65
66@dataclass
67class LightRAG:
68 working_dir: str = field(
69 default_factory=lambda: f"./lightrag_cache_{datetime.now().strftime('%Y-%m-%d-%H:%M:%S')}"
70 )
71
72 kv_storage: str = field(default="JsonKVStorage")
73 vector_storage: str = field(default="NanoVectorDBStorage")
74 graph_storage: str = field(default="NetworkXStorage")
75
76 current_log_level = logger.level
77 log_level: str = field(default=current_log_level)
78
79 # text chunking
80 chunk_token_size: int = 1200
81 chunk_overlap_token_size: int = 100
82 tiktoken_model_name: str = "gpt-4o-mini"
83
84 # entity extraction
85 entity_extract_max_gleaning: int = 1
86 entity_summary_to_max_tokens: int = 500
87
88 # node embedding
89 node_embedding_algorithm: str = "node2vec"
90 node2vec_params: dict = field(
91 default_factory=lambda: {
92 "dimensions": 1536,
93 "num_walks": 10,
94 "walk_length": 40,
95 "window_size": 2,
96 "iterations": 3,
97 "random_seed": 3,
98 }
99 )
100
101 # embedding_func: EmbeddingFunc = field(default_factory=lambda:hf_embedding)
102 embedding_func: EmbeddingFunc = field(default_factory=lambda: openai_embedding)
103 embedding_batch_num: int = 32
104 embedding_func_max_async: int = 16
105
106 # LLM
107 llm_model_func: callable = gpt_4o_mini_complete # hf_model_complete#
108 llm_model_name: str = "meta-llama/Llama-3.2-1B-Instruct" #'meta-llama/Llama-3.2-1B'#'google/gemma-2-2b-it'
109 llm_model_max_token_size: int = 32768
110 llm_model_max_async: int = 16
111 llm_model_kwargs: dict = field(default_factory=dict)
112
113 # storage
114 vector_db_storage_cls_kwargs: dict = field(default_factory=dict)
115
116 enable_llm_cache: bool = True
117
118 # extension
119 addon_params: dict = field(default_factory=dict)
120 convert_response_to_json_func: callable = convert_response_to_json
121
122 def __post_init__(self):
123 log_file = os.path.join(self.working_dir, "lightrag.log")
124 set_logger(log_file)

Callers 15

test.pyFile · 0.90
test_neo4j.pyFile · 0.90
test.pyFile · 0.90
Step_3.pyFile · 0.90
Step_1.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected