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

Function check_if_toc_transformation_is_complete

pageindex/page_index.py:143–158  ·  view source on GitHub ↗
(content, toc, model=None)

Source from the content-addressed store, hash-verified

141
142
143def check_if_toc_transformation_is_complete(content, toc, model=None):
144 prompt = f"""
145 You are given a raw table of contents and a table of contents.
146 Your job is to check if the table of contents is complete.
147
148 Reply format:
149 {{
150 "thinking": <why do you think the cleaned table of contents is complete or not>
151 "completed": "yes" or "no"
152 }}
153 Directly return the final JSON structure. Do not output anything else."""
154
155 prompt = prompt + '\n Raw Table of contents:\n' + content + '\n Cleaned Table of contents:\n' + toc
156 response = llm_completion(model=model, prompt=prompt)
157 json_content = extract_json(response)
158 return json_content['completed']
159
160def extract_toc_content(content, model=None):
161 prompt = f"""

Callers 2

extract_toc_contentFunction · 0.85
toc_transformerFunction · 0.85

Calls 2

llm_completionFunction · 0.85
extract_jsonFunction · 0.85

Tested by

no test coverage detected