MCPcopy Create free account

hub / github.com/KnowledgeXLab/LeanRAG / functions

Functions195 in github.com/KnowledgeXLab/LeanRAG

↓ 1 callersFunctionsearch_community
(entity_name,working_dir)
database_utils.py:388
↓ 1 callersFunctionsearch_nodes_link
(entity1,entity2,working_dir,level=0)
database_utils.py:296
↓ 1 callersFunctionsearch_vector_search
level_mode: 0: 原始节点 1: 聚合节点 2: 所有节点
database_utils.py:68
↓ 1 callersMethodstart_instance
启动ollama实例在特定GPU和端口上
CommonKG/llm_infer.py:30
↓ 1 callersFunctiontest_setup_setup_logger
()
tools/logger_factory.py:145
↓ 1 callersFunctiontriple_extraction
(chunks,use_llm_func,output_dir)
GraphExtraction/chunk.py:22
↓ 1 callersMethodtriple_json_format
(self, triple, doc_name="", source_id="")
CommonKG/triple.py:20
↓ 1 callersFunctiontruncate_text
(text, max_tokens=4096)
build_graph.py:113
↓ 1 callersFunctionwrite_csv
写入CSV文件,支持多线程处理。 参数: - file_path (str): 文件路径。 - data (DataFrame): 要写入的CSV数据。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。
tools/io_file.py:489
↓ 1 callersFunctionwrite_json
写入JSON文件,支持多线程处理。 参数: - file_path (str): 文件路径。 - data (list): 要写入的JSON数据。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。 -
tools/io_file.py:545
↓ 1 callersFunctionwrite_jsonl
写入JSONL文件,支持多线程处理。 参数: - file_path (str): 文件路径。 - data (list): 要写入的JSON数据。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。
tools/io_file.py:427
↓ 1 callersFunctionwrite_jsonl_multithread
使用多线程写入JSONL文件。 参数: - file_path (str): 文件路径。 - data (list): 要写入的JSON数据。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。 - c
tools/io_file.py:450
↓ 1 callersFunctionwrite_markdown
写入Markdown文件。 参数: - file_path (str): 文件路径。 - data (str): 要写入的Markdown内容。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。 -
tools/io_file.py:688
↓ 1 callersFunctionwrite_txt
写入文本文件。 参数: - file_path (str): 文件路径。 - data (str): 要写入的数据。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。 - chunk_size (in
tools/io_file.py:369
↓ 1 callersFunctionwrite_txt_multithread
使用多线程写入文本文件。 参数: - file_path (str): 文件路径。 - data (str): 要写入的数据。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。 - chunk_siz
tools/io_file.py:390
↓ 1 callersFunctionwrite_xlsx
写入Excel文件。 参数: - file_path (str): 文件路径。 - data (DataFrame): 要写入的Excel数据。 - encoding (str): 写入文件的编码格式,默认为 'utf-8'。
tools/io_file.py:675
↓ 1 callersFunctionwrite_yaml
写入YAML文件。 参数: - file_path (str): 文件路径。 - data (dict): 要写入的YAML数据。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。 - encodin
tools/io_file.py:567
Method__call__
(self, *args, **kwargs)
tools/_utils.py:227
Method__init__
(self, url,ports, gpus, generate_model,startup_delay=30)
tools/utils.py:146
Method__init__
(self, logger, level=logging.INFO)
tools/logger_factory.py:130
Method__init__
(self, head, relation, tail)
CommonKG/triple.py:11
Method__init__
(self, ports, gpus, base_url, startup_delay=5)
CommonKG/llm_infer.py:17
Method__init__
(self, args)
CommonKG/llm_infer.py:60
Method__init__
(self, doc_name, source_id, corpus)
CommonKG/corpus.py:46
Method__init__
(self, args)
CommonKG/kg_score.py:21
Method__init__
初始化打分类
CommonKG/kg_score.py:45
Method__str__
(self)
CommonKG/triple.py:17
Function_handle_single_entity_extraction
( record_attributes: list[str], chunk_key: str, )
_cluster_utils.py:303
Function_handle_single_relationship_extraction
( record_attributes: list[str], chunk_key: str, )
_cluster_utils.py:324
Function_process_paragraph_for_matching
Worker function to process a single paragraph for entity matching. Unpacks arguments, creates a Corpus object, and performs matching.
CommonKG/create_kg.py:333
Functionalways_get_an_event_loop
()
tools/_utils.py:19
Functioncheck_test
(entities)
_cluster_utils.py:28
Functioncheck_test
(entities)
tools/utils.py:126
Functioncompute_args_hash
(*args)
tools/_utils.py:176
Functioncompute_mdhash_id
(content, prefix: str = "")
tools/_utils.py:148
Functionconvert_response_to_json
Convert response string to JSON, with error handling and fallback to non-standard JSON extraction.
tools/_utils.py:102
Functioncount_lines
(filename)
tools/tools.py:244
Functioncustom_lower_fast
中英文兼容的小写转换
tools/utils.py:54
Functiondecode_tokens_by_tiktoken
(tokens: list[int], model_name: str = "gpt-4o")
tools/_utils.py:128
Methoddefault_generate_text
(self, prompt, model="qwen-plus", temperature=0, max_tokens=4096, output_json=False)
CommonKG/llm_infer.py:123
Functiondicts_almost_equal
(dict1, dict2, tolerance=1e-6)
tools/utils.py:26
Functionembedding_init
(entities:list[dict])
build_graph.py:97
Functionevaluate_example
(query_file,result_file,output_file,dataset)
evaluate_score.py:92
Functionevaluate_item
(i, query, answer, benchmark, tokenizer)
evaluate_score.py:1
Functionextract_json_from_cluster
(s:str)
_cluster_utils.py:72
Functionfile_split
(input_file, num)
tools/tools.py:198
Functionfinal_decro
Not using async.Semaphore to aovid use nest-asyncio
tools/_utils.py:235
Functionfind_path
(entity1,entity2,working_dir,level,depth=5)
database_utils.py:249
Methodflush
(self)
tools/logger_factory.py:141
Methodgenerate_text
发送请求到选择的实例
tools/utils.py:178
Methodgenerate_text_asy
发送请求到选择的实例
tools/utils.py:223
Functionget_entities_from_triples
(infilename, outfilename, signpass=[])
tools/tools.py:280
Functionget_entities_from_wikidata
(infilename, outfilename1, outfilename2, outfilename3)
tools/tools.py:301
Methodget_tokens_cosumption
(self)
tools/utils.py:162
Functionis_word_boundary
自适应中英文词边界检测
tools/utils.py:59
Functionlimit_async_func_call
Add restriction of maximum async calling times for a async func
tools/_utils.py:232
Functionlist_of_list_to_csv
(data: list[list])
tools/_utils.py:197
Functionload_json
(file_name)
tools/_utils.py:157
Functionload_yaml_conf
(config_path)
CommonKG/config/set_config.py:7
Functionlocal_cluster_embeddings
( embeddings: np.ndarray, dim: int, num_neighbors: int = 10, metric: str = "cosine" )
_cluster_utils.py:193
Functionpack_user_ass_to_openai_messages
(*args: str)
tools/_utils.py:165
Methodparse_description_response
解析描述响应,生成六元组字符串
CommonKG/triple.py:91
Methodperform_clustering
(self, embeddings: np.ndarray, **kwargs)
_cluster_utils.py:349
Functionprint_file
(infile, n=10)
tools/tools.py:234
Functionprocess_cluster
( use_llm_func, embeddings_func, \ clusters,label,nodes,community_report_prompt,\ relations,g
_cluster_utils.py:404
Functionprocess_llm_batch
处理单个批次的LLM请求
CommonKG/create_kg.py:34
Functionprocess_relation
( use_llm_func,community_report,maybe_edge,relations,generate_relations,\ cluster_cluster_relation_p
_cluster_utils.py:448
Functionprocess_single_description
处理单个三元组的描述抽取
CommonKG/create_kg.py:122
Functionprocess_triple
(file_path,output_path)
GraphExtraction/deal_triple.py:135
Functionread
根据文件扩展名读取文件内容,并自动判断是否使用多线程。 TODO: 修正多线程读取功能,暂不可用,所以阈值设置的很大 参数: - file_path (str): 文件路径。 - chunk_size (int): 当文件大于此大小时,使用多线程读取,单位
tools/io_file.py:20
Functionread_chunk
读取文件的某个块。 参数: - file_path (str): 文件路径。 - start (int): 起始字节位置。 - end (int): 结束字节位置。 - encoding (str): 文件编码格式,默认为 'utf-8'。
tools/io_file.py:151
Functionread_csv_chunk
读取CSV文件的某一块。 参数: - file_path (str): 文件路径。 - start (int): 起始字节位置。 - end (int): 结束字节位置。 - encoding (str): 文件编码格式,默认为 'utf-8'。
tools/io_file.py:218
Functionread_jsonl_chunk
读取JSONL文件的某一块。 参数: - file_path (str): 文件路径。 - start_line (int): 起始行。 - end_line (int): 结束行。 - encoding (str): 文件编码格式,默认为 'ut
tools/io_file.py:351
Functionremove_text_in_brackets
(input_file, output_file, strong_clean_flag = False)
tools/tools.py:37
Methodreset_token_cost
重置总的token消耗和API调用次数
tools/utils.py:158
Methodrun_one
处理单个三元组
CommonKG/kg_score.py:141
Functionsearch_chunks
(working_dir,entity_set)
database_utils.py:325
Functionsearch_nodes
(entity_set,working_dir)
database_utils.py:339
Functionsort_large_file
( input_file, output_file, chunk_size=100000 )
tools/tools.py:83
Functionsplit_string_by_multi_markers
Split a string by multiple markers
tools/_utils.py:180
Functionstr_full_to_half_width
(input_file, output_file)
tools/tools.py:161
Functionsummarize_entity
(entity_name, description, summary_prompt, threshold, tokenizer)
GraphExtraction/deal_triple.py:14
Functionsummarize_entity
(entity_name, description, summary_prompt, threshold, tokenizer)
CommonKG/deal_triple.py:13
Functiontruncate_data
()
GraphExtraction/deal_triple.py:23
Functiontruncate_list_by_token_size
Truncate a list of data by token size
tools/_utils.py:136
Functiontruncate_text
(text, max_tokens=4096)
query_graph.py:45
Methodvllm_generate_text
使用vLLM生成文本
CommonKG/llm_infer.py:77
Functionwait_func
(*args, **kwargs)
tools/_utils.py:240
Functionwrap_embedding_func_with_attrs
Wrap a function with attributes
tools/_utils.py:254
Functionwrite
根据文件扩展名写入数据到文件,并自动判断是否使用多线程。 TODO: 修正多线程保存功能,暂不可用,所以阈值设置的很大 参数: - file_path (str): 文件路径。 - data (any): 要写入的数据。 - mode (str):
tools/io_file.py:58
Functionwrite_chunk
写入文本文件的某一块。 参数: - file_path (str): 文件路径。 - chunk (str): 要写入的文本块。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。 - encoding
tools/io_file.py:413
Functionwrite_csv_chunk
写入CSV文件的某一块。 参数: - file_path (str): 文件路径。 - chunk (DataFrame): 要写入的CSV数据块。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。
tools/io_file.py:532
Functionwrite_json
(json_obj, file_name)
tools/_utils.py:152
Functionwrite_jsonl_chunk
写入JSONL文件的某一块。 参数: - file_path (str): 文件路径。 - chunk (list): 要写入的数据块。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。 - enco
tools/io_file.py:473
Functionwrite_yaml_conf
(config_path, data)
CommonKG/config/set_config.py:14
← previous101–195 of 195, ranked by callers