Skip to content

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

refactor(inference): move factory imports to their point of use

Steven Enamakel93bab6859116
diff --git a/crates/openhuman-core/src/inference/provider/factory.rs b/crates/openhuman-core/src/inference/provider/factory.rs
index f81ca3c43d..68022d2b3c 100644
--- a/crates/openhuman-core/src/inference/provider/factory.rs
+++ b/crates/openhuman-core/src/inference/provider/factory.rs
@@ -44,26 +44,11 @@ pub(crate) use routing::{workload_router, ConfigRouteSource};
// Factory-internal helpers shared across the implementation modules.
use access_gates::{emit_inference_egress, enforce_local_only_inference};
-use chat_model::{unresolved_chat_model_error_for_access, with_default_temperature};
#[cfg(test)]
use cloud_slug::try_create_cloud_slug_chat_model;
-use cloud_slug::{
- resolve_cloud_slug_with_access, try_create_cloud_slug_chat_model_for_inspection_with_identity,
- try_create_cloud_slug_chat_model_from_string_with_native_tools_for,
-};
-use credentials::CredentialAccess;
-use local_runtime::{
- try_create_local_runtime_chat_model_for_inspection,
- try_create_local_runtime_chat_model_from_string, OptionalChatModelResult,
-};
-use managed_backend::managed_chat_model_for;
pub(crate) use managed_backend::{
make_openhuman_backend_model_for_options, make_openhuman_backend_model_for_thread_in,
};
-use subprocess_providers::{
- try_create_claude_agent_sdk_chat_model_for_inspection,
- try_create_claude_code_chat_model_for_inspection, OpenHumanMcpEndpoint,
-};
use tinyinference_providers::route::split_model_and_temperature;
/// Test-only seam: inject a mock [`ChatModel`] so e2e tests can drive the
@@ -87,14 +72,9 @@ mod factory_tests;
use crate::config::schema::cloud_providers::AuthStyle;
use crate::config::Config;
-use crate::inference::provider::openai_codex::resolve_openai_codex_routing_for_inspection;
use crate::security::egress::EgressLedger;
use std::sync::Arc;
use tinyinference_llm::model::ChatModel;
-use tinyinference_llm::providers::openai::codex::{
- openai_codex_client_version, openai_codex_user_agent, OPENAI_CODEX_ACCOUNT_HEADER,
- OPENAI_CODEX_ORIGINATOR, OPENAI_CODEX_ORIGINATOR_HEADER,
-};
/// Opaque per-report identity for an inspection completion. It contains the
/// effective endpoint, exact frozen credential, and actual wire model, but
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 53684a710a..a3953cfd15 100644
--- a/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/chat_model.rs
@@ -3,11 +3,17 @@
use super::{
access_gates::{emit_inference_egress, enforce_local_only_inference},
- cloud_slug::{resolve_cloud_slug_for, resolve_cloud_slug_with_access},
+ cloud_slug::{
+ resolve_cloud_slug_for, resolve_cloud_slug_with_access,
+ try_create_cloud_slug_chat_model_from_string_with_native_tools_for,
+ },
credentials::CredentialAccess,
+ local_runtime::try_create_local_runtime_chat_model_from_string,
provider_for_role, BYOK_INCOMPLETE_SENTINEL, CLAUDE_AGENT_SDK_PREFIX,
- CLAUDE_AGENT_SDK_PROVIDER, PROVIDER_OPENHUMAN,
+ subprocess_providers::OpenHumanMcpEndpoint, CLAUDE_AGENT_SDK_PROVIDER, PROVIDER_OPENHUMAN,
};
+#[cfg(any(test, feature = "e2e-test-support", feature = "rss-bench"))]
+use super::test_provider_override;
use crate::config::ops::resolve_primary_cloud_provider_string;
use crate::config::Config;
use crate::core::runtime::DispatchCtx;
diff --git a/crates/openhuman-core/src/inference/provider/factory/inspection.rs b/crates/openhuman-core/src/inference/provider/factory/inspection.rs
index c6dc0e0edb..c6dae846c3 100644
--- a/crates/openhuman-core/src/inference/provider/factory/inspection.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/inspection.rs
@@ -15,7 +15,6 @@ use super::{
try_create_claude_code_chat_model_for_inspection,
},
InspectionOutputBudgetCapability, InspectionRequestIdentity, PreparedInspectionChatModel,
- PROVIDER_OPENHUMAN,
};
use crate::config::resolve_primary_cloud_provider_string;
use crate::config::Config;