MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / import_cloud_document

Function import_cloud_document

openkb/indexer.py:339–367  ·  view source on GitHub ↗

Import an already-indexed PageIndex Cloud document by ``doc_id``. Fetches structure + OCR'd page content from the cloud (no local PDF) and writes the same wiki artifacts as :func:`index_long_document`. Requires ``PAGEINDEX_API_KEY``. ``path_key`` is the synthetic identity key (``pag

(doc_id: str, kb_dir: Path, path_key: str)

Source from the content-addressed store, hash-verified

337
338
339def import_cloud_document(doc_id: str, kb_dir: Path, path_key: str) -> CloudImportResult:
340 """Import an already-indexed PageIndex Cloud document by ``doc_id``.
341
342 Fetches structure + OCR'd page content from the cloud (no local PDF) and
343 writes the same wiki artifacts as :func:`index_long_document`. Requires
344 ``PAGEINDEX_API_KEY``. ``path_key`` is the synthetic identity key
345 (``pageindex-cloud:<doc_id>``) used to resolve a collision-resistant
346 wiki name.
347
348 Writes immediately. Callers that need to snapshot before writing (e.g. the
349 crash-safe CLI path) should call :func:`prepare_cloud_import` then
350 :func:`_write_long_doc_artifacts`, so the snapshot can cover only this
351 doc&#x27;s paths.
352 """
353 cloud = prepare_cloud_import(doc_id, kb_dir, path_key)
354 _write_long_doc_artifacts(
355 cloud.tree,
356 cloud.all_pages,
357 cloud.doc_name,
358 cloud.doc_id,
359 kb_dir,
360 description=cloud.description,
361 )
362 return CloudImportResult(
363 doc_id=cloud.doc_id,
364 doc_name=cloud.doc_name,
365 name=cloud.cloud_name,
366 description=cloud.description,
367 )

Calls 3

prepare_cloud_importFunction · 0.85
CloudImportResultClass · 0.85