fix: new models have different messages for context length exceeded (#2763)
This commit is contained in:
@@ -138,6 +138,8 @@ impl DatabricksProvider {
|
|||||||
"reduce the length",
|
"reduce the length",
|
||||||
"token count",
|
"token count",
|
||||||
"exceeds",
|
"exceeds",
|
||||||
|
"exceed context limit",
|
||||||
|
"max_tokens",
|
||||||
];
|
];
|
||||||
if check_phrases.iter().any(|c| payload_str.contains(c)) {
|
if check_phrases.iter().any(|c| payload_str.contains(c)) {
|
||||||
return Err(ProviderError::ContextLengthExceeded(payload_str));
|
return Err(ProviderError::ContextLengthExceeded(payload_str));
|
||||||
|
|||||||
@@ -211,6 +211,8 @@ impl DatabricksProvider {
|
|||||||
"reduce the length",
|
"reduce the length",
|
||||||
"token count",
|
"token count",
|
||||||
"exceeds",
|
"exceeds",
|
||||||
|
"exceed context limit",
|
||||||
|
"max_tokens",
|
||||||
];
|
];
|
||||||
if check_phrases.iter().any(|c| payload_str.contains(c)) {
|
if check_phrases.iter().any(|c| payload_str.contains(c)) {
|
||||||
return Err(ProviderError::ContextLengthExceeded(payload_str));
|
return Err(ProviderError::ContextLengthExceeded(payload_str));
|
||||||
|
|||||||
@@ -333,6 +333,8 @@ impl SnowflakeProvider {
|
|||||||
"reduce the length",
|
"reduce the length",
|
||||||
"token count",
|
"token count",
|
||||||
"exceeds",
|
"exceeds",
|
||||||
|
"exceed context limit",
|
||||||
|
"max_tokens",
|
||||||
];
|
];
|
||||||
if check_phrases.iter().any(|c| payload_str.contains(c)) {
|
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()));
|
return Err(ProviderError::ContextLengthExceeded("Request exceeds maximum context length. Please reduce the number of messages or content size.".to_string()));
|
||||||
|
|||||||
Reference in New Issue
Block a user