

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

# 删除推荐
<a name="recommendations-delete"></a>

删除建议及其关联的元数据。建议必须处于终端状态（`COMPLETED`或`FAILED`），然后才能删除。

删除推荐会将记录从中删除`ListRecommendations`。它不会影响作为建议结果的一部分创建的任何配置包版本。

## 代码示例
<a name="delete-rec-examples"></a>

**Example**  

```
import boto3

client = boto3.client("bedrock-agentcore", region_name="us-west-2")

response = client.delete_recommendation(
    recommendationId="MyPromptRec-Ab1Cd2Ef3G"
)
print(f"Deleted: {response['recommendationId']}")
print(f"Status: {response['status']}")
```

```
agentcore archive recommendation -i MyPromptRec-Ab1Cd2Ef3G
```
建议必须处于终端状态（`COMPLETED`或`FAILED`）。此命令将建议作业记录存档在服务上，并清除本地历史记录。

## 请求参数
<a name="delete-rec-params"></a>


| 参数 | Type | 必需 | 描述 | 
| --- | --- | --- | --- | 
|  `recommendationId`  | 字符串 | 是 | 要删除的推荐 ID。作为路径参数传递。 | 

## 响应
<a name="delete-rec-response"></a>


| 字段 | Type | 说明 | 
| --- | --- | --- | 
|  `recommendationId`  | 字符串 | 推荐 ID。 | 
|  `status`  | 字符串 | 已删除建议的状态 (`DELETING`)。 | 

## 错误
<a name="delete-rec-errors"></a>


| 错误 | HTTP 状态 | 说明 | 
| --- | --- | --- | 
|  `ResourceNotFoundException`  | 404 | 未找到具有指定 ID 的推荐。 | 
|  `ConflictException`  | 409 | 该建议仍在执行中（`PENDING`或`IN_PROGRESS`）。等待它完成或失败后再删除。 | 
|  `ValidationException`  | 400 | 推荐 ID 格式无效。 | 
|  `AccessDeniedException`  | 403 | 权限不足。 | 
|  `ThrottlingException`  | 429 | 超出请求速率。 | 
|  `InternalServerException`  | 500 | Service-side 错误。 | 