Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Type error in BedrockRuntime client on latest aws-sdk-core version #3033

Closed
IzkuTines opened this issue May 31, 2024 · 5 comments
Closed
Labels
bug This issue is a bug. service-api General API label for AWS Services.

Comments

@IzkuTines
Copy link

Describe the bug

We recently updated the aws-sdk-core gem from 3.191.6 to 3.196.0 and started seeing this error on all our calls to the invoke_model method of Aws::BedrockRuntime::Client:

Aws::BedrockRuntime::Errors::ValidationException: The provided Content Type is invalid or not supported for this model

We've updated all our aws-sdk-* gems to the latest version, the error still happens. We haven't changed any code other than updating the gems.

Expected Behavior

No error, like in sdk-core version 3.191.6

Current Behavior

Error:

Aws::BedrockRuntime::Errors::ValidationException: The provided Content Type is invalid or not supported for this model

Reproduction Steps

Aws::BedrockRuntime::Client
  .new(region: "us-west-2")
  .invoke_model(
    {
      body: {
        messages: [{ role: "user", content: "Hello" }],
        system: "",
        anthropic_version: "bedrock-2023-05-31",
        max_tokens: 4096,
        temperature: 0.1,
      }.to_json,
      model_id: "anthropic.claude-3-haiku-20240307-v1:0",
    },
  )

Possible Solution

No response

Additional Information/Context

No response

Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version

aws-sdk-core 3.196.1

Environment details (Version of Ruby, OS environment)

Ruby 3.3.1 on macOS and Linux

@IzkuTines IzkuTines added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 31, 2024
@jterapin
Copy link
Contributor

Hi! Thanks for submitting the ticket, we will be taking a look.

@jterapin jterapin added investigating Issue is being investigated and removed needs-triage This issue or PR still needs to be triaged. labels May 31, 2024
@mullermp
Copy link
Contributor

According to https://smithy.io/2.0/aws/protocols/aws-restjson1-protocol.html#content-type, the Content-Type should be octet-stream, which we now send, but the service is not accepting it. I think in the mean time, you can pin your version or use the content_type member for invoke_model and set it to application/json. I'll ask around internally but quite possibly the service might be incorrect here? Worst case we can put in a fix for this.

@mullermp
Copy link
Contributor

Other SDKs are broken right from the start (like Rust and Kotlin) and some SDKs like Ruby and .NET had this same issue, where it was previously working and then stopped. I paged the internal service team and they're working on a fix. It will likely be a service side fix and not a model/SDK fix. I'll let you know.

@jterapin jterapin added service-api General API label for AWS Services. and removed investigating Issue is being investigated labels Jun 5, 2024
@mullermp
Copy link
Contributor

This appears to be fixed now on the service side. Please re-open if you still see issue.

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. service-api General API label for AWS Services.
Projects
None yet
Development

No branches or pull requests

3 participants