Skip to content

Commit 399cf31

Browse files
awstoolssmilkuri
authored andcommitted
feat(client-bedrock-runtime): New stop reason for Converse and ConverseStream
1 parent 23d4f88 commit 399cf31

File tree

6 files changed

+6628
-6624
lines changed

6 files changed

+6628
-6624
lines changed

clients/client-bedrock-runtime/src/commands/ApplyGuardrailCommand.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ export interface ApplyGuardrailCommandOutput extends ApplyGuardrailResponse, __M
369369
* @throws {@link ServiceQuotaExceededException} (client fault)
370370
* <p>Your request exceeds the service quota for your account. You can view your quotas at <a href="https://docs.aws.amazon.com/servicequotas/latest/userguide/gs-request-quota.html">Viewing service quotas</a>. You can resubmit your request later.</p>
371371
*
372+
* @throws {@link ServiceUnavailableException} (server fault)
373+
* <p>The service isn't currently available. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-service-unavailable">ServiceUnavailable</a> in the Amazon Bedrock User Guide</p>
374+
*
372375
* @throws {@link ThrottlingException} (client fault)
373376
* <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
374377
*

clients/client-bedrock-runtime/src/commands/ConverseCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare
443443
* // ],
444444
* // },
445445
* // },
446-
* // stopReason: "end_turn" || "tool_use" || "max_tokens" || "stop_sequence" || "guardrail_intervened" || "content_filtered", // required
446+
* // stopReason: "end_turn" || "tool_use" || "max_tokens" || "stop_sequence" || "guardrail_intervened" || "content_filtered" || "model_context_window_exceeded", // required
447447
* // usage: { // TokenUsage
448448
* // inputTokens: Number("int"), // required
449449
* // outputTokens: Number("int"), // required

clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __M
338338
* // contentBlockIndex: Number("int"), // required
339339
* // },
340340
* // messageStop: { // MessageStopEvent
341-
* // stopReason: "end_turn" || "tool_use" || "max_tokens" || "stop_sequence" || "guardrail_intervened" || "content_filtered", // required
341+
* // stopReason: "end_turn" || "tool_use" || "max_tokens" || "stop_sequence" || "guardrail_intervened" || "content_filtered" || "model_context_window_exceeded", // required
342342
* // additionalModelResponseFields: "DOCUMENT_VALUE",
343343
* // },
344344
* // metadata: { // ConverseStreamMetadataEvent

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3895,6 +3895,7 @@ export const StopReason = {
38953895
END_TURN: "end_turn",
38963896
GUARDRAIL_INTERVENED: "guardrail_intervened",
38973897
MAX_TOKENS: "max_tokens",
3898+
MODEL_CONTEXT_WINDOW_EXCEEDED: "model_context_window_exceeded",
38983899
STOP_SEQUENCE: "stop_sequence",
38993900
TOOL_USE: "tool_use",
39003901
} as const;

clients/client-bedrock-runtime/src/protocols/Aws_restJson1.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,9 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext):
653653
case "ServiceQuotaExceededException":
654654
case "com.amazonaws.bedrockruntime#ServiceQuotaExceededException":
655655
throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
656+
case "ServiceUnavailableException":
657+
case "com.amazonaws.bedrockruntime#ServiceUnavailableException":
658+
throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
656659
case "ThrottlingException":
657660
case "com.amazonaws.bedrockruntime#ThrottlingException":
658661
throw await de_ThrottlingExceptionRes(parsedOutput, context);
@@ -668,9 +671,6 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext):
668671
case "ModelTimeoutException":
669672
case "com.amazonaws.bedrockruntime#ModelTimeoutException":
670673
throw await de_ModelTimeoutExceptionRes(parsedOutput, context);
671-
case "ServiceUnavailableException":
672-
case "com.amazonaws.bedrockruntime#ServiceUnavailableException":
673-
throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
674674
case "ModelStreamErrorException":
675675
case "com.amazonaws.bedrockruntime#ModelStreamErrorException":
676676
throw await de_ModelStreamErrorExceptionRes(parsedOutput, context);

0 commit comments

Comments
 (0)