Skip to content

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

refactor(inference): remove unused imports and boilerplate

Steven Enamakel966f743d5a88
diff --git a/crates/openhuman-core/src/inference/ops/models.rs b/crates/openhuman-core/src/inference/ops/models.rs
index d57bf724ae..611d3aa6ca 100644
--- a/crates/openhuman-core/src/inference/ops/models.rs
+++ b/crates/openhuman-core/src/inference/ops/models.rs
@@ -1,5 +1,3 @@
-//! JSON-RPC controller surface for inference operations.
-
use crate::config::rpc as config_rpc;
use crate::config::Config;
use crate::core::runtime::DispatchCtx;
@@ -7,24 +5,10 @@ use crate::core::Outcome;
use crate::inference::host_runtime as local_runtime;
use crate::inference::provider as providers;
use serde_json::{json, Value};
-use tinyinference_llm::message::Message;
-use tinyinference_llm::model::ModelRequest;
-use tinyinference_llm::sentiment::{parse_sentiment_response, SentimentResult};
-use tinyinference_local::status::LocalAiStatus;
use tracing::{debug, error, warn};
const LOG_PREFIX: &str = "[inference::ops]";
-/// User picked a provider id (slug) that isn't registered in the cloud
-/// provider list — e.g. selecting `"ollama"` as a cloud provider when it's
-/// actually a local runtime. Matches the literal phrase emitted at
-/// `crates/openhuman-core/src/inference/provider/models/catalog_listing.rs:54`
-/// (`"no cloud provider with id or slug '{}' found"`).
-///
-/// Used by [`inference_list_models`] to demote this user-config case to
-/// `warn!` so it stops escalating to Sentry (TAURI-RUST-X, ~5740 events).
-/// The matcher is anchored on the exact phrase so unrelated sibling
-/// failures (TAURI-RUST-12 JSON parse, TAURI-RUST-2W reqwest builder,
fn is_unknown_provider_user_config(err: &str) -> bool {
err.contains("no cloud provider with id or slug")
}
diff --git a/crates/openhuman-core/src/inference/ops/oauth.rs b/crates/openhuman-core/src/inference/ops/oauth.rs
index b1c480b42d..48d3e45832 100644
--- a/crates/openhuman-core/src/inference/ops/oauth.rs
+++ b/crates/openhuman-core/src/inference/ops/oauth.rs
@@ -1,23 +1,10 @@
-//! JSON-RPC controller surface for inference operations.
-
-use crate::config::rpc as config_rpc;
use crate::config::Config;
-use crate::core::runtime::DispatchCtx;
use crate::core::Outcome;
-use crate::inference::host_runtime as local_runtime;
-use crate::inference::provider as providers;
use serde_json::{json, Value};
-use tinyinference_llm::message::Message;
-use tinyinference_llm::model::ModelRequest;
-use tinyinference_llm::sentiment::{parse_sentiment_response, SentimentResult};
-use tinyinference_local::status::LocalAiStatus;
-use tracing::{debug, error, warn};
+use tracing::{debug, warn};
const LOG_PREFIX: &str = "[inference::ops]";
-/// User picked a provider id (slug) that isn't registered in the cloud
-/// provider list — e.g. selecting `"ollama"` as a cloud provider when it's
-/// actually a local runtime. Matches the literal phrase emitted at
pub async fn inference_provider_auth_errors() -> Result<Outcome<Value>, String> {
let errors = crate::inference::auth_error_registry::snapshot();
debug!(count = errors.len(), "{LOG_PREFIX} provider_auth_errors:ok");
diff --git a/crates/openhuman-core/src/inference/ops/sentiment.rs b/crates/openhuman-core/src/inference/ops/sentiment.rs
index 92b4eb04af..4792daeed4 100644
--- a/crates/openhuman-core/src/inference/ops/sentiment.rs
+++ b/crates/openhuman-core/src/inference/ops/sentiment.rs
@@ -1,23 +1,11 @@
-//! JSON-RPC controller surface for inference operations.
-
-use crate::config::rpc as config_rpc;
use crate::config::Config;
-use crate::core::runtime::DispatchCtx;
use crate::core::Outcome;
use crate::inference::host_runtime as local_runtime;
-use crate::inference::provider as providers;
-use serde_json::{json, Value};
-use tinyinference_llm::message::Message;
-use tinyinference_llm::model::ModelRequest;
use tinyinference_llm::sentiment::{parse_sentiment_response, SentimentResult};
-use tinyinference_local::status::LocalAiStatus;
-use tracing::{debug, error, warn};
+use tracing::{debug, warn};
const LOG_PREFIX: &str = "[inference::ops]";
-/// User picked a provider id (slug) that isn't registered in the cloud
-/// provider list — e.g. selecting `"ollama"` as a cloud provider when it's
-/// actually a local runtime. Matches the literal phrase emitted at
pub async fn inference_analyze_sentiment(
config: &Config,
message: &str,
diff --git a/crates/openhuman-core/src/inference/ops/status.rs b/crates/openhuman-core/src/inference/ops/status.rs
index 1128aabd19..ea52b0601e 100644
--- a/crates/openhuman-core/src/inference/ops/status.rs
+++ b/crates/openhuman-core/src/inference/ops/status.rs
@@ -1,36 +1,15 @@
-//! JSON-RPC controller surface for inference operations.
-
-use crate::config::rpc as config_rpc;
use crate::config::Config;
-use crate::core::runtime::DispatchCtx;
use crate::core::Outcome;
use crate::inference::host_runtime as local_runtime;
use crate::inference::provider as providers;
-use serde_json::{json, Value};
+use serde_json::Value;
use tinyinference_llm::message::Message;
use tinyinference_llm::model::ModelRequest;
-use tinyinference_llm::sentiment::{parse_sentiment_response, SentimentResult};
use tinyinference_local::status::LocalAiStatus;
use tracing::{debug, error, warn};
const LOG_PREFIX: &str = "[inference::ops]";
-/// User picked a provider id (slug) that isn't registered in the cloud
-/// provider list — e.g. selecting `"ollama"` as a cloud provider when it's
-/// actually a local runtime. Matches the literal phrase emitted at
-/// `crates/openhuman-core/src/inference/provider/models/catalog_listing.rs:54`
-/// (`"no cloud provider with id or slug '{}' found"`).
-///
-/// Used by [`inference_list_models`] to demote this user-config case to
-/// `warn!` so it stops escalating to Sentry (TAURI-RUST-X, ~5740 events).
-/// The matcher is anchored on the exact phrase so unrelated sibling
-/// failures (TAURI-RUST-12 JSON parse, TAURI-RUST-2W reqwest builder,
-/// TAURI-RUST-JP local ollama_admin transport) still surface as real
-/// errors.
-fn is_unknown_provider_user_config(err: &str) -> bool {
- err.contains("no cloud provider with id or slug")
-}
-
#[derive(Debug, Clone, serde::Serialize)]
pub struct InferenceTestChatModelResult {
pub reply: String,