Skip to content

Commit

Permalink
feat(client-bedrock-agent-runtime): Custom Orchestration and Streamin…
Browse files Browse the repository at this point in the history
…g configurations API release for AWSBedrockAgents.
  • Loading branch information
awstools committed Nov 26, 2024
1 parent c1ea3a8 commit c69abf3
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
* enableTrace: true || false,
* inputText: "STRING_VALUE",
* memoryId: "STRING_VALUE",
* streamingConfigurations: { // StreamingConfigurations
* streamFinalResponse: true || false,
* applyGuardrailInterval: Number("int"),
* },
* };
* const command = new InvokeAgentCommand(input);
* const response = await client.send(command);
Expand Down Expand Up @@ -566,6 +570,12 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
* // traceId: "STRING_VALUE",
* // failureReason: "STRING_VALUE",
* // },
* // customOrchestrationTrace: { // CustomOrchestrationTrace
* // traceId: "STRING_VALUE",
* // event: { // CustomOrchestrationTraceEvent
* // text: "STRING_VALUE",
* // },
* // },
* // },
* // agentId: "STRING_VALUE",
* // agentAliasId: "STRING_VALUE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,12 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons
* // traceId: "STRING_VALUE",
* // failureReason: "STRING_VALUE",
* // },
* // customOrchestrationTrace: { // CustomOrchestrationTrace
* // traceId: "STRING_VALUE",
* // event: { // CustomOrchestrationTraceEvent
* // text: "STRING_VALUE",
* // },
* // },
* // },
* // },
* // returnControl: { // InlineAgentReturnControlPayload
Expand Down
114 changes: 114 additions & 0 deletions clients/client-bedrock-agent-runtime/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,30 @@ export namespace InvocationResultMember {
};
}

/**
* <p>
* Configurations for streaming.
* </p>
* @public
*/
export interface StreamingConfigurations {
/**
* <p>
* Specifies whether to enable streaming for the final response. This is set to <code>false</code> by default.
* </p>
* @public
*/
streamFinalResponse?: boolean | undefined;

/**
* <p>
* The guardrail interval to apply as response is generated.
* </p>
* @public
*/
applyGuardrailInterval?: number | undefined;
}

/**
* <p>Contains information about where the text with a citation begins and ends in the generated output.</p>
* <p>This data type is used in the following API operations:</p>
Expand Down Expand Up @@ -2534,6 +2558,46 @@ export interface ReturnControlPayload {
invocationId?: string | undefined;
}

/**
* <p>
* The event in the custom orchestration sequence.
* </p>
* @public
*/
export interface CustomOrchestrationTraceEvent {
/**
* <p>
* The text that prompted the event at this step.
* </p>
* @public
*/
text?: string | undefined;
}

/**
* <p>
* The trace behavior for the custom orchestration.
* </p>
* @public
*/
export interface CustomOrchestrationTrace {
/**
* <p>
* The unique identifier of the trace.
* </p>
* @public
*/
traceId?: string | undefined;

/**
* <p>
* The trace event details used with the custom orchestration.
* </p>
* @public
*/
event?: CustomOrchestrationTraceEvent | undefined;
}

/**
* <p>Contains information about the failure of the interaction.</p>
* @public
Expand Down Expand Up @@ -3819,6 +3883,7 @@ export namespace PreProcessingTrace {
* @public
*/
export type Trace =
| Trace.CustomOrchestrationTraceMember
| Trace.FailureTraceMember
| Trace.GuardrailTraceMember
| Trace.OrchestrationTraceMember
Expand All @@ -3840,6 +3905,7 @@ export namespace Trace {
orchestrationTrace?: never;
postProcessingTrace?: never;
failureTrace?: never;
customOrchestrationTrace?: never;
$unknown?: never;
}

Expand All @@ -3853,6 +3919,7 @@ export namespace Trace {
orchestrationTrace?: never;
postProcessingTrace?: never;
failureTrace?: never;
customOrchestrationTrace?: never;
$unknown?: never;
}

Expand All @@ -3866,6 +3933,7 @@ export namespace Trace {
orchestrationTrace: OrchestrationTrace;
postProcessingTrace?: never;
failureTrace?: never;
customOrchestrationTrace?: never;
$unknown?: never;
}

Expand All @@ -3879,6 +3947,7 @@ export namespace Trace {
orchestrationTrace?: never;
postProcessingTrace: PostProcessingTrace;
failureTrace?: never;
customOrchestrationTrace?: never;
$unknown?: never;
}

Expand All @@ -3892,6 +3961,23 @@ export namespace Trace {
orchestrationTrace?: never;
postProcessingTrace?: never;
failureTrace: FailureTrace;
customOrchestrationTrace?: never;
$unknown?: never;
}

/**
* <p>
* Details about the custom orchestration step in which the agent determines the order in which actions are executed.
* </p>
* @public
*/
export interface CustomOrchestrationTraceMember {
guardrailTrace?: never;
preProcessingTrace?: never;
orchestrationTrace?: never;
postProcessingTrace?: never;
failureTrace?: never;
customOrchestrationTrace: CustomOrchestrationTrace;
$unknown?: never;
}

Expand All @@ -3904,6 +3990,7 @@ export namespace Trace {
orchestrationTrace?: never;
postProcessingTrace?: never;
failureTrace?: never;
customOrchestrationTrace?: never;
$unknown: [string, any];
}

Expand All @@ -3913,6 +4000,7 @@ export namespace Trace {
orchestrationTrace: (value: OrchestrationTrace) => T;
postProcessingTrace: (value: PostProcessingTrace) => T;
failureTrace: (value: FailureTrace) => T;
customOrchestrationTrace: (value: CustomOrchestrationTrace) => T;
_: (name: string, value: any) => T;
}

Expand All @@ -3922,6 +4010,8 @@ export namespace Trace {
if (value.orchestrationTrace !== undefined) return visitor.orchestrationTrace(value.orchestrationTrace);
if (value.postProcessingTrace !== undefined) return visitor.postProcessingTrace(value.postProcessingTrace);
if (value.failureTrace !== undefined) return visitor.failureTrace(value.failureTrace);
if (value.customOrchestrationTrace !== undefined)
return visitor.customOrchestrationTrace(value.customOrchestrationTrace);
return visitor._(value.$unknown[0], value.$unknown[1]);
};
}
Expand Down Expand Up @@ -6893,6 +6983,14 @@ export interface InvokeAgentRequest {
* @public
*/
memoryId?: string | undefined;

/**
* <p>
* Specifies the configurations for streaming.
* </p>
* @public
*/
streamingConfigurations?: StreamingConfigurations | undefined;
}

/**
Expand Down Expand Up @@ -7246,6 +7344,21 @@ export const ReturnControlPayloadFilterSensitiveLog = (obj: ReturnControlPayload
}),
});

/**
* @internal
*/
export const CustomOrchestrationTraceEventFilterSensitiveLog = (obj: CustomOrchestrationTraceEvent): any => ({
...obj,
});

/**
* @internal
*/
export const CustomOrchestrationTraceFilterSensitiveLog = (obj: CustomOrchestrationTrace): any => ({
...obj,
...(obj.event && { event: SENSITIVE_STRING }),
});

/**
* @internal
*/
Expand Down Expand Up @@ -7539,6 +7652,7 @@ export const TraceFilterSensitiveLog = (obj: Trace): any => {
if (obj.orchestrationTrace !== undefined) return { orchestrationTrace: SENSITIVE_STRING };
if (obj.postProcessingTrace !== undefined) return { postProcessingTrace: SENSITIVE_STRING };
if (obj.failureTrace !== undefined) return { failureTrace: SENSITIVE_STRING };
if (obj.customOrchestrationTrace !== undefined) return { customOrchestrationTrace: SENSITIVE_STRING };
if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" };
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ import {
S3ObjectFile,
ServiceQuotaExceededException,
SessionState,
StreamingConfigurations,
TextInferenceConfig,
TextPrompt,
ThrottlingException,
Expand Down Expand Up @@ -211,6 +212,7 @@ export const se_InvokeAgentCommand = async (
inputText: [],
memoryId: [],
sessionState: (_) => se_SessionState(_, context),
streamingConfigurations: (_) => _json(_),
})
);
b.m("POST").h(headers).b(body);
Expand Down Expand Up @@ -1663,6 +1665,8 @@ const se_SessionState = (input: SessionState, context: __SerdeContext): any => {

// se_StopSequences omitted.

// se_StreamingConfigurations omitted.

/**
* serializeAws_restJson1TextInferenceConfig
*/
Expand Down Expand Up @@ -1737,6 +1741,10 @@ const de_Citations = (output: any, context: __SerdeContext): Citation[] => {

// de_ContentMap omitted.

// de_CustomOrchestrationTrace omitted.

// de_CustomOrchestrationTraceEvent omitted.

// de_FailureTrace omitted.

/**
Expand Down Expand Up @@ -2318,6 +2326,11 @@ const de_RetrievedReferences = (output: any, context: __SerdeContext): Retrieved
* deserializeAws_restJson1Trace
*/
const de_Trace = (output: any, context: __SerdeContext): Trace => {
if (output.customOrchestrationTrace != null) {
return {
customOrchestrationTrace: _json(output.customOrchestrationTrace),
};
}
if (output.failureTrace != null) {
return {
failureTrace: _json(output.failureTrace),
Expand Down
72 changes: 72 additions & 0 deletions codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,42 @@
}
}
},
"com.amazonaws.bedrockagentruntime#CustomOrchestrationTrace": {
"type": "structure",
"members": {
"traceId": {
"target": "com.amazonaws.bedrockagentruntime#TraceId",
"traits": {
"smithy.api#documentation": "<p>\n The unique identifier of the trace. \n </p>"
}
},
"event": {
"target": "com.amazonaws.bedrockagentruntime#CustomOrchestrationTraceEvent",
"traits": {
"smithy.api#documentation": "<p>\n The trace event details used with the custom orchestration.\n </p>"
}
}
},
"traits": {
"smithy.api#documentation": "<p>\n The trace behavior for the custom orchestration. \n </p>",
"smithy.api#sensitive": {}
}
},
"com.amazonaws.bedrockagentruntime#CustomOrchestrationTraceEvent": {
"type": "structure",
"members": {
"text": {
"target": "smithy.api#String",
"traits": {
"smithy.api#documentation": "<p>\n The text that prompted the event at this step.\n </p>"
}
}
},
"traits": {
"smithy.api#documentation": "<p>\n The event in the custom orchestration sequence.\n </p>",
"smithy.api#sensitive": {}
}
},
"com.amazonaws.bedrockagentruntime#DateTimestamp": {
"type": "timestamp",
"traits": {
Expand Down Expand Up @@ -4066,6 +4102,12 @@
"traits": {
"smithy.api#documentation": "<p>The unique identifier of the agent memory.</p>"
}
},
"streamingConfigurations": {
"target": "com.amazonaws.bedrockagentruntime#StreamingConfigurations",
"traits": {
"smithy.api#documentation": "<p>\n Specifies the configurations for streaming.\n </p>"
}
}
},
"traits": {
Expand Down Expand Up @@ -7002,6 +7044,30 @@
}
}
},
"com.amazonaws.bedrockagentruntime#StreamingConfigurations": {
"type": "structure",
"members": {
"streamFinalResponse": {
"target": "smithy.api#Boolean",
"traits": {
"smithy.api#default": false,
"smithy.api#documentation": "<p>\n Specifies whether to enable streaming for the final response. This is set to <code>false</code> by default.\n </p>"
}
},
"applyGuardrailInterval": {
"target": "smithy.api#Integer",
"traits": {
"smithy.api#documentation": "<p>\n The guardrail interval to apply as response is generated.\n </p>",
"smithy.api#range": {
"min": 1
}
}
}
},
"traits": {
"smithy.api#documentation": "<p>\n Configurations for streaming.\n </p>"
}
},
"com.amazonaws.bedrockagentruntime#SummaryText": {
"type": "string",
"traits": {
Expand Down Expand Up @@ -7166,6 +7232,12 @@
"traits": {
"smithy.api#documentation": "<p>Contains information about the failure of the interaction.</p>"
}
},
"customOrchestrationTrace": {
"target": "com.amazonaws.bedrockagentruntime#CustomOrchestrationTrace",
"traits": {
"smithy.api#documentation": "<p>\n Details about the custom orchestration step in which the agent determines the order in which actions are executed. \n </p>"
}
}
},
"traits": {
Expand Down

0 comments on commit c69abf3

Please sign in to comment.