fix(providers): fall back to configured models when models endpoint fetch fails (#7530)
Signed-off-by: Pete Gonzalez <4673363+octogonz@users.noreply.github.com> Signed-off-by: Douwe Osinga <douwe@squareup.com> Co-authored-by: Pete Gonzalez <octogonz@users.noreply.github.com> Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
@@ -34,6 +34,9 @@ pub enum ProviderError {
|
||||
#[error("Unsupported operation: {0}")]
|
||||
NotImplemented(String),
|
||||
|
||||
#[error("Endpoint not found (404): {0}")]
|
||||
EndpointNotFound(String),
|
||||
|
||||
#[error("Credits exhausted: {details}")]
|
||||
CreditsExhausted {
|
||||
details: String,
|
||||
@@ -53,9 +56,14 @@ impl ProviderError {
|
||||
ProviderError::ExecutionError(_) => "execution",
|
||||
ProviderError::UsageError(_) => "usage",
|
||||
ProviderError::NotImplemented(_) => "not_implemented",
|
||||
ProviderError::EndpointNotFound(_) => "endpoint_not_found",
|
||||
ProviderError::CreditsExhausted { .. } => "credits_exhausted",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_endpoint_not_found(&self) -> bool {
|
||||
matches!(self, ProviderError::EndpointNotFound(_))
|
||||
}
|
||||
}
|
||||
|
||||
fn is_network_error(err: &reqwest::Error) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user