MCPcopy Create free account

hub / github.com/AI-Application-and-Integration-Lab/MegaRAG / functions

Functions97 in github.com/AI-Application-and-Integration-Lab/MegaRAG

↓ 17 callersFunctionstage
Helper to create a StageTimer with optional key/value tags.
megarag/megarag.py:193
↓ 7 callersMethodupsert
Importance notes: 1. Changes will be persisted to disk during the next index_done_callback 2. Only one process should updatin
megarag/kg/nano_mm_vector_db_impl.py:149
↓ 6 callersFunctionuse_llm_func_with_cache
Call LLM function with cache support If cache is available and enabled (determined by handle_cache based on mode), retrieve result from cache
megarag/utils.py:34
↓ 4 callersFunction_process_extraction_result
Process a single extraction result (either initial or gleaning) Args: result (str): The extraction result to process c
megarag/operate.py:1324
↓ 4 callersFunctiontimed_coro
Wrap a coroutine with timing so it can be scheduled via create_task().
megarag/megarag.py:197
↓ 3 callersFunction_get_vector_context
Retrieve text chunks from the vector database without reranking or truncation. This function performs vector search to find relevant text ch
megarag/operate.py:176
↓ 3 callersFunction_now_iso
()
egs/utils/query_mmkg.py:33
↓ 3 callersFunctiongpt_4o_mini_complete
( prompt, input_images=None, system_prompt=None, history_messages=None, keyword_extraction
megarag/llms/openai.py:40
↓ 2 callersFunction_handle_single_entity_extraction
( record_attributes: list[str], chunk_key: str, file_path: str = "unknown_source", )
megarag/operate.py:987
↓ 2 callersFunction_handle_single_relationship_extraction
( record_attributes: list[str], chunk_key: str, file_path: str = "unknown_source", )
megarag/operate.py:1039
↓ 2 callersFunction_notify_stage_listeners
(event: dict)
megarag/megarag.py:106
↓ 2 callersFunction_process_single_content
Process a single chunk Args: chunk_key_dp (tuple[str, TextChunkSchema]): ("chunk-xxxxxx", {"tokens": int, "content
megarag/operate.py:1369
↓ 2 callersFunction_process_with_semaphore
(chunk)
megarag/operate.py:1485
↓ 2 callersFunctionextract_entities
( chunks: dict[str, TextChunkSchema], global_config: dict[str, str], pipeline_status: dict = None,
megarag/operate.py:1262
↓ 2 callersFunctionhf_gme_embed
(embed_model, texts: list[str]=[], images: list[str]=[], is_query: bool=False)
megarag/llms/hf.py:47
↓ 2 callersFunctionkg_query
( query: str, knowledge_graph_inst: BaseGraphStorage, entities_vdb: BaseVectorStorage, relatio
megarag/operate.py:2037
↓ 2 callersFunctionload_json
Load a JSON file and return its content as a dict.
egs/utils/build_page_assets.py:27
↓ 2 callersFunctionmerge_nodes_and_edges
Merge nodes and edges from extraction results Args: chunk_results: List of tuples (maybe_nodes, maybe_edges) containing extracted entitie
megarag/operate.py:1097
↓ 2 callersFunctionnaive_query
( query: str, chunks_vdb: BaseVectorStorage, text_chunks_db: BaseKVStorage, query_param: Query
megarag/operate.py:1843
↓ 1 callersFunction_build_query_context_for_refine
( query: str, ll_keywords: str, hl_keywords: str, knowledge_graph_inst: BaseGraphStorage,
megarag/operate.py:223
↓ 1 callersFunction_build_query_context_with_image
( query: str, ll_keywords: str, hl_keywords: str, knowledge_graph_inst: BaseGraphStorage,
megarag/operate.py:605
↓ 1 callersFunction_chunk_pages
Split *page_numbers* into *chunks* balanced sub‑lists.
egs/utils/pdf2img.py:38
↓ 1 callersFunction_img_item
(path: str)
megarag/llms/openai.py:125
↓ 1 callersMethod_insert_refine_done
( self, refine_round )
megarag/megarag.py:983
↓ 1 callersFunction_locked_process_edges
(edge_key, edges)
megarag/operate.py:1187
↓ 1 callersFunction_locked_process_entity_name
(entity_name, entities)
megarag/operate.py:1158
↓ 1 callersMethod_process_entity_relation_graph
( self, chunk: dict[str, Any], pipeline_status=None, pipeline_status_lock=None )
megarag/megarag.py:337
↓ 1 callersMethod_process_entity_relation_graph_refinement
( self, chunk: dict[str, Any], chunk_results: list, knowledge_graph_inst: Base
megarag/megarag.py:359
↓ 1 callersFunction_runner
()
megarag/megarag.py:199
↓ 1 callersFunction_search_subgraph
(nodes, edges)
megarag/operate.py:1769
↓ 1 callersFunction_torch_speed_tweaks
()
egs/utils/query_mmkg.py:36
↓ 1 callersFunctionadd_stage_listener
(listener: _StageListener)
megarag/megarag.py:95
↓ 1 callersMethodainsert
Async Insert documents with checkpoint support Args: input: Single document string or list of document strings split_
megarag/megarag.py:312
↓ 1 callersMethodapipeline_process_enqueue_documents
Process pending documents by splitting them into chunks, processing each chunk for entity and relation extraction, and updating the
megarag/megarag.py:395
↓ 1 callersMethodaquery
Perform an async query.
megarag/megarag.py:1032
↓ 1 callersFunctionasync_main
()
egs/utils/query_mmkg.py:204
↓ 1 callersFunctionbuild_fake_input
()
test/test_mm_entity_extraction.py:17
↓ 1 callersFunctionchunking_by_token_size
( tokenizer: Tokenizer, content: str, split_by_character: str | None = None, split_by_characte
megarag/operate.py:71
↓ 1 callersFunctionclean_text
Clean text by removing null bytes (0x00) and whitespace Args: text: Input text to clean Returns: Cleaned text
egs/utils/build_page_assets.py:32
↓ 1 callersFunctioncollect_page_images
Collect every embedded image (including table snapshots) on a single page and return their absolute (string) paths.
egs/utils/build_page_assets.py:43
↓ 1 callersFunctionconcat_page_content_by_idx
Merge every textual element that belongs to the same page. Returns a dict: {page_idx: {"text": <concatenated text>}}
egs/utils/build_page_assets.py:62
↓ 1 callersFunctionenable_timing_jsonl
Enable JSONL persistence. Call once at startup (we auto-call below).
megarag/megarag.py:83
↓ 1 callersFunctionextract_entities_refinement
( chunks: dict[str, TextChunkSchema], chunk_results: list, knowledge_graph_inst: BaseGraphStorage,
megarag/operate.py:1519
↓ 1 callersFunctionextract_queries
Read queries from either: - JSONL: lines with {"question": "..."} (preferred) - Markdown-like lines: "- Question N: text"
egs/utils/query_mmkg.py:114
↓ 1 callersFunctioninitialize_model
()
egs/utils/construct_mmkg.py:26
↓ 1 callersFunctioninitialize_model
()
egs/utils/query_mmkg.py:46
↓ 1 callersFunctioninitialize_rag
Initialise a :class:`MegaRAG` instance for *working_dir* using *addon_params*.
egs/utils/construct_mmkg.py:46
↓ 1 callersFunctioninitialize_rag
Initialise a MegaRAG instance for *working_dir* using *addon_params*.
egs/utils/query_mmkg.py:66
↓ 1 callersFunctioninner
()
megarag/llms/openai.py:178
↓ 1 callersMethodinsert
Sync Insert documents with checkpoint support Args: input: Single document string or list of document strings split_b
megarag/megarag.py:281
↓ 1 callersFunctioninsert_context
Insert the JSON contexts into the RAG store, retrying on failure.
egs/utils/construct_mmkg.py:87
↓ 1 callersFunctionkg_two_step_query
( query: str, knowledge_graph_inst: BaseGraphStorage, entities_vdb: BaseVectorStorage, relatio
megarag/operate.py:2173
↓ 1 callersFunctionload_addon_params
(config_path: Path)
egs/utils/construct_mmkg.py:39
↓ 1 callersFunctionload_addon_params
(config_path: Path)
egs/utils/query_mmkg.py:61
↓ 1 callersFunctionmain
()
egs/utils/pdf2img.py:70
↓ 1 callersFunctionmain
()
egs/utils/build_page_assets.py:185
↓ 1 callersFunctionmain
()
egs/utils/construct_mmkg.py:154
↓ 1 callersFunctionmain
()
egs/utils/query_mmkg.py:314
↓ 1 callersFunctionmain
()
test/test_mm_entity_extraction.py:79
↓ 1 callersFunctionopenai_complete_if_cache
Complete *prompt* with OpenAI, supporting optional image inputs. Args: model: Vision‑capable model (e.g. ``"gpt-4o-mini"``)
megarag/llms/openai.py:72
↓ 1 callersFunctionparse_args
()
egs/utils/pdf2img.py:49
↓ 1 callersFunctionparse_args
()
egs/utils/build_page_assets.py:166
↓ 1 callersFunctionparse_args
()
egs/utils/construct_mmkg.py:115
↓ 1 callersFunctionparse_args
()
egs/utils/query_mmkg.py:141
↓ 1 callersFunctionplot_waterfall_from_jsonl
Render a waterfall chart for a given trace_id from the JSONL timing file. Requirements: pandas, matplotlib. Install: pip install pandas matplotli
megarag/utils.py:135
↓ 1 callersFunctionprepare_page_assets
Assemble per-page assets: pages_content[page_idx] = { "text": <merged text>, "page_image": <main pag
egs/utils/build_page_assets.py:106
↓ 1 callersMethodquery
( self, query: str, top_k: int, ids: list[str] | None = None )
megarag/kg/nano_mm_vector_db_impl.py:209
↓ 1 callersFunctionremove_stage_listener
(listener: _StageListener)
megarag/megarag.py:99
↓ 1 callersFunctionresults_to_jsonable
(results)
test/test_mm_entity_extraction.py:62
↓ 1 callersFunctionrun_query_with_retries
(rag: MegaRAG, question: str, param: QueryParam, max_retries: int, retry_delay: float)
egs/utils/query_mmkg.py:188
↓ 1 callersFunctionworker
(idx: int, q: str)
egs/utils/query_mmkg.py:226
Method__aenter__
(self)
megarag/megarag.py:128
Method__aexit__
(self, exc_type, exc, tb)
megarag/megarag.py:145
Method__enter__
(self)
megarag/megarag.py:228
Method__exit__
(self, exc_type, exc, tb)
megarag/megarag.py:233
Method__init__
(self, name: str, tags: dict | None = None)
megarag/megarag.py:121
Method__init__
(self)
megarag/megarag.py:207
Method__post_init__
(self)
megarag/megarag.py:276
Method__post_init__
(self)
megarag/kg/nano_mm_vector_db_impl.py:40
Method__post_init__
(self)
megarag/kg/nano_mm_vector_db_impl.py:112
Method_dot_query
( self, query: np.ndarray, top_k: int, better_than_threshold: float | None,
megarag/kg/nano_mm_vector_db_impl.py:68
Method_get_storage_class
(self, storage_name: str)
megarag/megarag.py:271
Function_render_pages
Render *page_numbers* (1‑based) of *pdf_path* to *output_dir*. Each worker opens its own document instance → no cross‑process state.
egs/utils/pdf2img.py:8
Method_save_vdb
(storage_inst)
megarag/megarag.py:990
Functionchunking_by_token_or_page
( tokenizer: Tokenizer, content: str, split_by_character: str | None = None, split_by_characte
megarag/operate.py:125
Functiondepth_of
(span_id: Optional[str])
megarag/utils.py:185
Functionembed_func
(texts=[], images=[], is_query=False)
egs/utils/construct_mmkg.py:50
Functionembed_func
(texts=[], images=[], is_query=False)
egs/utils/query_mmkg.py:75
Methodhandle
(self, ev: dict)
megarag/megarag.py:240
Functionhf_embed
(texts: list[str], tokenizer, embed_model)
megarag/llms/hf.py:17
Functionllm_func
( prompt, input_images=None, system_prompt=None, history_messages=None,
egs/utils/construct_mmkg.py:59
Functionllm_func
( prompt, input_images=None, system_prompt=None, history_messages=None,
egs/utils/query_mmkg.py:86
Functionllm_func
( prompt, input_images=None, system_prompt=None, history_messages=None,
test/test_mm_entity_extraction.py:33
Functionopenai_embed
Generate embeddings for a list of texts using OpenAI's API. Args: texts: List of texts to embed. model: The OpenAI embedding mode
megarag/llms/openai.py:273
Methodprocess_document
Process a single document end-to-end.
megarag/megarag.py:503
Methodprocess_document_refinement
Run a single refinement round: extract again then merge.
megarag/megarag.py:783
Functionverify_storage_implementation
Verify if storage implementation is compatible with specified storage type Args: storage_type: Storage type (KV_STORAGE, GRAPH_STORAGE et
megarag/kg/__init__.py:13