From 26e0e72926f6b8567520dea62f9e58073e7e22f5 Mon Sep 17 00:00:00 2001 From: iomgaa Date: Tue, 21 Jul 2026 23:02:34 -0400 Subject: [PATCH] feat: export OCR public API surface --- src/polygateway/__init__.py | 17 +++++++++++++++-- tests/unit/test_package.py | 9 +++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/polygateway/__init__.py b/src/polygateway/__init__.py index d5aade0..42dc04d 100644 --- a/src/polygateway/__init__.py +++ b/src/polygateway/__init__.py @@ -6,7 +6,7 @@ """ from polygateway.client import GatewayClient, gather_bounded -from polygateway.config import EmbeddingSettings, GatewaySettings +from polygateway.config import EmbeddingSettings, GatewaySettings, OcrSettings from polygateway.embedding import EmbeddingClient from polygateway.errors import ( AllSourcesExhausted, @@ -19,9 +19,17 @@ from polygateway.errors import ( SourceDeadError, TransientError, ) +from polygateway.ocr import OcrClient from polygateway.pricing import ModelPrice, PricingTable from polygateway.providers import DEFAULT_PROFILES, ProviderProfile, register_provider -from polygateway.types import EmbeddingResponse, LLMResponse, SourceConfig +from polygateway.types import ( + EmbeddingResponse, + LLMResponse, + OcrLayoutElement, + OcrLayoutResult, + OcrTextResult, + SourceConfig, +) __version__ = "0.1.0" @@ -38,6 +46,11 @@ __all__ = [ "GovernanceBackendError", "LLMResponse", "ModelPrice", + "OcrClient", + "OcrLayoutElement", + "OcrLayoutResult", + "OcrSettings", + "OcrTextResult", "PolyGatewayError", "PricingTable", "ProviderProfile", diff --git a/tests/unit/test_package.py b/tests/unit/test_package.py index 1d9c49e..cc62d1e 100644 --- a/tests/unit/test_package.py +++ b/tests/unit/test_package.py @@ -5,3 +5,12 @@ import polygateway def test_package_importable_with_version() -> None: assert polygateway.__version__ == "0.1.0" + + +def test_ocr_public_surface_exported(): + """M3 OCR 公共 API 面(设计 §3;transport 结果与 Protocol 不出顶层)。""" + import polygateway + + for name in ("OcrClient", "OcrSettings", "OcrTextResult", "OcrLayoutResult", "OcrLayoutElement"): + assert hasattr(polygateway, name), name + assert name in polygateway.__all__, name