Expand description
统一客户端接口:提供协议驱动的 AI 模型交互入口。
Unified client interface for AI-Protocol runtime.
Developer-friendly goal: keep the public surface small and predictable.
Implementation details are split into submodules under src/client/.
Modules§
- builder
- chat
- core
- 核心客户端实现:管理协议加载、传输、流水线及弹性策略。
- endpoint
- Endpoint resolution and service calls
- error_
classification - 错误分类逻辑:将 HTTP 状态码和提供商错误映射到 V2 标准错误码。
- signals
- types
Structs§
- AiClient
- Unified AI client that works with any provider through protocol configuration.
- AiClient
Builder - Builder for creating clients with custom configuration.
- Call
Stats - Per-call statistics for observability and model selection.
- Cancel
Handle - Handle to cancel an in-flight streaming request.
- Chat
Batch Request - Batch chat request parameters (developer-friendly, small surface).
- Chat
Request Builder - Builder for chat requests.
- Client
Metrics - Snapshot of cumulative client metrics for monitoring and routing.
- Policy
Engine - Internal policy engine that unifies retry / fallback behavior.
- Signals
Snapshot - A lightweight, provider-agnostic snapshot of runtime “signals” for orchestration.
- Unified
Response - Unified response format.
Enums§
- Decision
- Internal decision for how to proceed after a failed attempt.
Traits§
Functions§
- classify_
error_ from_ response - Classify an error from HTTP status and optional response body.