Skip to content

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

chore(inference): apply rustfmt import ordering and catalog discovery cleanup

Steven Enamakel28562991d75c
diff --git a/crates/openhuman-core/src/inference/embedding_host/schemas.rs b/crates/openhuman-core/src/inference/embedding_host/schemas.rs
index 6a08eaaf01..a0d44c2bb3 100644
--- a/crates/openhuman-core/src/inference/embedding_host/schemas.rs
+++ b/crates/openhuman-core/src/inference/embedding_host/schemas.rs
@@ -7,7 +7,9 @@ use serde_json::{Map, Value};
use crate::core::all::{ControllerFuture, RegisteredController};
use crate::core::Outcome;
use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
-use crate::inference::schema_fields::{json_output, optional_string, optional_u64, required_string};
+use crate::inference::schema_fields::{
+ json_output, optional_string, optional_u64, required_string,
+};
pub fn all_controller_schemas() -> Vec<ControllerSchema> {
vec![
diff --git a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
index 8fe6ea263b..88bdb38fdb 100644
--- a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
@@ -13,8 +13,8 @@ use super::{
try_create_local_runtime_chat_model_from_string, OptionalChatModelResult,
},
managed_backend::{make_openhuman_backend_model_for_thread_in, managed_chat_model_for},
- provider_for_role, resolves_to_managed_backend, OpenHumanMcpEndpoint,
- CLAUDE_AGENT_SDK_PREFIX, CLAUDE_AGENT_SDK_PROVIDER, PROVIDER_OPENHUMAN,
+ provider_for_role, resolves_to_managed_backend, OpenHumanMcpEndpoint, CLAUDE_AGENT_SDK_PREFIX,
+ CLAUDE_AGENT_SDK_PROVIDER, PROVIDER_OPENHUMAN,
};
use crate::config::ops::resolve_primary_cloud_provider_string;
use crate::config::schema::cloud_providers::AuthStyle;
diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
index 37d54aed4b..d56b303467 100644
--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
@@ -2,11 +2,11 @@
//! abstract-tier remapping, credentials, codex routing) and the crate-native builders.
use super::{
- access_gates::{enforce_local_only_inference, emit_inference_egress},
+ access_gates::{emit_inference_egress, enforce_local_only_inference},
credentials::CredentialAccess,
openai_bearer_is_oauth, provider_for_role, resolve_codex_routing,
- InspectionOutputBudgetCapability, OptionalChatModelResult, PROVIDER_OPENHUMAN,
- CLAUDE_AGENT_SDK_PREFIX, CLAUDE_AGENT_SDK_PROVIDER,
+ InspectionOutputBudgetCapability, OptionalChatModelResult, CLAUDE_AGENT_SDK_PREFIX,
+ CLAUDE_AGENT_SDK_PROVIDER, PROVIDER_OPENHUMAN,
};
use crate::config::ops::resolve_primary_cloud_provider_string;
use crate::config::schema::cloud_providers::AuthStyle;
diff --git a/crates/openhuman-core/src/inference/provider/factory/inspection.rs b/crates/openhuman-core/src/inference/provider/factory/inspection.rs
index b734e0c0af..c6dc0e0edb 100644
--- a/crates/openhuman-core/src/inference/provider/factory/inspection.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/inspection.rs
@@ -1,7 +1,10 @@
//! Read-only provider preparation for doctor inspections.
use super::{
- chat_model::{resolves_to_managed_backend, unresolved_chat_model_error_for_access, with_default_temperature},
+ chat_model::{
+ resolves_to_managed_backend, unresolved_chat_model_error_for_access,
+ with_default_temperature,
+ },
cloud_slug::try_create_cloud_slug_chat_model_for_inspection_with_identity,
credentials::CredentialAccess,
local_runtime::try_create_local_runtime_chat_model_for_inspection,
@@ -11,7 +14,7 @@ use super::{
try_create_claude_agent_sdk_chat_model_for_inspection,
try_create_claude_code_chat_model_for_inspection,
},
- InspectionOutputBudgetCapability, PreparedInspectionChatModel, InspectionRequestIdentity,
+ InspectionOutputBudgetCapability, InspectionRequestIdentity, PreparedInspectionChatModel,
PROVIDER_OPENHUMAN,
};
use crate::config::resolve_primary_cloud_provider_string;
diff --git a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
index afe36fe287..ede00c1954 100644
--- a/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
+++ b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
@@ -92,7 +92,11 @@ fn discovery_request(
let spec = crate::inference::provider::factory::cloud_provider_spec(entry, "catalog");
let route = ProviderRoute::parse(&format!("{}:catalog", entry.slug))
.ok_or_else(|| "cloud catalog route could not be parsed".to_string())?;
- let query_params = routing.client_version_query(&openai_codex_client_version());
+ let query_params = if routing.using_oauth {
+ routing.client_version_query(&openai_codex_client_version())
+ } else {
+ Vec::new()
+ };
let user_agent = routing
.using_oauth
.then(|| openai_codex_user_agent("OpenHuman", env!("CARGO_PKG_VERSION")));
@@ -106,11 +110,16 @@ fn discovery_request(
let registry = ProviderRegistry::new(
crate::inference::provider::factory::CloudCredentialResolver(provider_key),
);
- let request = registry
+ let request = match registry
.discovery_request_for_route_with_options(route, Some(spec.clone()), &options)
.map_err(|error| error.to_string())?
- .or_else(|| registry.discovery_request(&spec, &options).ok().flatten())
- .ok_or_else(|| "provider has no model catalog discovery request".to_string())?;
+ {
+ Some(request) => request,
+ None => registry
+ .discovery_request(&spec, &options)
+ .map_err(|error| error.to_string())?
+ .ok_or_else(|| "provider has no model catalog discovery request".to_string())?,
+ };
Ok(request
.with_single_model_probe(false)
.with_timeout(std::time::Duration::from_secs(30)))
diff --git a/crates/openhuman-core/src/inference/schemas/catalog.rs b/crates/openhuman-core/src/inference/schemas/catalog.rs
index 81293979e3..f9ee65ebe0 100644
--- a/crates/openhuman-core/src/inference/schemas/catalog.rs
+++ b/crates/openhuman-core/src/inference/schemas/catalog.rs
@@ -2,7 +2,9 @@
//! function, plus the field-shape helpers they are built from.
use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
-use crate::inference::schema_fields::{json_output, optional_string, optional_u64, required_string};
+use crate::inference::schema_fields::{
+ json_output, optional_string, optional_u64, required_string,
+};
pub fn schemas(function: &str) -> ControllerSchema {
match function {
@@ -352,4 +354,3 @@ fn optional_json(name: &'static str, comment: &'static str) -> FieldSchema {
required: false,
}
}
-
diff --git a/crates/openhuman-tinyhumans/src/inference/managed_catalog.rs b/crates/openhuman-tinyhumans/src/inference/managed_catalog.rs
index 368fe5b326..adace61429 100644
--- a/crates/openhuman-tinyhumans/src/inference/managed_catalog.rs
+++ b/crates/openhuman-tinyhumans/src/inference/managed_catalog.rs
@@ -276,11 +276,11 @@ pub(super) async fn list_models(
.http_status()
.is_some_and(|status| managed_401_means_signed_out(status, session_attached))
{
- log::info!(
- "[tinyhumans][inference] managed catalog unavailable: backend rejected the session token (401)"
- );
- return empty_catalog("session not accepted");
- }
+ log::info!(
+ "[tinyhumans][inference] managed catalog unavailable: backend rejected the session token (401)"
+ );
+ return empty_catalog("session not accepted");
+ }
return Err(error.to_string());
}
};