Fast model falls back to regular (#4375)
This commit is contained in:
@@ -348,8 +348,27 @@ pub trait Provider: Send + Sync {
|
|||||||
) -> Result<(Message, ProviderUsage), ProviderError> {
|
) -> Result<(Message, ProviderUsage), ProviderError> {
|
||||||
let model_config = self.get_model_config();
|
let model_config = self.get_model_config();
|
||||||
let fast_config = model_config.use_fast_model();
|
let fast_config = model_config.use_fast_model();
|
||||||
self.complete_with_model(&fast_config, system, messages, tools)
|
|
||||||
|
match self
|
||||||
|
.complete_with_model(&fast_config, system, messages, tools)
|
||||||
.await
|
.await
|
||||||
|
{
|
||||||
|
Ok(result) => Ok(result),
|
||||||
|
Err(e) => {
|
||||||
|
if fast_config.model_name != model_config.model_name {
|
||||||
|
tracing::warn!(
|
||||||
|
"Fast model {} failed with error: {}. Falling back to regular model {}",
|
||||||
|
fast_config.model_name,
|
||||||
|
e,
|
||||||
|
model_config.model_name
|
||||||
|
);
|
||||||
|
self.complete_with_model(&model_config, system, messages, tools)
|
||||||
|
.await
|
||||||
|
} else {
|
||||||
|
Err(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the model config from the provider
|
/// Get the model config from the provider
|
||||||
|
|||||||
Reference in New Issue
Block a user