MCPcopy Create free account

hub / github.com/IlyaRice/RAG-Challenge-2 / functions

Functions158 in github.com/IlyaRice/RAG-Challenge-2

↓ 12 callersFunctionbuild_system_prompt
(instruction: str="", example: str="", pydantic_schema: str="")
src/prompts.py:7
↓ 5 callersMethod_block_ends_with_colon
Check if block text ends with colon for relevant block types.
src/parsed_reports_merging.py:181
↓ 4 callersMethodcount_tokens
(self, string: str, encoding_name="o200k_base")
src/text_splitter.py:62
↓ 3 callersMethodparse_and_export
(self, input_doc_paths: List[Path] = None, doc_dir: Path = None)
src/pdf_parsing.py:156
↓ 3 callersMethodsend_message
Routes the send_message call to the appropriate processor. The underlying processor's send_message method is responsible for handling
src/api_requests.py:380
↓ 2 callersMethod_calculate_statistics
Calculate statistics about processed questions.
src/questions_processing.py:213
↓ 2 callersMethod_create_answer_detail_ref
Create a reference ID for answer details and store the details
src/questions_processing.py:200
↓ 2 callersMethod_get_table_context
(self, json_report, target_table_index)
src/tables_serialization.py:50
↓ 2 callersMethod_get_unique_filepath
Helper method to get unique filepath
src/api_requests.py:475
↓ 2 callersMethod_process_text_reference
Helper method to process text references and create content items. Args: ref_num (int): Reference number for the text ite
src/pdf_parsing.py:325
↓ 2 callersMethod_save_progress
(self, processed_questions: List[dict], output_path: Optional[str], submission_file: bool = False, team_email:
src/questions_processing.py:415
↓ 2 callersFunctionappend_to_jsonl
Append a json payload to the end of a jsonl file.
src/api_request_parallel_processor.py:362
↓ 2 callersMethodget_answer_for_company
(self, company_name: str, question: str, schema: str)
src/questions_processing.py:121
↓ 2 callersMethodget_answer_from_rag_context
(self, question, rag_context, schema, model)
src/api_requests.py:408
↓ 2 callersFunctionprocess_messages
()
src/tables_serialization.py:28
↓ 2 callersMethodprocess_report
Process a single report, returning a list of processed pages and printing a message if corrections were made.
src/parsed_reports_merging.py:47
↓ 1 callersMethod_apply_formatting_rules
Transform blocks according to formatting rules.
src/parsed_reports_merging.py:189
↓ 1 callersMethod_build_rag_context_prompts
Return prompts tuple for the given schema.
src/api_requests.py:422
↓ 1 callersMethod_clean_text
Clean text using regex substitutions and count corrections.
src/parsed_reports_merging.py:118
↓ 1 callersMethod_convert_json_to_csv_if_needed
Checks if subset.json exists in root dir and subset.csv is absent. If so, converts the JSON to CSV format.
src/pipeline.py:81
↓ 1 callersMethod_create_document_converter
Creates and returns a DocumentConverter with default pipeline options.
src/pdf_parsing.py:69
↓ 1 callersMethod_create_vector_db
(self, embeddings: List[float])
src/ingestion.py:82
↓ 1 callersMethod_extract_companies_from_subset
Extract company names from a question by matching against companies in the subset file.
src/questions_processing.py:163
↓ 1 callersMethod_extract_references
(self, pages_list: list, company_name: str)
src/questions_processing.py:69
↓ 1 callersMethod_filter_blocks
Remove blocks of ignored types.
src/parsed_reports_merging.py:107
↓ 1 callersMethod_format_retrieval_results
Format vector retrieval results into RAG context string
src/questions_processing.py:56
↓ 1 callersMethod_generate_with_retry
Wrapper for generate_content with retry logic
src/api_requests.py:274
↓ 1 callersMethod_get_embeddings
(self, text: Union[str, List[str]], model: str = "text-embedding-3-large")
src/ingestion.py:66
↓ 1 callersMethod_get_next_available_filename
Returns the next available filename by adding a numbered suffix if the file exists. Example: If answers.json exists, returns answers_
src/pipeline.py:233
↓ 1 callersMethod_get_page_data
Returns page dict for given page number, or None if not found.
src/parsed_reports_merging.py:99
↓ 1 callersMethod_get_serialized_table_text
Convert serialized table format to text string. Args: table: Table object containing serialized data
src/parsed_reports_merging.py:392
↓ 1 callersMethod_get_serialized_tables_by_page
Group serialized tables by page number
src/text_splitter.py:8
↓ 1 callersMethod_get_table_by_id
Get table representation by ID from report data. Returns markdown or serialized text based on configuration.
src/parsed_reports_merging.py:382
↓ 1 callersMethod_handle_processing_error
Handle errors during question processing. Log error details and return a dictionary containing error information.
src/questions_processing.py:322
↓ 1 callersMethod_initialize_paths
Initialize paths configuration based on run config settings
src/pipeline.py:70
↓ 1 callersMethod_load_dbs
(self)
src/retrieval.py:106
↓ 1 callersMethod_load_questions
(self, questions_file_path: Optional[Union[str, Path]])
src/questions_processing.py:50
↓ 1 callersMethod_normalize_page_sequence
Ensure that page numbers in content are sequential by filling gaps with empty pages.
src/pdf_parsing.py:125
↓ 1 callersMethod_parse_csv_metadata
Parse CSV file and create a lookup dictionary with sha1 as key.
src/pdf_parsing.py:54
↓ 1 callersMethod_parse_structured_response
(self, response_text, response_format)
src/api_requests.py:286
↓ 1 callersMethod_post_process_submission_answers
Post-process answers for submission format: 1. Convert page indices from one-based to zero-based 2. Clear references for N/A
src/questions_processing.py:362
↓ 1 callersMethod_process_picture_block
(self, picture, data)
src/pdf_parsing.py:523
↓ 1 callersMethod_process_report
(self, report: dict)
src/ingestion.py:89
↓ 1 callersMethod_process_single_question
(self, question_data: dict)
src/questions_processing.py:268
↓ 1 callersMethod_render_list_group
Render list group with optional header, text and footnotes.
src/parsed_reports_merging.py:356
↓ 1 callersMethod_render_table_group
Render table group with optional header, text and footnotes.
src/parsed_reports_merging.py:329
↓ 1 callersMethod_reparse_response
(self, response, system_content)
src/api_requests.py:223
↓ 1 callersMethod_reparse_response
Reparse invalid JSON responses using the model itself.
src/api_requests.py:298
↓ 1 callersMethod_send_serialization_request
(self, table, context_before, context_after)
src/tables_serialization.py:106
↓ 1 callersMethod_serialize_table
(self, json_report: dict, target_table_index: int)
src/tables_serialization.py:136
↓ 1 callersMethod_set_up_llm
(self)
src/retrieval.py:87
↓ 1 callersMethod_set_up_llm
(self)
src/ingestion.py:56
↓ 1 callersMethod_set_up_llm
(self)
src/api_requests.py:245
↓ 1 callersMethod_split_page
Split page text into chunks. The original text includes markdown tables.
src/text_splitter.py:70
↓ 1 callersMethod_split_report
Split report into chunks, preserving markdown tables in content and optionally including serialized tables.
src/text_splitter.py:33
↓ 1 callersMethod_table_to_md
(self, table)
src/pdf_parsing.py:472
↓ 1 callersMethod_validate_page_references
Validate that all page numbers mentioned in the LLM's answer are actually from the retrieval results. If fewer than min_pages valid r
src/questions_processing.py:87
↓ 1 callersFunctionapi_endpoint_from_url
Extract the API endpoint from the request URL.
src/api_request_parallel_processor.py:351
↓ 1 callersMethodassemble_content
(self, data)
src/pdf_parsing.py:356
↓ 1 callersMethodassemble_metainfo
(self, data)
src/pdf_parsing.py:266
↓ 1 callersMethodassemble_pictures
(self, data)
src/pdf_parsing.py:497
↓ 1 callersMethodassemble_report
Assemble the report using either normalized data or raw conversion result.
src/pdf_parsing.py:255
↓ 1 callersMethodassemble_tables
(self, tables, data)
src/pdf_parsing.py:435
↓ 1 callersMethodasync_serialize_tables
Process all tables in the report asynchronously
src/tables_serialization.py:171
↓ 1 callersMethodcall_api
Calls the OpenAI API and saves results.
src/api_request_parallel_processor.py:284
↓ 1 callersMethodchunk_reports
Split processed reports into smaller chunks for better processing.
src/pipeline.py:171
↓ 1 callersFunctioncli
Pipeline command line interface for processing PDF reports and questions.
main.py:6
↓ 1 callersMethodconvert_documents
(self, input_doc_paths: List[Path])
src/pdf_parsing.py:94
↓ 1 callersMethodcreate_bm25_index
Create a BM25 index from a list of text chunks.
src/ingestion.py:20
↓ 1 callersMethodcreate_vector_dbs
Create vector databases from chunked reports.
src/pipeline.py:186
↓ 1 callersMethoddebug_data
(self, data)
src/pdf_parsing.py:288
↓ 1 callersMethoddownload_docling_models
()
src/pipeline.py:104
↓ 1 callersMethodexpand_groups
(self, body_children, groups)
src/pdf_parsing.py:297
↓ 1 callersMethodexport_reports_to_markdown
Export processed reports to markdown format for review.
src/pipeline.py:162
↓ 1 callersMethodexport_to_markdown
Export processed reports to markdown files. Args: reports_dir: Directory containing JSON report files output_
src/parsed_reports_merging.py:414
↓ 1 callersMethodget_headers
(self)
src/reranking.py:14
↓ 1 callersMethodget_rank_for_multiple_blocks
(self, query, retrieved_documents)
src/reranking.py:64
↓ 1 callersMethodget_rank_for_single_block
(self, query, retrieved_document)
src/reranking.py:46
↓ 1 callersMethodget_rephrased_questions
Use LLM to break down a comparative question into individual questions.
src/api_requests.py:455
↓ 1 callersMethodmerge_reports
Merge complex JSON reports into a simpler structure with a list of pages, where all text blocks are combined into a single string.
src/pipeline.py:153
↓ 1 callersFunctionnum_tokens_consumed_from_request
Count the number of tokens in the request. Only supports completion and embedding requests.
src/api_request_parallel_processor.py:369
↓ 1 callersMethodparse_and_export_parallel
Parse PDF files in parallel using multiple processes. Args: input_doc_paths: List of paths to PDF files to process
src/pdf_parsing.py:177
↓ 1 callersMethodparse_pdf_reports
(self, parallel: bool = True, chunk_size: int = 2, max_workers: int = 10)
src/pipeline.py:204
↓ 1 callersMethodparse_pdf_reports_parallel
Parse PDF reports in parallel using multiple processes. Args: chunk_size: Number of PDFs to process in each worker
src/pipeline.py:121
↓ 1 callersMethodparse_pdf_reports_sequential
(self)
src/pipeline.py:109
↓ 1 callersMethodprepare_page_text
Main method to process page blocks and return assembled string.
src/parsed_reports_merging.py:82
↓ 1 callersMethodprocess_all_questions
(self, output_path: str = 'questions_with_answers.json', team_email: str = "79250515615@yandex.com", submissio
src/questions_processing.py:442
↓ 1 callersFunctionprocess_api_requests_from_file
Processes API requests in parallel, throttling to stay under rate limits.
src/api_request_parallel_processor.py:92
↓ 1 callersMethodprocess_comparative_question
Process a question involving multiple companies in parallel: 1. Rephrase the comparative question into individual questions 2
src/questions_processing.py:453
↓ 1 callersMethodprocess_directory_parallel
Process JSON files in parallel using thread pool. Args: input_dir: Path to directory containing JSON files ma
src/tables_serialization.py:263
↓ 1 callersMethodprocess_documents
(self, conv_results: Iterable[ConversionResult])
src/pdf_parsing.py:98
↓ 1 callersMethodprocess_parsed_reports
Process already parsed PDF reports through the pipeline: 1. Merge to simpler JSON structure 2. Export to markdown 3. Chunk the
src/pipeline.py:210
↓ 1 callersMethodprocess_question
(self, question: str, schema: str)
src/questions_processing.py:184
↓ 1 callersMethodprocess_questions
(self)
src/pipeline.py:254
↓ 1 callersMethodprocess_questions_list
(self, questions_list: List[dict], output_path: str = None, submission_file: bool = False, team_email: str = "
src/questions_processing.py:233
↓ 1 callersMethodprocess_reports
Process reports from a directory or list of paths, returning a list of processed reports and saving them to an output directory if s
src/parsed_reports_merging.py:17
↓ 1 callersMethodprocess_reports
Process all reports and save individual BM25 indices. Args: all_reports_dir (Path): Directory containing the JSON report
src/ingestion.py:25
↓ 1 callersMethodprocess_reports
(self, all_reports_dir: Path, output_dir: Path)
src/ingestion.py:95
↓ 1 callersMethodprocess_structured_ouputs_requests
( self, model="gpt-4o-mini-2024-07-18", temperature=0.5, seed=None, sy
src/api_requests.py:486
↓ 1 callersMethodrerank_documents
Rerank multiple documents using parallel processing with threading. Combines vector similarity and LLM relevance scores using weighte
src/reranking.py:88
next →1–100 of 158, ranked by callers