fix: new models have different messages for context length exceeded (#2763)

This commit is contained in:
Michael Neale
2025-06-03 23:53:32 +10:00
committed by GitHub
parent 959ebcb43f
commit 601744518d
3 changed files with 6 additions and 0 deletions

View File

@@ -138,6 +138,8 @@ impl DatabricksProvider {
"reduce the length",
"token count",
"exceeds",
"exceed context limit",
"max_tokens",
];
if check_phrases.iter().any(|c| payload_str.contains(c)) {
return Err(ProviderError::ContextLengthExceeded(payload_str));

View File

@@ -211,6 +211,8 @@ impl DatabricksProvider {
"reduce the length",
"token count",
"exceeds",
"exceed context limit",
"max_tokens",
];
if check_phrases.iter().any(|c| payload_str.contains(c)) {
return Err(ProviderError::ContextLengthExceeded(payload_str));

View File

@@ -333,6 +333,8 @@ impl SnowflakeProvider {
"reduce the length",
"token count",
"exceeds",
"exceed context limit",
"max_tokens",
];
if check_phrases.iter().any(|c| payload_str.contains(c)) {
return Err(ProviderError::ContextLengthExceeded("Request exceeds maximum context length. Please reduce the number of messages or content size.".to_string()));