Handle Bedrock 'prompt is too long' error (#7550)

Signed-off-by: Oleg Levchenko <oleg.levchenko@ooma.com>
Co-authored-by: Oleg Levchenko <oleg.levchenko@ooma.com>
This commit is contained in:
u35tpus
2026-02-27 17:05:39 +01:00
committed by GitHub
parent 69ad519373
commit 83ac417d74
+5 -4
View File
@@ -284,10 +284,11 @@ impl BedrockProvider {
ProviderError::Authentication(format!("Failed to call Bedrock: {:?}", err))
}
ConverseError::ValidationException(err)
if err
.message()
.unwrap_or_default()
.contains("Input is too long for requested model.") =>
if {
let msg = err.message().unwrap_or_default();
msg.contains("Input is too long for requested model.")
|| msg.contains("prompt is too long")
} =>
{
ProviderError::ContextLengthExceeded(format!(
"Failed to call Bedrock: {:?}",