mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
fix(inference): demote expected model test failures (#3676)
This commit is contained in:
@@ -34,6 +34,12 @@ pub struct InferenceTestProviderModelResult {
|
||||
pub reply: String,
|
||||
}
|
||||
|
||||
fn expected_test_provider_model_error_kind(
|
||||
err: &str,
|
||||
) -> Option<crate::core::observability::ExpectedErrorKind> {
|
||||
crate::core::observability::expected_error_kind(err)
|
||||
}
|
||||
|
||||
pub async fn inference_status(config: &Config) -> Result<RpcOutcome<LocalAiStatus>, String> {
|
||||
debug!("{LOG_PREFIX} status:start");
|
||||
let result = local_runtime::rpc::local_ai_status(config).await;
|
||||
@@ -179,12 +185,24 @@ pub async fn inference_test_provider_model(
|
||||
output_len = outcome.value.reply.len(),
|
||||
"{LOG_PREFIX} test_provider_model:ok"
|
||||
),
|
||||
Err(err) => error!(
|
||||
workload,
|
||||
provider,
|
||||
error = %err,
|
||||
"{LOG_PREFIX} test_provider_model:error"
|
||||
),
|
||||
Err(err) => {
|
||||
if let Some(kind) = expected_test_provider_model_error_kind(err) {
|
||||
warn!(
|
||||
workload,
|
||||
provider,
|
||||
expected_error_kind = ?kind,
|
||||
error = %err,
|
||||
"{LOG_PREFIX} test_provider_model:expected_error"
|
||||
);
|
||||
} else {
|
||||
error!(
|
||||
workload,
|
||||
provider,
|
||||
error = %err,
|
||||
"{LOG_PREFIX} test_provider_model:error"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
@@ -112,6 +112,26 @@ async fn inference_test_provider_model_routes_ollama_prefix_through_provider_lay
|
||||
assert_eq!(outcome.value.reply, "OLLAMA_PROVIDER_OK");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inference_test_provider_model_demotes_expected_config_errors() {
|
||||
let kind = expected_test_provider_model_error_kind(
|
||||
"OpenAI API error (401 Unauthorized): missing API key",
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
kind,
|
||||
Some(crate::core::observability::ExpectedErrorKind::ApiKeyMissing)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inference_test_provider_model_keeps_unexpected_errors_reportable() {
|
||||
assert_eq!(
|
||||
expected_test_provider_model_error_kind("provider task panicked while parsing response"),
|
||||
None
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn inference_should_react_short_circuits_for_empty_message() {
|
||||
let (config, _tmp) = disabled_config();
|
||||
|
||||
Reference in New Issue
Block a user