

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

# 在模型调用中使用推理配置文件
<a name="inference-profiles-use"></a>

您可以使用跨区域推理配置文件代替基础模型，将请求路由到多个区域。要在一个或多个区域中追踪模型的成本和使用情况，您可以使用应用程序推理配置文件。要了解如何在运行模型推理时使用推理配置文件，请选择与您的首选方法对应的选项卡，然后按照以下步骤操作：

------
#### [ Console ]

要将推理配置文件与支持推理配置文件的功能结合使用，请执行以下操作：

1. 采用有权使用 Amazon Bedrock 控制台的 IAM 身份登录 AWS 管理控制台。然后，通过以下网址打开 Amazon Bedrock 控制台：[https://console.aws.amazon.com/bedrock](https://console.aws.amazon.com/bedrock)。

1. 导航到要使用推理配置文件的功能的页面。例如，从左侧导航窗格中选择**聊天/文本演练场**。

1. 选择**选择模型**，然后选择相应模型。例如，选择 **Amazon**，然后选择 **Nova Premier**。

1. 在**推理**下，从下拉菜单中选择**推理配置文件**。

1. 选择要使用的推理配置文件（例如，**US Nova Premier**），然后选择**应用**。

------
#### [ API ]

通过以下 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) – 要在模型调用中使用推理配置文件，请按照[使用以下命令提交单个提示 InvokeModel](inference-invoke.md)中的步骤操作，并在 `modelId` 字段中指定推理配置文件的 Amazon 资源名称（ARN）。有关示例，请参阅[在模型调用中使用推理配置文件](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModel.html#API_runtime_InvokeModel_Example_5)。
+ [Converse](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html) 或 [ConverseStream](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html) – 要通过 Converse API 在模型调用中使用推理配置文件，请按照[使用 Converse API 操作进行对话](conversation-inference.md)中的步骤操作，并在 `modelId` 字段中指定推理配置文件的 ARN。有关示例，请参阅[在模型调用中使用推理配置文件](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html#API_runtime_Converse_Example_5)。
+ [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) – 要在根据查询知识库的结果生成响应时使用推理配置文件，请按照[利用查询和响应测试知识库](knowledge-base-test.md)中 API 选项卡中的步骤操作，并在 `modelArn` 字段中指定推理配置文件的 ARN。有关更多信息，请参阅[使用推理配置文件生成响应](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_Example_3)。
+ [CreateEvaluationJob](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_CreateEvaluationJob.html) – 要提交模型评测的推理配置文件，请按照[在 Amazon Bedrock 中启动自动模型评测作业](model-evaluation-jobs-management-create.md)中 API 选项卡中的步骤操作，并在 `modelIdentifier` 字段中指定推理配置文件的 ARN。
+ [CreatePrompt](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_CreatePrompt.html) – 要在为提示管理中创建的提示生成响应时使用推理配置文件，请按照[使用提示管理器创建提示](prompt-management-create.md)中 API 选项卡中的步骤操作，并在 `modelId` 字段中指定推理配置文件的 ARN。
+ [CreateFlow](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_CreateFlow.html) – 要在为在流的提示节点内定义的内联提示生成响应时使用推理配置文件，请按照[在 Amazon Bedrock 中创建和设计流](flows-create.md)中 API 选项卡中的步骤进行操作。在定义[提示节点](flows-nodes.md#flows-nodes-prompt)时，在 `modelId` 字段中指定推理配置文件的 ARN。
+ [CreateDataSource](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_CreateDataSource.html) – 要在解析数据来源中的非文本信息时使用推理配置文件，请按照[数据来源的解析选项](kb-advanced-parsing.md)中 API 部分中的步骤操作，并在 `modelArn` 字段中指定推理配置文件的 ARN。

**注意**  
如果您使用的是跨区域（系统定义的）推理配置文件，则可使用推理配置文件的 ARN 或 ID。

------