014fc2bfa7
Patch rather than minor: the error surface is unchanged and no public signature moved. What downstream must notice is timing, not types — the worst-case call duration rises to roughly max_attempts * timeout_s now that the retry budget actually applies. Pre-release review caught an overreaching promise in the changelog entry: the 429 bound holds only when the stall verdict can fire at all, i.e. when the whole scope has no progress. The verdict is a conjunction, so a call does not die while other calls in the scope are still producing — by design — which leaves no hard per-call ceiling in that case. That property predates this fix and is now stated with its precondition instead of as an unconditional guarantee. The wiki sync in the release checklist is a no-op again: the doc site has been down since 2026-08-02 and its landing page names CHANGELOG.md as the version source of truth, which this commit updates.
68 lines
1.9 KiB
Python
68 lines
1.9 KiB
Python
"""PolyGateway: 实验室统一的大语言模型(LLM/VLM/OCR)调度与中转库。
|
|
|
|
治理单位是一次模型调用: 多源选择、限流、错误分类与重试、熔断、响应缓存、
|
|
流式活性看门狗、遥测。架构单一事实源见 research-wiki/ARCHITECTURE.md。
|
|
顶层导出即公共 API 面: 错误四分类必须从这里引用(ARCH §5.1 约定②)。
|
|
"""
|
|
|
|
from polygateway.client import GatewayClient, gather_bounded
|
|
from polygateway.config import EmbeddingSettings, GatewaySettings, OcrSettings
|
|
from polygateway.embedding import EmbeddingClient
|
|
from polygateway.errors import (
|
|
AllSourcesExhausted,
|
|
CircuitOpenError,
|
|
GatewayUnavailableError,
|
|
GovernanceBackendError,
|
|
PolyGatewayError,
|
|
RequestRejectedError,
|
|
ResultInvalidError,
|
|
SourceDeadError,
|
|
SourceNotConfiguredError,
|
|
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,
|
|
OcrLayoutElement,
|
|
OcrLayoutResult,
|
|
OcrTextResult,
|
|
SourceConfig,
|
|
)
|
|
|
|
__version__ = "1.1.1"
|
|
|
|
__all__ = [
|
|
"DEFAULT_PROFILES",
|
|
"AllSourcesExhausted",
|
|
"CircuitOpenError",
|
|
"EmbeddingClient",
|
|
"EmbeddingResponse",
|
|
"EmbeddingSettings",
|
|
"GatewayClient",
|
|
"GatewaySettings",
|
|
"GatewayUnavailableError",
|
|
"GovernanceBackendError",
|
|
"LLMResponse",
|
|
"ModelPrice",
|
|
"OcrClient",
|
|
"OcrLayoutElement",
|
|
"OcrLayoutResult",
|
|
"OcrSettings",
|
|
"OcrTextResult",
|
|
"PolyGatewayError",
|
|
"PricingTable",
|
|
"ProviderProfile",
|
|
"RequestRejectedError",
|
|
"ResultInvalidError",
|
|
"SourceConfig",
|
|
"SourceDeadError",
|
|
"SourceNotConfiguredError",
|
|
"TransientError",
|
|
"__version__",
|
|
"gather_bounded",
|
|
"register_provider",
|
|
]
|