Skip to content

Commit 43a0b65

Browse files
author
awstools
committed
feat(client-bedrock-agent-runtime): Adding support for ReasoningContent fields in Pre-Processing, Post-Processing and Orchestration Trace outputs.
1 parent 1d7b1c1 commit 43a0b65

File tree

5 files changed

+292
-9
lines changed

5 files changed

+292
-9
lines changed

clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,13 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
498498
* // outputTokens: Number("int"),
499499
* // },
500500
* // },
501+
* // reasoningContent: { // ReasoningContentBlock Union: only one key present
502+
* // reasoningText: { // ReasoningTextBlock
503+
* // text: "STRING_VALUE", // required
504+
* // signature: "STRING_VALUE",
505+
* // },
506+
* // redactedContent: new Uint8Array(),
507+
* // },
501508
* // },
502509
* // },
503510
* // orchestrationTrace: { // OrchestrationTrace Union: only one key present
@@ -738,6 +745,13 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
738745
* // outputTokens: Number("int"),
739746
* // },
740747
* // },
748+
* // reasoningContent: {// Union: only one key present
749+
* // reasoningText: {
750+
* // text: "STRING_VALUE", // required
751+
* // signature: "STRING_VALUE",
752+
* // },
753+
* // redactedContent: new Uint8Array(),
754+
* // },
741755
* // },
742756
* // },
743757
* // postProcessingTrace: { // PostProcessingTrace Union: only one key present
@@ -773,6 +787,13 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
773787
* // outputTokens: Number("int"),
774788
* // },
775789
* // },
790+
* // reasoningContent: {// Union: only one key present
791+
* // reasoningText: {
792+
* // text: "STRING_VALUE", // required
793+
* // signature: "STRING_VALUE",
794+
* // },
795+
* // redactedContent: new Uint8Array(),
796+
* // },
776797
* // },
777798
* // },
778799
* // routingClassifierTrace: { // RoutingClassifierTrace Union: only one key present

clients/client-bedrock-agent-runtime/src/commands/InvokeInlineAgentCommand.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,13 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons
520520
* // outputTokens: Number("int"),
521521
* // },
522522
* // },
523+
* // reasoningContent: { // ReasoningContentBlock Union: only one key present
524+
* // reasoningText: { // ReasoningTextBlock
525+
* // text: "STRING_VALUE", // required
526+
* // signature: "STRING_VALUE",
527+
* // },
528+
* // redactedContent: new Uint8Array(),
529+
* // },
523530
* // },
524531
* // },
525532
* // orchestrationTrace: { // OrchestrationTrace Union: only one key present
@@ -760,6 +767,13 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons
760767
* // outputTokens: Number("int"),
761768
* // },
762769
* // },
770+
* // reasoningContent: {// Union: only one key present
771+
* // reasoningText: {
772+
* // text: "STRING_VALUE", // required
773+
* // signature: "STRING_VALUE",
774+
* // },
775+
* // redactedContent: new Uint8Array(),
776+
* // },
763777
* // },
764778
* // },
765779
* // postProcessingTrace: { // PostProcessingTrace Union: only one key present
@@ -795,6 +809,13 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons
795809
* // outputTokens: Number("int"),
796810
* // },
797811
* // },
812+
* // reasoningContent: {// Union: only one key present
813+
* // reasoningText: {
814+
* // text: "STRING_VALUE", // required
815+
* // signature: "STRING_VALUE",
816+
* // },
817+
* // redactedContent: new Uint8Array(),
818+
* // },
798819
* // },
799820
* // },
800821
* // routingClassifierTrace: { // RoutingClassifierTrace Union: only one key present

clients/client-bedrock-agent-runtime/src/models/models_0.ts

Lines changed: 117 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4343,6 +4343,85 @@ export interface RawResponse {
43434343
content?: string | undefined;
43444344
}
43454345

4346+
/**
4347+
* <p>Contains information about the reasoning that the model used to return the content in the content block.</p>
4348+
* @public
4349+
*/
4350+
export interface ReasoningTextBlock {
4351+
/**
4352+
* <p>Text describing the reasoning that the model used to return the content in the content block.</p>
4353+
* @public
4354+
*/
4355+
text: string | undefined;
4356+
4357+
/**
4358+
* <p>A hash of all the messages in the conversation to ensure that the content in the
4359+
* reasoning text block isn't tampered with. You must submit the signature in subsequent
4360+
* <code>Converse</code> requests, in addition to the previous messages. If the
4361+
* previous messages are tampered with, the response throws an error.</p>
4362+
* @public
4363+
*/
4364+
signature?: string | undefined;
4365+
}
4366+
4367+
/**
4368+
* <p>Contains content regarding the reasoning that the foundation model made with respect
4369+
* to the content in the content block. Reasoning refers to a Chain of Thought (CoT) that
4370+
* the model generates to enhance the accuracy of its final response.</p>
4371+
* @public
4372+
*/
4373+
export type ReasoningContentBlock =
4374+
| ReasoningContentBlock.ReasoningTextMember
4375+
| ReasoningContentBlock.RedactedContentMember
4376+
| ReasoningContentBlock.$UnknownMember;
4377+
4378+
/**
4379+
* @public
4380+
*/
4381+
export namespace ReasoningContentBlock {
4382+
/**
4383+
* <p>Contains information about the reasoning that the model used to return the content in
4384+
* the content block.</p>
4385+
* @public
4386+
*/
4387+
export interface ReasoningTextMember {
4388+
reasoningText: ReasoningTextBlock;
4389+
redactedContent?: never;
4390+
$unknown?: never;
4391+
}
4392+
4393+
/**
4394+
* <p>The content in the reasoning that was encrypted by the model provider for trust and safety reasons.</p>
4395+
* @public
4396+
*/
4397+
export interface RedactedContentMember {
4398+
reasoningText?: never;
4399+
redactedContent: Uint8Array;
4400+
$unknown?: never;
4401+
}
4402+
4403+
/**
4404+
* @public
4405+
*/
4406+
export interface $UnknownMember {
4407+
reasoningText?: never;
4408+
redactedContent?: never;
4409+
$unknown: [string, any];
4410+
}
4411+
4412+
export interface Visitor<T> {
4413+
reasoningText: (value: ReasoningTextBlock) => T;
4414+
redactedContent: (value: Uint8Array) => T;
4415+
_: (name: string, value: any) => T;
4416+
}
4417+
4418+
export const visit = <T>(value: ReasoningContentBlock, visitor: Visitor<T>): T => {
4419+
if (value.reasoningText !== undefined) return visitor.reasoningText(value.reasoningText);
4420+
if (value.redactedContent !== undefined) return visitor.redactedContent(value.redactedContent);
4421+
return visitor._(value.$unknown[0], value.$unknown[1]);
4422+
};
4423+
}
4424+
43464425
/**
43474426
* <p>The foundation model output from the orchestration step.</p>
43484427
* @public
@@ -4365,6 +4444,12 @@ export interface OrchestrationModelInvocationOutput {
43654444
* @public
43664445
*/
43674446
metadata?: Metadata | undefined;
4447+
4448+
/**
4449+
* <p>Contains content about the reasoning that the model made during the orchestration step. </p>
4450+
* @public
4451+
*/
4452+
reasoningContent?: ReasoningContentBlock | undefined;
43684453
}
43694454

43704455
/**
@@ -4733,6 +4818,12 @@ export interface PostProcessingModelInvocationOutput {
47334818
* @public
47344819
*/
47354820
metadata?: Metadata | undefined;
4821+
4822+
/**
4823+
* <p>Contains content about the reasoning that the model made during the post-processing step.</p>
4824+
* @public
4825+
*/
4826+
reasoningContent?: ReasoningContentBlock | undefined;
47364827
}
47374828

47384829
/**
@@ -4851,6 +4942,12 @@ export interface PreProcessingModelInvocationOutput {
48514942
* @public
48524943
*/
48534944
metadata?: Metadata | undefined;
4945+
4946+
/**
4947+
* <p>Contains content about the reasoning that the model made during the pre-processing step. </p>
4948+
* @public
4949+
*/
4950+
reasoningContent?: ReasoningContentBlock | undefined;
48544951
}
48554952

48564953
/**
@@ -5841,7 +5938,7 @@ export interface PromptConfiguration {
58415938
inferenceConfiguration?: InferenceConfiguration | undefined;
58425939

58435940
/**
5844-
* <p>Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the <code>promptType</code>. If you set the field as <code>OVERRIDEN</code>, the <code>overrideLambda</code> field in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> must be specified with the ARN of a Lambda function.</p>
5941+
* <p>Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the <code>promptType</code>. If you set the field as <code>OVERRIDDEN</code>, the <code>overrideLambda</code> field in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> must be specified with the ARN of a Lambda function.</p>
58455942
* @public
58465943
*/
58475944
parserMode?: CreationMode | undefined;
@@ -9728,13 +9825,30 @@ export const RawResponseFilterSensitiveLog = (obj: RawResponse): any => ({
97289825
...obj,
97299826
});
97309827

9828+
/**
9829+
* @internal
9830+
*/
9831+
export const ReasoningTextBlockFilterSensitiveLog = (obj: ReasoningTextBlock): any => ({
9832+
...obj,
9833+
});
9834+
9835+
/**
9836+
* @internal
9837+
*/
9838+
export const ReasoningContentBlockFilterSensitiveLog = (obj: ReasoningContentBlock): any => {
9839+
if (obj.reasoningText !== undefined) return { reasoningText: SENSITIVE_STRING };
9840+
if (obj.redactedContent !== undefined) return { redactedContent: obj.redactedContent };
9841+
if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" };
9842+
};
9843+
97319844
/**
97329845
* @internal
97339846
*/
97349847
export const OrchestrationModelInvocationOutputFilterSensitiveLog = (obj: OrchestrationModelInvocationOutput): any => ({
97359848
...obj,
97369849
...(obj.rawResponse && { rawResponse: SENSITIVE_STRING }),
97379850
...(obj.metadata && { metadata: SENSITIVE_STRING }),
9851+
...(obj.reasoningContent && { reasoningContent: SENSITIVE_STRING }),
97389852
});
97399853

97409854
/**
@@ -9821,6 +9935,7 @@ export const PostProcessingModelInvocationOutputFilterSensitiveLog = (
98219935
...(obj.parsedResponse && { parsedResponse: SENSITIVE_STRING }),
98229936
...(obj.rawResponse && { rawResponse: SENSITIVE_STRING }),
98239937
...(obj.metadata && { metadata: SENSITIVE_STRING }),
9938+
...(obj.reasoningContent && { reasoningContent: SENSITIVE_STRING }),
98249939
});
98259940

98269941
/**
@@ -9848,6 +9963,7 @@ export const PreProcessingModelInvocationOutputFilterSensitiveLog = (obj: PrePro
98489963
...(obj.parsedResponse && { parsedResponse: SENSITIVE_STRING }),
98499964
...(obj.rawResponse && { rawResponse: SENSITIVE_STRING }),
98509965
...(obj.metadata && { metadata: SENSITIVE_STRING }),
9966+
...(obj.reasoningContent && { reasoningContent: SENSITIVE_STRING }),
98519967
});
98529968

98539969
/**

0 commit comments

Comments
 (0)