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:
@@ -284,10 +284,11 @@ impl BedrockProvider {
|
|||||||
ProviderError::Authentication(format!("Failed to call Bedrock: {:?}", err))
|
ProviderError::Authentication(format!("Failed to call Bedrock: {:?}", err))
|
||||||
}
|
}
|
||||||
ConverseError::ValidationException(err)
|
ConverseError::ValidationException(err)
|
||||||
if err
|
if {
|
||||||
.message()
|
let msg = err.message().unwrap_or_default();
|
||||||
.unwrap_or_default()
|
msg.contains("Input is too long for requested model.")
|
||||||
.contains("Input is too long for requested model.") =>
|
|| msg.contains("prompt is too long")
|
||||||
|
} =>
|
||||||
{
|
{
|
||||||
ProviderError::ContextLengthExceeded(format!(
|
ProviderError::ContextLengthExceeded(format!(
|
||||||
"Failed to call Bedrock: {:?}",
|
"Failed to call Bedrock: {:?}",
|
||||||
|
|||||||
Reference in New Issue
Block a user