Skip to content

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

refactor(inference): clean up cloud slug resolution functions

Steven Enamakel8482efff31f5
diff --git a/crates/openhuman-core/src/inference/provider/factory.rs b/crates/openhuman-core/src/inference/provider/factory.rs
index 7dead32556..7b3e04b65c 100644
--- a/crates/openhuman-core/src/inference/provider/factory.rs
+++ b/crates/openhuman-core/src/inference/provider/factory.rs
@@ -74,17 +74,17 @@ pub(crate) use turn_model::{
use access_gates::{emit_inference_egress, enforce_local_only_inference};
use chat_model::{unresolved_chat_model_error, unresolved_chat_model_error_for, with_default_temperature};
use cloud_slug::{
- resolve_cloud_slug, resolve_cloud_slug_for, try_create_cloud_slug_chat_model,
- try_create_cloud_slug_chat_model_from_string,
+ resolve_cloud_slug_for, try_create_cloud_slug_chat_model_from_string,
try_create_cloud_slug_chat_model_from_string_with_native_tools_for,
- try_create_cloud_slug_chat_model_with_native_tools,
try_create_cloud_slug_chat_model_with_native_tools_for,
};
+#[cfg(test)]
+use cloud_slug::try_create_cloud_slug_chat_model;
use local_runtime::{
try_create_local_runtime_chat_model, try_create_local_runtime_chat_model_from_string,
OptionalChatModelResult,
};
-use managed_backend::{managed_chat_model, managed_chat_model_for};
+use managed_backend::managed_chat_model_for;
pub(crate) use managed_backend::{
make_openhuman_backend_model_for_options, make_openhuman_backend_model_for_thread,
make_openhuman_backend_model_for_thread_in, make_openhuman_backend_model_in,
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 21efdca502..0eee898c0a 100644
--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
@@ -22,16 +22,6 @@ pub(super) struct CloudSlugResolution<'a> {
pub(super) codex: tinyinference_llm::providers::openai::codex::OpenAiCodexRouting,
}
-pub(super) fn resolve_cloud_slug<'a>(
- role: &str,
- slug: &str,
- model: &str,
- config: &'a Config,
-) -> anyhow::Result<CloudSlugResolution<'a>> {
- let extensions = crate::core::runtime::CoreContext::current_extensions();
- resolve_cloud_slug_for(role, slug, model, config, extensions.as_deref())
-}
-
pub(super) fn resolve_cloud_slug_for<'a>(
role: &str,
slug: &str,
@@ -224,31 +214,23 @@ pub(super) fn resolve_cloud_slug_for<'a>(
/// non-codex slugs is not replicated (the crate has responses-*primary*, not
/// fallback); chat completions is the primary path those slugs use in practice.
///
-/// The resolution is shared via [`resolve_cloud_slug`], so slugs resolve
+/// The resolution is shared via [`resolve_cloud_slug_for`], so slugs resolve
/// identically to the legacy path; only the wire client differs. The **same**
/// access gate the `Provider` path applies (`enforce_local_only_inference` +
/// `verify_session_active`) runs before building. Temperature rides the per-call
/// `ModelRequest` (managed/local parity; the `@<temp>` suffix still bakes a fixed
/// override).
+#[cfg(test)]
pub(super) fn try_create_cloud_slug_chat_model(
role: &str,
config: &Config,
egress: &EgressLedger,
-) -> OptionalChatModelResult {
- try_create_cloud_slug_chat_model_with_native_tools(role, config, true, egress)
-}
-
-pub(super) fn try_create_cloud_slug_chat_model_with_native_tools(
- role: &str,
- config: &Config,
- native_tool_calling: bool,
- egress: &EgressLedger,
) -> OptionalChatModelResult {
let extensions = crate::core::runtime::CoreContext::current_extensions();
try_create_cloud_slug_chat_model_with_native_tools_for(
role,
config,
- native_tool_calling,
+ true,
egress,
extensions.as_deref(),
)