mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-05-13 00:32:36 +02:00
* feat:compatible with Pageindex SDK
* corner cases fixed
* fix: mock behavior of old SDK
* fix: close streaming response and warn on empty api_key
- LegacyCloudAPI: close response in `finally` for both _stream_chat_response
variants so abandoned iterators no longer leak the TCP connection.
- PageIndexClient: emit a warning instead of silently falling back to local
when api_key is the empty string, surfacing typical env-var-unset misconfig.
- FakeResponse: add close()/closed to match the real requests.Response API.
- Add unit coverage for stream close (both paths) and the empty-api_key warning.
- Add scripts/e2e_legacy_sdk.py to smoke-test the legacy SDK contract end-to-end
against api.pageindex.ai.
* chore: mark legacy SDK methods with @deprecated and docstring pointers
- Decorate the 12 PageIndexClient cloud-SDK compat methods with
@typing_extensions.deprecated(..., category=PendingDeprecationWarning):
- IDE/type-checkers render them with a strikethrough hint
- runtime warnings stay silent by default (no spam for existing callers),
surfaceable via `python -W default::PendingDeprecationWarning`
- Add a one-line docstring on each pointing to the Collection-based equivalent.
- Promote typing-extensions to a direct dependency (was transitive via litellm).
---------
Co-authored-by: XinyanZhou <xinyanzhou@XinyanZhoudeMacBook-Pro.local>
Co-authored-by: saccharin98 <xinyanzhou938@gmail.com>
Co-authored-by: mountain <kose2livs@gmail.com>
42 lines
1 KiB
Python
42 lines
1 KiB
Python
# pageindex/__init__.py
|
|
# Upstream exports (backward compatibility)
|
|
from .page_index import *
|
|
from .page_index_md import md_to_tree
|
|
from .retrieve import get_document, get_document_structure, get_page_content
|
|
|
|
# SDK exports
|
|
from .client import PageIndexClient, LocalClient, CloudClient
|
|
from .config import IndexConfig
|
|
from .collection import Collection
|
|
from .parser.protocol import ContentNode, ParsedDocument, DocumentParser
|
|
from .storage.protocol import StorageEngine
|
|
from .events import QueryEvent
|
|
from .errors import (
|
|
PageIndexError,
|
|
PageIndexAPIError,
|
|
CollectionNotFoundError,
|
|
DocumentNotFoundError,
|
|
IndexingError,
|
|
CloudAPIError,
|
|
FileTypeError,
|
|
)
|
|
|
|
__all__ = [
|
|
"PageIndexClient",
|
|
"LocalClient",
|
|
"CloudClient",
|
|
"IndexConfig",
|
|
"Collection",
|
|
"ContentNode",
|
|
"ParsedDocument",
|
|
"DocumentParser",
|
|
"StorageEngine",
|
|
"QueryEvent",
|
|
"PageIndexError",
|
|
"PageIndexAPIError",
|
|
"CollectionNotFoundError",
|
|
"DocumentNotFoundError",
|
|
"IndexingError",
|
|
"CloudAPIError",
|
|
"FileTypeError",
|
|
]
|