Skip to content

Commit

Permalink
feat(client-bedrock-agent): Add support for user metadata inside Prom…
Browse files Browse the repository at this point in the history
…ptVariant.
  • Loading branch information
awstools committed Sep 4, 2024
1 parent abd27ba commit bf60228
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ export interface CreateAgentCommandOutput extends CreateAgentResponse, __Metadat
* For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts.html">Advanced prompts</a>.</p>
* </li>
* <li>
* <p>If you agent fails to be created, the response returns a list of <code>failureReasons</code> alongside a list of <code>recommendedActions</code> for you to troubleshoot.</p>
* <p>If your agent fails to be created, the response returns a list of <code>failureReasons</code> alongside a list of <code>recommendedActions</code> for you to troubleshoot.</p>
* </li>
* <li>
* <p>The agent instructions will not be honored if your agent has only one knowledge base, uses default prompts, has no action group, and user input is disabled.</p>
* </li>
* </ul>
* @example
Expand Down
12 changes: 12 additions & 0 deletions clients/client-bedrock-agent/src/commands/CreatePromptCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ export interface CreatePromptCommandOutput extends CreatePromptResponse, __Metad
* ],
* },
* },
* metadata: [ // PromptMetadataList
* { // PromptMetadataEntry
* key: "STRING_VALUE", // required
* value: "STRING_VALUE", // required
* },
* ],
* },
* ],
* clientToken: "STRING_VALUE",
Expand Down Expand Up @@ -111,6 +117,12 @@ export interface CreatePromptCommandOutput extends CreatePromptResponse, __Metad
* // ],
* // },
* // },
* // metadata: [ // PromptMetadataList
* // { // PromptMetadataEntry
* // key: "STRING_VALUE", // required
* // value: "STRING_VALUE", // required
* // },
* // ],
* // },
* // ],
* // id: "STRING_VALUE", // required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ export interface CreatePromptVersionCommandOutput extends CreatePromptVersionRes
* // ],
* // },
* // },
* // metadata: [ // PromptMetadataList
* // { // PromptMetadataEntry
* // key: "STRING_VALUE", // required
* // value: "STRING_VALUE", // required
* // },
* // ],
* // },
* // ],
* // id: "STRING_VALUE", // required
Expand Down
6 changes: 6 additions & 0 deletions clients/client-bedrock-agent/src/commands/GetPromptCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ export interface GetPromptCommandOutput extends GetPromptResponse, __MetadataBea
* // ],
* // },
* // },
* // metadata: [ // PromptMetadataList
* // { // PromptMetadataEntry
* // key: "STRING_VALUE", // required
* // value: "STRING_VALUE", // required
* // },
* // ],
* // },
* // ],
* // id: "STRING_VALUE", // required
Expand Down
12 changes: 12 additions & 0 deletions clients/client-bedrock-agent/src/commands/UpdatePromptCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ export interface UpdatePromptCommandOutput extends UpdatePromptResponse, __Metad
* ],
* },
* },
* metadata: [ // PromptMetadataList
* { // PromptMetadataEntry
* key: "STRING_VALUE", // required
* value: "STRING_VALUE", // required
* },
* ],
* },
* ],
* promptIdentifier: "STRING_VALUE", // required
Expand Down Expand Up @@ -108,6 +114,12 @@ export interface UpdatePromptCommandOutput extends UpdatePromptResponse, __Metad
* // ],
* // },
* // },
* // metadata: [ // PromptMetadataList
* // { // PromptMetadataEntry
* // key: "STRING_VALUE", // required
* // value: "STRING_VALUE", // required
* // },
* // ],
* // },
* // ],
* // id: "STRING_VALUE", // required
Expand Down
36 changes: 35 additions & 1 deletion clients/client-bedrock-agent/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3280,7 +3280,7 @@ export type ParsingStrategy = (typeof ParsingStrategy)[keyof typeof ParsingStrat
* </p>
* </li>
* </ul>
* <p>You can get the ARN of a model with the action. Standard model usage
* <p>You can get the ARN of a model with the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_ListFoundationModels.html">ListFoundationModels</a> action. Standard model usage
* charges apply for the foundation model parsing strategy.</p>
* @public
*/
Expand Down Expand Up @@ -7437,6 +7437,24 @@ export interface UpdateKnowledgeBaseResponse {
knowledgeBase: KnowledgeBase | undefined;
}

/**
* <p>Contains a key-value pair that defines a metadata tag and value to attach to a prompt variant. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-create.html">Create a prompt using Prompt management</a>.</p>
* @public
*/
export interface PromptMetadataEntry {
/**
* <p>The key of a metadata tag for a prompt variant.</p>
* @public
*/
key: string | undefined;

/**
* <p>The value of a metadata tag for a prompt variant.</p>
* @public
*/
value: string | undefined;
}

/**
* <p>Contains details about a variant of the prompt.</p>
* @public
Expand Down Expand Up @@ -7471,6 +7489,12 @@ export interface PromptVariant {
* @public
*/
inferenceConfiguration?: PromptInferenceConfiguration;

/**
* <p>An array of objects, each containing a key-value pair that defines a metadata tag and value to attach to a prompt variant. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-create.html">Create a prompt using Prompt management</a>.</p>
* @public
*/
metadata?: PromptMetadataEntry[];
}

/**
Expand Down Expand Up @@ -8672,6 +8696,15 @@ export const UpdateFlowResponseFilterSensitiveLog = (obj: UpdateFlowResponse): a
...(obj.definition && { definition: FlowDefinitionFilterSensitiveLog(obj.definition) }),
});

/**
* @internal
*/
export const PromptMetadataEntryFilterSensitiveLog = (obj: PromptMetadataEntry): any => ({
...obj,
...(obj.key && { key: SENSITIVE_STRING }),
...(obj.value && { value: SENSITIVE_STRING }),
});

/**
* @internal
*/
Expand All @@ -8681,6 +8714,7 @@ export const PromptVariantFilterSensitiveLog = (obj: PromptVariant): any => ({
templateConfiguration: PromptTemplateConfigurationFilterSensitiveLog(obj.templateConfiguration),
}),
...(obj.inferenceConfiguration && { inferenceConfiguration: obj.inferenceConfiguration }),
...(obj.metadata && { metadata: SENSITIVE_STRING }),
});

/**
Expand Down
11 changes: 11 additions & 0 deletions clients/client-bedrock-agent/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ import {
PromptFlowNodeSourceConfiguration,
PromptInferenceConfiguration,
PromptInputVariable,
PromptMetadataEntry,
PromptModelInferenceConfiguration,
PromptOverrideConfiguration,
PromptSummary,
Expand Down Expand Up @@ -3480,6 +3481,10 @@ const se_PromptInferenceConfiguration = (input: PromptInferenceConfiguration, co

// se_PromptInputVariablesList omitted.

// se_PromptMetadataEntry omitted.

// se_PromptMetadataList omitted.

/**
* serializeAws_restJson1PromptModelInferenceConfiguration
*/
Expand Down Expand Up @@ -3514,6 +3519,7 @@ const se_PromptOverrideConfiguration = (input: PromptOverrideConfiguration, cont
const se_PromptVariant = (input: PromptVariant, context: __SerdeContext): any => {
return take(input, {
inferenceConfiguration: (_) => se_PromptInferenceConfiguration(_, context),
metadata: _json,
modelId: [],
name: [],
templateConfiguration: _json,
Expand Down Expand Up @@ -4426,6 +4432,10 @@ const de_PromptInferenceConfiguration = (output: any, context: __SerdeContext):

// de_PromptInputVariablesList omitted.

// de_PromptMetadataEntry omitted.

// de_PromptMetadataList omitted.

/**
* deserializeAws_restJson1PromptModelInferenceConfiguration
*/
Expand Down Expand Up @@ -4487,6 +4497,7 @@ const de_PromptSummary = (output: any, context: __SerdeContext): PromptSummary =
const de_PromptVariant = (output: any, context: __SerdeContext): PromptVariant => {
return take(output, {
inferenceConfiguration: (_: any) => de_PromptInferenceConfiguration(__expectUnion(_), context),
metadata: _json,
modelId: __expectString,
name: __expectString,
templateConfiguration: (_: any) => _json(__expectUnion(_)),
Expand Down

0 comments on commit bf60228

Please sign in to comment.