Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor: replace `crate::backend::classify` references with `tinyinference_providers`

Steven Enamakelc2ac2265c179
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/loop_guards.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/loop_guards.rs
index d6e0ad219b..6b06e48f9f 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/loop_guards.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/loop_guards.rs
@@ -113,7 +113,7 @@ fn has_inference_failure_envelope(result: &str) -> bool {
/// the two tight provider classifiers. Budget takes precedence if both match.
/// Ported from legacy `tool_loop::terminal_inference_failure_kind` (#3104).
pub(crate) fn terminal_inference_failure_kind(result: &str) -> Option<TerminalInferenceFailure> {
- use crate::backend::classify::is_budget_exhausted_message;
+ use tinyinference_providers::is_budget_exhausted_message;
use tinyinference_providers::is_provider_config_rejection_message;
if !has_inference_failure_envelope(result) {
return None;
diff --git a/crates/openhuman-core/src/backend/client.rs b/crates/openhuman-core/src/backend/client.rs
index 7ac04bd0fd..d2a216ae50 100644
--- a/crates/openhuman-core/src/backend/client.rs
+++ b/crates/openhuman-core/src/backend/client.rs
@@ -525,7 +525,7 @@ impl BackendClient {
let is_transient_infra =
crate::core::observability::is_transient_http_status_code(status_code);
let is_budget_exhausted =
- status_code == 400 && crate::backend::classify::is_budget_exhausted_message(&text);
+ status_code == 400 && tinyinference_providers::is_budget_exhausted_message(&text);
if is_budget_exhausted {
tracing::info!(
method = method.as_str(),
diff --git a/crates/openhuman-core/src/core/observability.rs b/crates/openhuman-core/src/core/observability.rs
index 03a9cb35b9..c83d96ff6a 100644
--- a/crates/openhuman-core/src/core/observability.rs
+++ b/crates/openhuman-core/src/core/observability.rs
@@ -641,7 +641,7 @@ pub fn expected_error_kind(message: &str) -> Option<ExpectedErrorKind> {
if is_local_ai_capability_unavailable_message(&lower) {
return Some(ExpectedErrorKind::LocalAiCapabilityUnavailable);
}
- if crate::backend::classify::is_budget_exhausted_message(message) {
+ if tinyinference_providers::is_budget_exhausted_message(message) {
return Some(ExpectedErrorKind::BudgetExhausted);
}
if is_backend_unavailable_message(message) {
@@ -3411,7 +3411,7 @@ fn event_contains_budget_exhausted_message(event: &sentry::protocol::Event<'_>)
if event
.message
.as_deref()
- .is_some_and(crate::backend::classify::is_budget_exhausted_message)
+ .is_some_and(tinyinference_providers::is_budget_exhausted_message)
{
return true;
}
@@ -3420,7 +3420,7 @@ fn event_contains_budget_exhausted_message(event: &sentry::protocol::Event<'_>)
exception
.value
.as_deref()
- .is_some_and(crate::backend::classify::is_budget_exhausted_message)
+ .is_some_and(tinyinference_providers::is_budget_exhausted_message)
})
}
diff --git a/crates/openhuman-core/src/cron/scheduler/failure_classification.rs b/crates/openhuman-core/src/cron/scheduler/failure_classification.rs
index 8e4cd4f838..dcd40563a4 100644
--- a/crates/openhuman-core/src/cron/scheduler/failure_classification.rs
+++ b/crates/openhuman-core/src/cron/scheduler/failure_classification.rs
@@ -186,7 +186,7 @@ pub(super) fn is_budget_exhausted_failure(
return false;
}
let signal = last_agent_error.unwrap_or(last_output);
- crate::backend::classify::is_budget_exhausted_message(signal)
+ tinyinference_providers::is_budget_exhausted_message(signal)
}
/// TAURI-RUST-HCK — a cron **agent** job pinned to a provider with no
diff --git a/crates/openhuman-core/src/inference/provider/ops/http_error/quota_and_credits.rs b/crates/openhuman-core/src/inference/provider/ops/http_error/quota_and_credits.rs
index 56f4629a30..33bb323b15 100644
--- a/crates/openhuman-core/src/inference/provider/ops/http_error/quota_and_credits.rs
+++ b/crates/openhuman-core/src/inference/provider/ops/http_error/quota_and_credits.rs
@@ -5,7 +5,7 @@
/// user-state error that should be demoted from Sentry to an info log.
pub fn is_budget_exhausted_http_400(status: reqwest::StatusCode, body: &str) -> bool {
status == reqwest::StatusCode::BAD_REQUEST
- && crate::backend::classify::is_budget_exhausted_message(body)
+ && tinyinference_providers::is_budget_exhausted_message(body)
}
pub fn log_budget_exhausted_http_400(
diff --git a/crates/openhuman-core/src/web_chat/web_errors/budget.rs b/crates/openhuman-core/src/web_chat/web_errors/budget.rs
index 980813a017..c8a745bfb6 100644
--- a/crates/openhuman-core/src/web_chat/web_errors/budget.rs
+++ b/crates/openhuman-core/src/web_chat/web_errors/budget.rs
@@ -34,7 +34,7 @@ pub(crate) fn is_inference_budget_exceeded_error(message: &str) -> bool {
// (issue #3088). Without this, an Ollama user with zero credits and
// routing still on Managed sees an opaque "provider error" and has no
// way to self-diagnose that they must top up or switch routing.
- crate::backend::classify::is_budget_exhausted_message(message)
+ tinyinference_providers::is_budget_exhausted_message(message)
}
pub(crate) fn inference_budget_exceeded_user_message() -> &'static str {