bedrock: DeepSeek does not support receiving Reasoning Blocks (#33326)

Closes #32341

Release Notes:

- Fixed DeepSeek R1 errors for reasoning blocks being sent back to the model.
This commit is contained in:
Shardul Vaidya 2025-06-25 07:51:25 -04:00 committed by GitHub
parent c6ff58675f
commit 4396ac9dd6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -631,6 +631,11 @@ pub fn into_bedrock(
} }
} }
MessageContent::Thinking { text, signature } => { MessageContent::Thinking { text, signature } => {
if model.contains(Model::DeepSeekR1.request_id()) {
// DeepSeekR1 doesn't support thinking blocks
// And the AWS API demands that you strip them
return None;
}
let thinking = BedrockThinkingTextBlock::builder() let thinking = BedrockThinkingTextBlock::builder()
.text(text) .text(text)
.set_signature(signature) .set_signature(signature)
@ -643,6 +648,11 @@ pub fn into_bedrock(
)) ))
} }
MessageContent::RedactedThinking(blob) => { MessageContent::RedactedThinking(blob) => {
if model.contains(Model::DeepSeekR1.request_id()) {
// DeepSeekR1 doesn't support thinking blocks
// And the AWS API demands that you strip them
return None;
}
let redacted = let redacted =
BedrockThinkingBlock::RedactedContent(BedrockBlob::new(blob)); BedrockThinkingBlock::RedactedContent(BedrockBlob::new(blob));