AI English Shift · Lessons / E01
Anatomy of a production AI application
生产级 AI 应用的组成
Open the interactive lesson · 打开互动课程A production AI application connects a user interface, application logic, data services, a model interface, and operational controls.
生产级 AI 应用连接了用户界面、应用逻辑、数据服务、模型接口和运行控制机制。
本番のAIアプリは、利用画面、アプリのロジック、データサービス、モデルのインターフェース、運用制御をつなぎます。
The user may see a single answer box, but the request can pass through authentication, retrieval, model generation, validation, and persistence.
用户可能只看到一个回答框,但请求可能依次经过身份验证、检索、模型生成、验证和持久化存储。
利用者には回答欄が一つ見えていても、要求は認証、検索、生成、検証、保存を通過することがあります。
Each boundary needs a contract describing accepted input, returned output, errors, and who is allowed to invoke the operation.
每个边界都需要一份契约,说明接受什么输入、返回什么输出、可能出现什么错误,以及谁有权调用该操作。
各境界には、入力、出力、エラー、操作を呼べる主体を定める約束が必要です。
For example, a retrieval service should return passage identities and versions, not only anonymous text fragments.
例如,检索服务应该返回段落标识和版本,而不只是没有来源标识的文本片段。
たとえば検索サービスは、出所の分からない文章だけでなく、文章のIDと版も返すべきです。
The generation component can then attach claims to identifiable evidence, while the application decides whether the result meets the task's requirements.
这样,生成组件就能将主张关联到可识别的证据,而应用负责判断结果是否满足任务要求。
生成部は特定できる根拠に主張を結び付け、アプリは結果が要件を満たすか判断できます。
A slow external dependency creates a user-experience problem even when the model itself responds quickly.
即使模型本身响应很快,缓慢的外部依赖仍会影响用户体验。
モデル自体が速くても、外部の依存先が遅いと利用体験に問題が生じます。
Define timeouts and cancellation so that an abandoned request does not continue creating unnecessary work or external changes.
应明确超时和取消机制,避免已被放弃的请求继续产生不必要的工作或外部变更。
中断した要求が不要な作業や外部変更を続けないよう、時間制限とキャンセルを定義します。
Background queues can support longer jobs, but they require job identities, status transitions, and a way to retrieve the eventual result.
后台队列可以支持耗时较长的作业,但需要作业标识、状态转换机制,以及获取最终结果的方式。
バックグラウンドのキューは長い作業を支えますが、ジョブID、状態遷移、最終結果の取得方法が必要です。
Streaming can show progress, while persistent storage records the completed artifact and the versions needed to investigate it later.
流式输出可以显示进度,而持久化存储则记录完成的产物,以及日后调查所需的版本信息。
ストリーミングで進行を示し、永続的な保存先には完成物と後の調査に必要な版を記録できます。
Logs should connect stages through an appropriate request identifier without unnecessarily retaining confidential input.
日志应通过合适的请求标识符串联各个阶段,同时避免不必要地保留机密输入。
ログは適切なリクエストIDで各段階をつなぎ、機密の入力を不要に保持しないようにします。
An integration test should exercise a complete representative task and at least one dependency failure, rather than only call the model successfully.
集成测试应该执行一项完整且有代表性的任务,并至少覆盖一种依赖故障,而不只是成功调用模型。
結合テストでは、モデル呼び出しの成功だけでなく、代表的な作業全体と少なくとも一つの依存先の失敗を検証します。
The architecture is ready to review when another engineer can explain where evidence enters, where authority is checked, what persists, and how a failed request recovers.
当另一位工程师能够解释证据从哪里进入、在哪里检查权限、哪些内容会被保存,以及失败请求如何恢复时,这套架构才具备接受评审的条件。
根拠の入口、権限を確認する場所、保存するもの、失敗からの復旧を別の技術者が説明できると、構成をレビューできます。
Key terms
- Model: A computational system whose structure and learned parameters determine how it maps inputs to outputs.
- Harness: The surrounding software that manages model calls, tools, context and execution controls.
- Context: Information available to influence a particular model request, including supplied instructions and task data.
- Tool: A capability exposed through an interface for a model-driven system to request information or actions.
- Access control: Rules and enforcement mechanisms governing who can access resources or perform operations.
- Streaming: Delivering output incrementally as it becomes available.
- Monitoring: Ongoing observation of system behavior, quality and operational signals after deployment.