Skip to content

client-bedrock-runtime: Same request via InvokeModelWithResponseStreamCommand throws different exceptions depending on the model usedΒ #6266

@modcab

Description

@modcab

Checkboxes for prior research

Describe the bug

When sending a request that exceeds the allowed token count:

  • anthropic.claude-3-haiku-20240307-v1:0 will throw a ValidationException with a descriptive message: ValidationException: Input is too long for requested model.
  • anthropic.claude-3-opus-20240229-v1:0 will throw a ModelStreamErrorException with a generic message: The system encountered an unexpected error during processing. Try your request again.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v20.11.0

Reproduction Steps

Sending a request that exceeds the allowed token count and examine the exception thrown.

Observed Behavior

  • anthropic.claude-3-haiku-20240307-v1:0 will throw a ValidationException with a descriptive message: ValidationException: Input is too long for requested model.
  • anthropic.claude-3-opus-20240229-v1:0 will throw a ModelStreamErrorException with a generic message: The system encountered an unexpected error during processing. Try your request again.

Expected Behavior

The same exception type for both models, with information that allows us to respond correctly.

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issueservice-apiThis issue is due to a problem in a service API, not the SDK implementation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions