feat: add gateway client with env-driven assembly

Includes config aggregation for multi-source env keys, from_env and
from_settings factories with explicit shared-backend injection,
gather_bounded, top-level exports, tightened import-linter layers with
the gate removed from the Makefile, and the finalized .env.example.
This commit is contained in:
2026-07-20 07:47:05 -04:00
parent 936895919c
commit 7b9815f4bc
30 changed files with 1701 additions and 253 deletions
+41 -3
View File
@@ -1,7 +1,45 @@
"""PolyGateway实验室统一的大语言模型LLM/VLM/OCR调度与中转库。
"""PolyGateway: 实验室统一的大语言模型(LLM/VLM/OCR)调度与中转库。
治理单位是一次模型调用多源选择、限流、错误分类与重试、熔断、响应缓存、
流式活性看门狗、遥测(含成本)。架构单一事实源见 research-wiki/ARCHITECTURE.md。
治理单位是一次模型调用: 多源选择、限流、错误分类与重试、熔断、响应缓存、
流式活性看门狗、遥测。架构单一事实源见 research-wiki/ARCHITECTURE.md。
顶层导出即公共 API 面: 错误四分类必须从这里引用(ARCH §5.1 约定②)。
"""
from polygateway.client import GatewayClient, gather_bounded
from polygateway.config import GatewaySettings
from polygateway.errors import (
AllSourcesExhausted,
CircuitOpenError,
GatewayUnavailableError,
GovernanceBackendError,
PolyGatewayError,
RequestRejectedError,
ResultInvalidError,
SourceDeadError,
TransientError,
)
from polygateway.providers import DEFAULT_PROFILES, ProviderProfile, register_provider
from polygateway.types import LLMResponse, SourceConfig
__version__ = "0.1.0"
__all__ = [
"DEFAULT_PROFILES",
"AllSourcesExhausted",
"CircuitOpenError",
"GatewayClient",
"GatewaySettings",
"GatewayUnavailableError",
"GovernanceBackendError",
"LLMResponse",
"PolyGatewayError",
"ProviderProfile",
"RequestRejectedError",
"ResultInvalidError",
"SourceConfig",
"SourceDeadError",
"TransientError",
"__version__",
"gather_bounded",
"register_provider",
]