mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-07-15 21:11:05 +02:00
33 lines
959 B
Python
33 lines
959 B
Python
|
|
# pageindex/types.py
|
||
|
|
# TypedDicts describing the plain-dict shapes the SDK returns, so callers get
|
||
|
|
# key/field discovery in their IDE without any runtime cost (these are dicts).
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from typing import Any, TypedDict
|
||
|
|
|
||
|
|
|
||
|
|
class DocumentInfo(TypedDict):
|
||
|
|
"""A document as returned by ``list_documents()``."""
|
||
|
|
doc_id: str
|
||
|
|
doc_name: str
|
||
|
|
doc_description: str
|
||
|
|
doc_type: str
|
||
|
|
|
||
|
|
|
||
|
|
class DocumentDetail(DocumentInfo, total=False):
|
||
|
|
"""A document with its tree, as returned by ``get_document()``.
|
||
|
|
|
||
|
|
``structure`` is always present; ``file_path`` is local-only and
|
||
|
|
``status`` is cloud-only, hence total=False.
|
||
|
|
"""
|
||
|
|
structure: list[dict[str, Any]]
|
||
|
|
file_path: str # local backend only
|
||
|
|
status: str # cloud backend only
|
||
|
|
|
||
|
|
|
||
|
|
class PageContent(TypedDict, total=False):
|
||
|
|
"""One page of content, as returned by ``get_page_content()``."""
|
||
|
|
page: int
|
||
|
|
content: str
|
||
|
|
images: list[dict[str, Any]]
|