2026-05-26 14:38:39 +08:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
os.environ.setdefault("LITELLM_LOCAL_MODEL_COST_MAP", "true")
|
|
|
|
|
|
2026-05-26 20:30:08 +08:00
|
|
|
_OPTIONAL_CORE_IMPORTS = {"litellm", "openai", "PyPDF2", "pymupdf"}
|
|
|
|
|
|
2026-05-26 01:41:57 +08:00
|
|
|
try:
|
|
|
|
|
from .page_index import *
|
|
|
|
|
from .page_index_md import md_to_tree
|
|
|
|
|
from .retrieve import get_document, get_document_structure, get_page_content
|
|
|
|
|
from .client import PageIndexClient
|
|
|
|
|
except ModuleNotFoundError as exc:
|
2026-05-26 20:30:08 +08:00
|
|
|
if exc.name not in _OPTIONAL_CORE_IMPORTS:
|
2026-05-26 01:41:57 +08:00
|
|
|
raise
|
|
|
|
|
|
2026-05-26 20:30:08 +08:00
|
|
|
|
|
|
|
|
def __getattr__(name: str):
|
|
|
|
|
if name == "PageIndexFileSystem":
|
|
|
|
|
from .filesystem import PageIndexFileSystem
|
|
|
|
|
|
|
|
|
|
return PageIndexFileSystem
|
|
|
|
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|