MCPcopy
hub / github.com/VectifyAI/PageIndex / process_no_toc

Function process_no_toc

pageindex/page_index.py:576–595  ·  view source on GitHub ↗
(page_list, start_index=1, model=None, logger=None)

Source from the content-addressed store, hash-verified

574 raise Exception(f'finish reason: {finish_reason}')
575
576def process_no_toc(page_list, start_index=1, model=None, logger=None):
577 page_contents=[]
578 token_lengths=[]
579 for page_index in range(start_index, start_index+len(page_list)):
580 page_text = f"<physical_index_{page_index}>\n{page_list[page_index-start_index][0]}\n<physical_index_{page_index}>\n\n"
581 page_contents.append(page_text)
582 token_lengths.append(count_tokens(page_text, model))
583 group_texts = page_list_to_group_text(page_contents, token_lengths)
584 logger.info(f'len(group_texts): {len(group_texts)}')
585
586 toc_with_page_number= generate_toc_init(group_texts[0], model)
587 for group_text in group_texts[1:]:
588 toc_with_page_number_additional = generate_toc_continue(toc_with_page_number, group_text, model)
589 toc_with_page_number.extend(toc_with_page_number_additional)
590 logger.info(f'generate_toc: {toc_with_page_number}')
591
592 toc_with_page_number = convert_physical_index_to_int(toc_with_page_number)
593 logger.info(f'convert_physical_index_to_int: {toc_with_page_number}')
594
595 return toc_with_page_number
596
597def process_toc_no_page_numbers(toc_content, toc_page_list, page_list, start_index=1, model=None, logger=None):
598 page_contents=[]

Callers 1

meta_processorFunction · 0.85

Calls 6

count_tokensFunction · 0.85
page_list_to_group_textFunction · 0.85
generate_toc_initFunction · 0.85
generate_toc_continueFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected