fix: detect context length errors in GCP Vertex AI provider (#6976)
Signed-off-by: rabi <ramishra@redhat.com>
This commit is contained in:
@@ -26,6 +26,7 @@ use crate::providers::formats::gcpvertexai::{
|
||||
ModelProvider, RequestContext, DEFAULT_MODEL, KNOWN_MODELS,
|
||||
};
|
||||
use crate::providers::gcpauth::GcpAuth;
|
||||
use crate::providers::openai_compatible::map_http_error_to_provider_error;
|
||||
use crate::providers::retry::RetryConfig;
|
||||
use crate::providers::utils::RequestLog;
|
||||
use crate::session_context::SESSION_ID_HEADER;
|
||||
@@ -351,9 +352,8 @@ impl GcpVertexAIProvider {
|
||||
)));
|
||||
} else {
|
||||
let response_text = response.text().await.unwrap_or_default();
|
||||
return Err(ProviderError::RequestFailed(format!(
|
||||
"Request failed with status {status}: {response_text}"
|
||||
)));
|
||||
let payload = serde_json::from_str::<Value>(&response_text).ok();
|
||||
return Err(map_http_error_to_provider_error(status, payload));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user