

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 了解不同模型推理方法的使用案例
<a name="inference-methods"></a>

您可以通过以下方法直接运行模型推理：


****  

| 方法 | 使用案例 | 
| --- | --- | 
| [Amazon Bedrock 控制台演练场](playgrounds.md) | 在用户友好的图形界面中运行推理。便于探索。 | 
| [Converse 或 [ConverseStream](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html)](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html) | 使用统一的 API 实现对话式应用程序，用于模型输入。 | 
| [InvokeModel](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModel.html) 或 [InvokeModelWithResponseStream](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModelWithResponseStream.html) | 提交单个提示并同步生成响应。对于实时生成响应或搜索查询很有用。 | 
| [StartAsyncInvoke](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_StartAsyncInvoke.html) | 提交单个提示并异步生成响应。对于大规模生成响应很有用。 | 
| [CreateModelInvocationJob](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_CreateModelInvocationJob.html) | 准备提示数据集并批量生成响应。 | 
| [响应 API](https://platform.openai.com/docs/api-reference/responses) | 对于需要使用内置工具（搜索、代码解释器）、多模态输入和有状态对话的现代代理应用程序，请使用 Responses API。 | 
| [聊天完成次数](https://platform.openai.com/docs/api-reference/chat) | 使用 Chat Completions API 执行轻量级、无状态、以文本为重点的任务，在这些任务中，您需要完全控制聊天记录管理和降低延迟。 | 

以下 Amazon Bedrock 功能还使用模型推理作为更大工作流中的一个步骤：
+ 在您提交[CreateEvaluationJob](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_CreateEvaluationJob.html)请求后，[模型评估](evaluation.md)使用模型调用过程来评估不同模型的性能。
+ 在使用 [https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html) API 根据从知识库中检索到的结果生成响应时，[知识库](knowledge-base.md)会使用模型调用。
+ [代理](agents.md)会使用模型调用在 [https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html) 请求期间的不同阶段生成响应。
+ [流](flows.md)包括使用模型调用的 Amazon Bedrock 资源，例如提示、知识库和代理。

在测试了具有不同提示和推理参数的不同基础模型之后，您可以将应用程序配置为按照所需的规格调 APIs 用这些模型。