MCPcopy Create free account

hub / github.com/KnowledgeXLab/LeanRAG / functions

Functions195 in github.com/KnowledgeXLab/LeanRAG

↓ 21 callersMethodwrite
(self, buf)
tools/logger_factory.py:135
↓ 16 callersFunctionwrite_jsonl
(data, path, mode="a",encoding='utf-8')
tools/utils.py:118
↓ 9 callersMethodformat
(self, record)
tools/logger_factory.py:34
↓ 6 callersFunctionclean_str
Clean an input string by removing HTML escapes, control characters, and other unwanted characters.
tools/_utils.py:209
↓ 6 callersFunctionclean_str
Clean an input string by removing HTML escapes, control characters, and other unwanted characters.
GraphExtraction/_utils.py:5
↓ 6 callersFunctionsetup_logger
初始化并返回一个日志记录器。 该函数确保所有日志记录器共享相同的处理程序,包括: - 基于时间戳的日志文件 - latest.log 文件 - 控制台输出(带颜色) 参数: - logger_name: 日志记录器的名称 - le
tools/logger_factory.py:41
↓ 6 callersFunctiontruncate_text
(text, max_tokens=4096)
tools/utils.py:16
↓ 5 callersFunctionget_direct_relations
(set1,set2,relations)
_cluster_utils.py:299
↓ 4 callersFunctionpack_user_ass_to_openai_messages
(*args: str)
GraphExtraction/_utils.py:14
↓ 4 callersFunctionsplit_string_by_multi_markers
Split a string by multiple markers
GraphExtraction/_utils.py:19
↓ 4 callersFunctionwrite_txt
(path: str, data, mode="a")
CommonKG/create_kg.py:21
↓ 3 callersFunctionread_txt
(path: str)
CommonKG/create_kg.py:29
↓ 2 callersFunction_handle_single_entity_extraction
( record_attributes: list[str], chunk_key: str, )
GraphExtraction/_utils.py:25
↓ 2 callersFunction_handle_single_relationship_extraction
( record_attributes: list[str], chunk_key: str, )
GraphExtraction/_utils.py:46
↓ 2 callersFunction_pack_single_community_describe
( entitys, relations, max_token_size: int = 12000, global_config: dict = {}, )
_cluster_utils.py:351
↓ 2 callersMethodcall_api
(self, user_prompt: str, system_prompt: str = "", output_json=False)
CommonKG/llm_infer.py:260
↓ 2 callersFunctionconvert_response_to_json
Convert response string to JSON, with error handling and fallback to non-standard JSON extraction.
_cluster_utils.py:144
↓ 2 callersFunctioncreate_db_table_mysql
(working_dir)
database_utils.py:103
↓ 2 callersFunctioncreate_if_not_exist
(path)
tools/utils.py:22
↓ 2 callersFunctionfind_tree_root
(working_dir,entity)
database_utils.py:221
↓ 2 callersMethodget_available_instance
使用轮询策略获取一个可用的实例
tools/utils.py:171
↓ 2 callersMethodget_available_instance
使用轮询策略获取一个可用的实例
CommonKG/llm_infer.py:37
↓ 2 callersMethodget_example
(self, entity, ref_kg_path)
CommonKG/triple.py:24
↓ 2 callersMethodinfer
(self, prompt, output_json=False)
CommonKG/llm_infer.py:269
↓ 2 callersFunctioninsert_data_to_mysql
(working_dir)
database_utils.py:133
↓ 2 callersFunctionlist_of_list_to_csv
(data: list[list])
_cluster_utils.py:292
↓ 2 callersFunctionprocess
删除字符串中括号及其中的内容。 包括括号 () 和中文括号()。 :param line: 原始字符串 :return: 删除括号内容后的字符串
tools/tools.py:38
↓ 2 callersFunctionread_jsonl
读取jsonl文件,并返回包含每行JSON对象的列表。 :param file_path: .jsonl文件的路径 :return: 包含每行JSON对象的列表
tools/utils.py:97
↓ 2 callersFunctiontruncate_list_by_token_size
Truncate a list of data by token size
_cluster_utils.py:168
↓ 2 callersFunctionwrite_csv_multithread
使用多线程写入大CSV文件。 参数: - file_path (str): 文件路径。 - data (DataFrame): 要写入的CSV数据。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。
tools/io_file.py:509
↓ 2 callersFunctionwrite_jsonl_force
(data, path, mode="w+",encoding='utf-8')
tools/utils.py:122
↓ 1 callersFunctionGMM_cluster
(embeddings: np.ndarray, threshold: float, random_state: int = 0,cluster_size: int = 20)
_cluster_utils.py:230
↓ 1 callersMethod_call_llm
(self, prompt:str)
CommonKG/kg_score.py:134
↓ 1 callersFunction_process_single_content_entity
(chunk_key_dp,use_llm_func)
GraphExtraction/chunk.py:32
↓ 1 callersFunction_process_single_content_relation
(chunk_key_dp,use_llm_func)
GraphExtraction/chunk.py:121
↓ 1 callersMethodauto_match
(self, entities, lower_case=True)
CommonKG/corpus.py:58
↓ 1 callersFunctionbuild_vector_search
(data,working_dir)
database_utils.py:7
↓ 1 callersMethodcall
(self, user_prompt: str, system_prompt: str = "")
CommonKG/kg_score.py:26
↓ 1 callersFunctionchunk_documents
( docs, model_name="cl100k_base", max_token_size=512, overlap_token_size=64, )
file_chunk.py:6
↓ 1 callersFunctioncompute_mdhash_id
(content, prefix: str = "")
file_chunk.py:4
↓ 1 callersFunctioncreate_if_not_exist
(path)
tools/io_file.py:15
↓ 1 callersFunctiondeal_duplicate_entity
(working_dir,output_path)
GraphExtraction/deal_triple.py:55
↓ 1 callersFunctionembedding
(texts: list[str])
build_graph.py:85
↓ 1 callersFunctionembedding
(texts: list[str])
query_graph.py:31
↓ 1 callersFunctionembedding_data
(entity_results)
build_graph.py:119
↓ 1 callersFunctionenclose_string_with_quotes
Enclose a string with quotes
_cluster_utils.py:285
↓ 1 callersFunctionenclose_string_with_quotes
Enclose a string with quotes
tools/_utils.py:188
↓ 1 callersFunctionencode_string_by_tiktoken
(content: str, model_name: str = "gpt-4o")
_cluster_utils.py:158
↓ 1 callersFunctionencode_string_by_tiktoken
(content: str, model_name: str = "gpt-4o")
tools/_utils.py:120
↓ 1 callersMethodentity_evaluate
(self, entities)
CommonKG/llm_infer.py:287
↓ 1 callersFunctionextract_desc
为三元组抽取描述(支持多线程加速)
CommonKG/create_kg.py:63
↓ 1 callersMethodextract_description_prompt
(self, text:str, triple:str)
CommonKG/llm_infer.py:207
↓ 1 callersFunctionextract_first_complete_json
Extract the first complete JSON object from the string using a stack to track braces.
_cluster_utils.py:47
↓ 1 callersFunctionextract_first_complete_json
Extract the first complete JSON object from the string using a stack to track braces.
tools/_utils.py:31
↓ 1 callersMethodextract_responses
从流式响应中提取文本.
CommonKG/llm_infer.py:151
↓ 1 callersMethodextract_triple_prompt
(self, corpus: str, entities: list, ref_kg_path)
CommonKG/llm_infer.py:161
↓ 1 callersFunctionextract_values_from_json
Extract key values from a non-standard or malformed JSON string, handling nested objects.
_cluster_utils.py:120
↓ 1 callersFunctionextract_values_from_json
Extract key values from a non-standard or malformed JSON string, handling nested objects.
tools/_utils.py:78
↓ 1 callersFunctionfit_gaussian_mixture
(n_components, embeddings, random_state)
_cluster_utils.py:202
↓ 1 callersMethodgenerate_text
发送请求到选择的实例
CommonKG/llm_infer.py:44
↓ 1 callersFunctionget_aggregation_description
(global_config,reasoning_path,if_findings=False)
query_graph.py:106
↓ 1 callersFunctionget_chunk
(chunk_file)
GraphExtraction/chunk.py:15
↓ 1 callersFunctionget_common_rag_res
(WORKING_DIR)
build_graph.py:30
↓ 1 callersFunctionget_entity_description
(global_config,entities_set,mode=0)
query_graph.py:96
↓ 1 callersMethodget_match_words
(self, entities: list)
CommonKG/corpus.py:51
↓ 1 callersFunctionget_optimal_clusters
(embeddings, max_clusters=50, random_state=0, rel_tol=1e-3)
_cluster_utils.py:213
↓ 1 callersFunctionget_reasoning_chain
(global_config,entities_set)
query_graph.py:52
↓ 1 callersFunctionget_text_units
(working_dir,chunks_set,chunks_file,k=5)
database_utils.py:351
↓ 1 callersMethodget_triple
从大模型的回答中获得三元组,并分析异常情况
CommonKG/triple.py:49
↓ 1 callersFunctionglobal_cluster_embeddings
( embeddings: np.ndarray, dim: int, n_neighbors: int = 15, metric: str = "cosine", )
_cluster_utils.py:179
↓ 1 callersFunctionhierarchical_clustering
(global_config)
build_graph.py:146
↓ 1 callersFunctioninsert_origin_relations
(working_dir)
database_utils.py:401
↓ 1 callersFunctionis_float_regex
(value)
tools/_utils.py:172
↓ 1 callersFunctionis_float_regex
(value)
GraphExtraction/_utils.py:44
↓ 1 callersFunctionmain
()
tools/tools.py:332
↓ 1 callersFunctionmain
()
CommonKG/create_kg.py:348
↓ 1 callersMethodparse_description_plustype_response
解析描述响应,生成六元组字符串
CommonKG/triple.py:114
↓ 1 callersMethodparse_result
(self, response: str)
CommonKG/kg_score.py:98
↓ 1 callersMethodparse_triple
解析三元组字符串为结构化字典 :param triple_str: "Head|relation|Tail" 格式的字符串 :return: {"head":..., "relation":..., "tail":...}
CommonKG/kg_score.py:62
↓ 1 callersFunctionparse_value
Convert a string value to its appropriate type (int, float, bool, None, or keep as string). Work as a more broad 'eval()
_cluster_utils.py:100
↓ 1 callersFunctionparse_value
Convert a string value to its appropriate type (int, float, bool, None, or keep as string). Work as a more broad 'eval()
tools/_utils.py:57
↓ 1 callersFunctionperform_clustering
( embeddings: np.ndarray, dim: int, threshold: float, verbose: bool = False,cluster_size: int = 20 )
_cluster_utils.py:244
↓ 1 callersMethodperform_clustering
( self, global_config: dict, entities: dict, relations:dict, max_lengt
_cluster_utils.py:501
↓ 1 callersFunctionprocess_single_file
处理单个文件的三元组抽取
CommonKG/create_kg.py:147
↓ 1 callersFunctionprocess_triple
(file_path,output_path)
CommonKG/deal_triple.py:23
↓ 1 callersFunctionquery_graph
(global_config,db,query)
query_graph.py:125
↓ 1 callersFunctionread_csv
读取CSV文件。 参数: - file_path (str): 文件路径。 - chunk_size (int): 当文件大于此大小时,使用多线程读取。 - encoding (str): 文件编码格式,默认为 'utf-8'。 返回:
tools/io_file.py:169
↓ 1 callersFunctionread_csv_multithread
使用多线程读取大CSV文件。 参数: - file_path (str): 文件路径。 - chunk_size (int): 文件大小阈值,单位为字节。 - encoding (str): 文件编码格式,默认为 'utf-8'。 返回:
tools/io_file.py:190
↓ 1 callersFunctionread_json
读取JSON文件。 参数: - file_path (str): 文件路径。 - encoding (str): 文件编码格式,默认为 'utf-8'。 返回: - dict: 读取的JSON文件内容。
tools/io_file.py:234
↓ 1 callersFunctionread_jsonl
读取JSONL文件,支持多线程处理。 参数: - file_path (str): 文件路径。 - chunk_size (int): 文件大小阈值,单位为字节。 - line_threshold (int): 行数阈值,超过此值使用多线程。 -
tools/io_file.py:296
↓ 1 callersFunctionread_jsonl_multithread
使用多线程读取大JSONL文件。 参数: - file_path (str): 文件路径。 - chunk_size (int): 文件大小阈值,单位为字节。 - num_lines (int): 文件行数。 - encoding (str): 文
tools/io_file.py:321
↓ 1 callersFunctionread_markdown
读取Markdown文件。 参数: - file_path (str): 文件路径。 - encoding (str): 文件编码格式,默认为 'utf-8'。 返回: - str: 读取的Markdown文件内容。
tools/io_file.py:280
↓ 1 callersFunctionread_txt
读取文本文件。 参数: - file_path (str): 文件路径。 - chunk_size (int): 当文件大于此大小时,使用多线程读取。 - encoding (str): 文件编码格式,默认为 'utf-8'。 返回: -
tools/io_file.py:99
↓ 1 callersFunctionread_txt_multithread
使用多线程读取大文本文件。 参数: - file_path (str): 文件路径。 - chunk_size (int): 文件大小阈值,单位为字节。 - encoding (str): 文件编码格式,默认为 'utf-8'。 返回:
tools/io_file.py:121
↓ 1 callersFunctionread_xlsx
读取Excel文件。 参数: - file_path (str): 文件路径。 - encoding (str): 文件编码格式,默认为 'utf-8'。 返回: - DataFrame: 读取的Excel文件内容。
tools/io_file.py:265
↓ 1 callersFunctionread_yaml
读取YAML文件。 参数: - file_path (str): 文件路径。 - encoding (str): 文件编码格式,默认为 'utf-8'。 返回: - dict: 读取的YAML文件内容。
tools/io_file.py:249
↓ 1 callersFunctionremove_duplicates
从已排序的文本文件中去除重复行。 Args: input_file: 已排序的输入文件路径。 output_file: 输出无重复行的文件路径。
tools/tools.py:126
↓ 1 callersFunctionremove_non_alpha
(string)
tools/tools.py:49
↓ 1 callersMethodrun
批量处理三元组(多线程加速) :return: 处理后的三元组列表
CommonKG/kg_score.py:148
↓ 1 callersMethodscore_triple
:param jsonl_line: JSONL格式的输入数据 :return: 包含所有打分结果的字典
CommonKG/kg_score.py:76
next →1–100 of 195, ranked by callers