[Enhancement]: <Bedrock Converse Claude 3.7 Reasoning Support in Rust>

Open
#7,346 0 comments 1 reaction 1 assignee View on GitHub

Maintainers usually reply within 2 days

@brmur is already working on this.

Since Apr 3, 2025.

Assessment

This issue has not been assessed yet.

Description

New example request
Background story

Hello, I am trying to use the Bedrock Converse API in Rust. I have successfully implemented multiple models, but am now trying and failing to include Reasoning in the latest Claude 3.7. I see support for it in other languages, but I cannot find any documentation or examples for enabling thinking mode and setting budget tokens in Rust. I am not sure if support has been added and I am writing the syntax incorrectly, if there is a bug, or if Rust just hasn't been caught up to include a reasoning config yet.

What does this example accomplish?

I want to enable thinking and budget_tokens limits to include reasoning in my Claude 3.7 model.

Which AWS service(s)?

AWS Bedrock Converse

Which AWS SDKs or tools?
  • All languages
  • .NET
  • C++
  • Go (v2)
  • Java
  • Java (v2)
  • JavaScript
  • JavaScript (v3)
  • Kotlin
  • PHP
  • Python
  • Ruby
  • Rust
  • Swift
  • Not applicable
Are there existing code examples to leverage?

Working off of the AWS Bedrock Converse Rust SDK examples here

Do you have any reference code?
// I have tried adding `additional_model_request_fields` as a `JSON` and as a `Document` object, but keep running into errors that it has to be the other type.

let json_value = serde_json::json!({
          "reasoning_config": {
              "type": "enabled",
              "budget_tokens": 3000
          }
        });

// Convert the JSON value to a string.
let json_string = serde_json::to_string(&json_value)
  .map_err(|e| format!("Failed to serialize JSON: {}", e))?;

// Convert the string to a Document.
let additional_model_request_fields = Document::from(json_string.as_str());

let response = client
    .converse()
    .model_id(model)
    .additional_model_request_fields(additional_model_request_fields)
    .messages(
        Message::builder()
            .role(ConversationRole::User)
            .content(ContentBlock::Text(prompt_template))
            .build()
            .map_err(|_| "failed to build message")?,
    )
    .send()
    .await;
Dominant language
Java
Stars
10.5k
Forks
5.8k
Avg merge
2d 21h
Merged PRs (30d)
30

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from awsdocs/aws-doc-sdk-examples

All issues in awsdocs/aws-doc-sdk-examples

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.