diff --git a/clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts b/clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts index b681588d2716..1175c987576b 100644 --- a/clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts +++ b/clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts @@ -507,6 +507,18 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat * // promptCreationMode: "DEFAULT" || "OVERRIDDEN", * // parserMode: "DEFAULT" || "OVERRIDDEN", * // }, + * // modelInvocationOutput: { // OrchestrationModelInvocationOutput + * // traceId: "STRING_VALUE", + * // rawResponse: { // RawResponse + * // content: "STRING_VALUE", + * // }, + * // metadata: { // Metadata + * // usage: { // Usage + * // inputTokens: Number("int"), + * // outputTokens: Number("int"), + * // }, + * // }, + * // }, * // }, * // postProcessingTrace: { // PostProcessingTrace Union: only one key present * // modelInvocationInput: { diff --git a/clients/client-bedrock-agent-runtime/src/commands/InvokeFlowCommand.ts b/clients/client-bedrock-agent-runtime/src/commands/InvokeFlowCommand.ts index e18572a4ac85..b388caae2b05 100644 --- a/clients/client-bedrock-agent-runtime/src/commands/InvokeFlowCommand.ts +++ b/clients/client-bedrock-agent-runtime/src/commands/InvokeFlowCommand.ts @@ -38,6 +38,9 @@ export interface InvokeFlowCommandOutput extends InvokeFlowResponse, __MetadataB /** *
Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.
+ *The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeFlow
.
The input for the flow input node.
+ *The input to send to the prompt flow input node.
* @public */ export interface DocumentMember { @@ -282,7 +282,7 @@ export namespace FlowInputContent { } /** - *Contains information about an input into the flow and what to do with it.
+ *Contains information about an input into the prompt flow and where to send it.
*This data type is used in the following API operations:
*A name for the input of the flow input node.
+ *The name of the flow input node that begins the prompt flow.
* @public */ nodeName: string | undefined; /** - *A name for the output of the flow input node.
+ *The name of the output from the flow input node that begins the prompt flow.
* @public */ nodeOutputName: string | undefined; /** - *Contains information about an input into the flow.
+ *Contains information about an input into the prompt flow.
* @public */ content: FlowInputContent | undefined; @@ -370,7 +370,7 @@ export interface FlowCompletionEvent { } /** - *Contains information about the output node.
+ *Contains information about the content in an output from prompt flow invocation.
*This data type is used in the following API operations:
*A name for the output of the flow.
+ *The content in the output.
* @public */ export interface DocumentMember { @@ -435,7 +435,7 @@ export const NodeType = { export type NodeType = (typeof NodeType)[keyof typeof NodeType]; /** - *Contains information about an output from flow invoction.
+ *Contains information about an output from prompt flow invoction.
*This data type is used in the following API operations:
*The name of the node to which input was provided.
+ *The name of the flow output node that the output is from.
* @public */ nodeName: string | undefined; /** - *The type of node to which input was provided.
+ *The type of the node that the output is from.
* @public */ nodeType: NodeType | undefined; /** - *The output of the node.
+ *The content in the output.
* @public */ content: FlowOutputContent | undefined; @@ -2378,7 +2378,7 @@ export interface InferenceConfiguration { temperature?: number; /** - *While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for Top P
determines the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set topP
to 80, the model only selects the next token from the top 80% of the probability distribution of next tokens.
While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for Top P
determines the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set topP
to 0.8, the model only selects the next token from the top 80% of the probability distribution of next tokens.
Contains information of the usage of the foundation model.
+ * @public + */ +export interface Usage { + /** + *Contains information about the input tokens from the foundation model usage.
+ * @public + */ + inputTokens?: number; + + /** + *Contains information about the output tokens from the foundation model usage.
+ * @public + */ + outputTokens?: number; +} + +/** + *Provides details of the foundation model.
+ * @public + */ +export interface Metadata { + /** + *Contains details of the foundation model usage.
+ * @public + */ + usage?: Usage; +} + +/** + *Contains the raw output from the foundation model.
+ * @public + */ +export interface RawResponse { + /** + *The foundation model's raw output content.
+ * @public + */ + content?: string; +} + +/** + *The foundation model output from the orchestration step.
+ * @public + */ +export interface OrchestrationModelInvocationOutput { + /** + *The unique identifier of the trace.
+ * @public + */ + traceId?: string; + + /** + *Contains details of the raw response from the foundation model output.
+ * @public + */ + rawResponse?: RawResponse; + + /** + *Contains information about the foundation model output.
+ * @public + */ + metadata?: Metadata; +} + /** *Contains the JSON-formatted string returned by the API invoked by the code interpreter.
* @public @@ -2690,6 +2756,7 @@ export interface Rationale { export type OrchestrationTrace = | OrchestrationTrace.InvocationInputMember | OrchestrationTrace.ModelInvocationInputMember + | OrchestrationTrace.ModelInvocationOutputMember | OrchestrationTrace.ObservationMember | OrchestrationTrace.RationaleMember | OrchestrationTrace.$UnknownMember; @@ -2707,6 +2774,7 @@ export namespace OrchestrationTrace { invocationInput?: never; observation?: never; modelInvocationInput?: never; + modelInvocationOutput?: never; $unknown?: never; } @@ -2719,6 +2787,7 @@ export namespace OrchestrationTrace { invocationInput: InvocationInput; observation?: never; modelInvocationInput?: never; + modelInvocationOutput?: never; $unknown?: never; } @@ -2731,6 +2800,7 @@ export namespace OrchestrationTrace { invocationInput?: never; observation: Observation; modelInvocationInput?: never; + modelInvocationOutput?: never; $unknown?: never; } @@ -2754,6 +2824,20 @@ export namespace OrchestrationTrace { invocationInput?: never; observation?: never; modelInvocationInput: ModelInvocationInput; + modelInvocationOutput?: never; + $unknown?: never; + } + + /** + *Contains information pertaining to the output from the foundation model that is being invoked.
+ * @public + */ + export interface ModelInvocationOutputMember { + rationale?: never; + invocationInput?: never; + observation?: never; + modelInvocationInput?: never; + modelInvocationOutput: OrchestrationModelInvocationOutput; $unknown?: never; } @@ -2765,6 +2849,7 @@ export namespace OrchestrationTrace { invocationInput?: never; observation?: never; modelInvocationInput?: never; + modelInvocationOutput?: never; $unknown: [string, any]; } @@ -2773,6 +2858,7 @@ export namespace OrchestrationTrace { invocationInput: (value: InvocationInput) => T; observation: (value: Observation) => T; modelInvocationInput: (value: ModelInvocationInput) => T; + modelInvocationOutput: (value: OrchestrationModelInvocationOutput) => T; _: (name: string, value: any) => T; } @@ -2781,6 +2867,7 @@ export namespace OrchestrationTrace { if (value.invocationInput !== undefined) return visitor.invocationInput(value.invocationInput); if (value.observation !== undefined) return visitor.observation(value.observation); if (value.modelInvocationInput !== undefined) return visitor.modelInvocationInput(value.modelInvocationInput); + if (value.modelInvocationOutput !== undefined) return visitor.modelInvocationOutput(value.modelInvocationOutput); return visitor._(value.$unknown[0], value.$unknown[1]); }; } @@ -5298,6 +5385,37 @@ export const ModelInvocationInputFilterSensitiveLog = (obj: ModelInvocationInput ...(obj.text && { text: SENSITIVE_STRING }), }); +/** + * @internal + */ +export const UsageFilterSensitiveLog = (obj: Usage): any => ({ + ...obj, +}); + +/** + * @internal + */ +export const MetadataFilterSensitiveLog = (obj: Metadata): any => ({ + ...obj, + ...(obj.usage && { usage: SENSITIVE_STRING }), +}); + +/** + * @internal + */ +export const RawResponseFilterSensitiveLog = (obj: RawResponse): any => ({ + ...obj, +}); + +/** + * @internal + */ +export const OrchestrationModelInvocationOutputFilterSensitiveLog = (obj: OrchestrationModelInvocationOutput): any => ({ + ...obj, + ...(obj.rawResponse && { rawResponse: SENSITIVE_STRING }), + ...(obj.metadata && { metadata: SENSITIVE_STRING }), +}); + /** * @internal */ @@ -5355,6 +5473,7 @@ export const OrchestrationTraceFilterSensitiveLog = (obj: OrchestrationTrace): a if (obj.invocationInput !== undefined) return { invocationInput: SENSITIVE_STRING }; if (obj.observation !== undefined) return { observation: SENSITIVE_STRING }; if (obj.modelInvocationInput !== undefined) return { modelInvocationInput: SENSITIVE_STRING }; + if (obj.modelInvocationOutput !== undefined) return { modelInvocationOutput: SENSITIVE_STRING }; if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; }; diff --git a/clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts b/clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts index 3b5b380af0a0..f0bd1fad7de2 100644 --- a/clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts +++ b/clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts @@ -1470,6 +1470,8 @@ const de_MemorySessionSummary = (output: any, context: __SerdeContext): MemorySe }) as any; }; +// de_Metadata omitted. + /** * deserializeAws_restJson1ModelInvocationInput */ @@ -1500,6 +1502,8 @@ const de_Observation = (output: any, context: __SerdeContext): Observation => { }) as any; }; +// de_OrchestrationModelInvocationOutput omitted. + /** * deserializeAws_restJson1OrchestrationTrace */ @@ -1514,6 +1518,11 @@ const de_OrchestrationTrace = (output: any, context: __SerdeContext): Orchestrat modelInvocationInput: de_ModelInvocationInput(output.modelInvocationInput, context), }; } + if (output.modelInvocationOutput != null) { + return { + modelInvocationOutput: _json(output.modelInvocationOutput), + }; + } if (output.observation != null) { return { observation: de_Observation(output.observation, context), @@ -1612,6 +1621,8 @@ const de_PreProcessingTrace = (output: any, context: __SerdeContext): PreProcess // de_Rationale omitted. +// de_RawResponse omitted. + // de_RepromptResponse omitted. // de_RequestBody omitted. @@ -1728,6 +1739,8 @@ const de_TracePart = (output: any, context: __SerdeContext): TracePart => { }) as any; }; +// de_Usage omitted. + /** * deserializeAws_restJson1Document */ diff --git a/codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json b/codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json index ccafd788e6ac..2060139848a3 100644 --- a/codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json +++ b/codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json @@ -1696,27 +1696,27 @@ "nodeName": { "target": "com.amazonaws.bedrockagentruntime#NodeName", "traits": { - "smithy.api#documentation": "A name for the input of the flow input node.
", + "smithy.api#documentation": "The name of the flow input node that begins the prompt flow.
", "smithy.api#required": {} } }, "nodeOutputName": { "target": "com.amazonaws.bedrockagentruntime#NodeOutputName", "traits": { - "smithy.api#documentation": "A name for the output of the flow input node.
", + "smithy.api#documentation": "The name of the output from the flow input node that begins the prompt flow.
", "smithy.api#required": {} } }, "content": { "target": "com.amazonaws.bedrockagentruntime#FlowInputContent", "traits": { - "smithy.api#documentation": "Contains information about an input into the flow.
", + "smithy.api#documentation": "Contains information about an input into the prompt flow.
", "smithy.api#required": {} } } }, "traits": { - "smithy.api#documentation": "Contains information about an input into the flow and what to do with it.
\nThis data type is used in the following API operations:
\n\n InvokeFlow request\n
\nContains information about an input into the prompt flow and where to send it.
\nThis data type is used in the following API operations:
\n\n InvokeFlow request\n
\nThe input for the flow input node.
" + "smithy.api#documentation": "The input to send to the prompt flow input node.
" } } }, @@ -1752,12 +1752,12 @@ "document": { "target": "smithy.api#Document", "traits": { - "smithy.api#documentation": "A name for the output of the flow.
" + "smithy.api#documentation": "The content in the output.
" } } }, "traits": { - "smithy.api#documentation": "Contains information about the output node.
\nThis data type is used in the following API operations:
\n\n InvokeFlow request\n
\nContains information about the content in an output from prompt flow invocation.
\nThis data type is used in the following API operations:
\n\n InvokeFlow request\n
\nThe name of the node to which input was provided.
", + "smithy.api#documentation": "The name of the flow output node that the output is from.
", "smithy.api#required": {} } }, "nodeType": { "target": "com.amazonaws.bedrockagentruntime#NodeType", "traits": { - "smithy.api#documentation": "The type of node to which input was provided.
", + "smithy.api#documentation": "The type of the node that the output is from.
", "smithy.api#required": {} } }, "content": { "target": "com.amazonaws.bedrockagentruntime#FlowOutputContent", "traits": { - "smithy.api#documentation": "The output of the node.
", + "smithy.api#documentation": "The content in the output.
", "smithy.api#required": {} } } }, "traits": { - "smithy.api#documentation": "Contains information about an output from flow invoction.
\nThis data type is used in the following API operations:
\n\n InvokeFlow response\n
\nContains information about an output from prompt flow invoction.
\nThis data type is used in the following API operations:
\n\n InvokeFlow response\n
\nWhile generating a response, the model determines the probability of the following token at each point of generation. The value that you set for Top P
determines the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set topP
to 80, the model only selects the next token from the top 80% of the probability distribution of next tokens.
While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for Top P
determines the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set topP
to 0.8, the model only selects the next token from the top 80% of the probability distribution of next tokens.
Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.
", + "smithy.api#documentation": "Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.
\nThe CLI doesn't support streaming operations in Amazon Bedrock, including InvokeFlow
.
Contains details of the foundation model usage.
" + } + } + }, + "traits": { + "smithy.api#documentation": "Provides details of the foundation model.
", + "smithy.api#sensitive": {} + } + }, "com.amazonaws.bedrockagentruntime#MimeType": { "type": "string" }, @@ -3945,6 +3960,33 @@ "smithy.api#documentation": "Settings for how the model processes the prompt prior to retrieval and generation.
" } }, + "com.amazonaws.bedrockagentruntime#OrchestrationModelInvocationOutput": { + "type": "structure", + "members": { + "traceId": { + "target": "com.amazonaws.bedrockagentruntime#TraceId", + "traits": { + "smithy.api#documentation": "The unique identifier of the trace.
" + } + }, + "rawResponse": { + "target": "com.amazonaws.bedrockagentruntime#RawResponse", + "traits": { + "smithy.api#documentation": "Contains details of the raw response from the foundation model output.
" + } + }, + "metadata": { + "target": "com.amazonaws.bedrockagentruntime#Metadata", + "traits": { + "smithy.api#documentation": "Contains information about the foundation model output.
" + } + } + }, + "traits": { + "smithy.api#documentation": "The foundation model output from the orchestration step.
", + "smithy.api#sensitive": {} + } + }, "com.amazonaws.bedrockagentruntime#OrchestrationTrace": { "type": "union", "members": { @@ -3971,6 +4013,12 @@ "traits": { "smithy.api#documentation": "The input for the orchestration step.
\nThe type
is ORCHESTRATION
.
The text
contains the prompt.
The inferenceConfiguration
, parserMode
, and overrideLambda
values are set in the PromptOverrideConfiguration object that was set when the agent was created or updated.
Contains information pertaining to the output from the foundation model that is being invoked.
" + } } }, "traits": { @@ -4354,6 +4402,21 @@ "smithy.api#sensitive": {} } }, + "com.amazonaws.bedrockagentruntime#RawResponse": { + "type": "structure", + "members": { + "content": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "The foundation model's raw output content.
" + } + } + }, + "traits": { + "smithy.api#documentation": "Contains the raw output from the foundation model.
", + "smithy.api#sensitive": {} + } + }, "com.amazonaws.bedrockagentruntime#RepromptResponse": { "type": "structure", "members": { @@ -5641,6 +5704,27 @@ } } }, + "com.amazonaws.bedrockagentruntime#Usage": { + "type": "structure", + "members": { + "inputTokens": { + "target": "smithy.api#Integer", + "traits": { + "smithy.api#documentation": "Contains information about the input tokens from the foundation model usage.
" + } + }, + "outputTokens": { + "target": "smithy.api#Integer", + "traits": { + "smithy.api#documentation": "Contains information about the output tokens from the foundation model usage.
" + } + } + }, + "traits": { + "smithy.api#documentation": "Contains information of the usage of the foundation model.
", + "smithy.api#sensitive": {} + } + }, "com.amazonaws.bedrockagentruntime#ValidationException": { "type": "structure", "members": {