The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(inference): simplify agent_chat function signature
Steven Enamakelefd811d2ec33
diff --git a/crates/openhuman-core/src/inference/host_runtime/ops.rs b/crates/openhuman-core/src/inference/host_runtime/ops.rsindex 592d3cf2d5..a319ea9500 100644--- a/crates/openhuman-core/src/inference/host_runtime/ops.rs+++ b/crates/openhuman-core/src/inference/host_runtime/ops.rs@@ -9,15 +9,16 @@mod tests;mod agent_chat;+mod agent_chat_source;mod complete_once;mod runtime_ops;mod turn_guards;-pub(crate) use agent_chat::agent_chat_for_with_turn_model_source;pub use agent_chat::{agent_chat, agent_chat_for, agent_chat_reply_for, agent_chat_simple, AgentChatEnv,AgentChatReply, AgentChatTarget,};+pub(crate) use agent_chat_source::agent_chat_for_with_turn_model_source;pub use complete_once::{complete_once, CompletionEndpoint};pub use runtime_ops::{local_ai_prompt, local_ai_status, local_ai_summarize, local_ai_transcribe,diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rsindex 75a36f9088..0c5e383d83 100644--- a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs+++ b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs@@ -354,74 +354,22 @@ pub fn agent_chat_for<'a>(route: Option<crate::config::schema::EphemeralRoute>,env: AgentChatEnv,) -> futures::future::BoxFuture<'a, Result<Outcome<String>, String>> {- agent_chat_for_with_turn_model_source(- config,- target,- message,- model_override,- temperature,- thread_id,- cwd,- route,- env,- None,- )-}--#[allow(clippy::too_many_arguments)]-pub(crate) fn agent_chat_for_with_turn_model_source<'a>(- config: &'a mut Config,- target: AgentChatTarget<'a>,- message: &'a str,- model_override: Option<String>,- temperature: Option<f64>,- thread_id: Option<String>,- cwd: Option<String>,- route: Option<crate::config::schema::EphemeralRoute>,- env: AgentChatEnv,- turn_model_source: Option<(crate::agent::tinyagents::TurnModelSource, String)>,-) -> futures::future::BoxFuture<'a, Result<Outcome<String>, String>> {- Box::pin(agent_chat_for_inner(- config,- target,- message,- model_override,- temperature,- thread_id,- cwd,- route,- env,- turn_model_source,- ))-}--#[allow(clippy::too_many_arguments)]-async fn agent_chat_for_inner(- config: &mut Config,- target: AgentChatTarget<'_>,- message: &str,- model_override: Option<String>,- temperature: Option<f64>,- thread_id: Option<String>,- cwd: Option<String>,- route: Option<crate::config::schema::EphemeralRoute>,- env: AgentChatEnv,- turn_model_source: Option<(crate::agent::tinyagents::TurnModelSource, String)>,-) -> Result<Outcome<String>, String> {- agent_chat_reply_for_inner(- config,- target,- message,- model_override,- temperature,- thread_id,- cwd,- route,- env,- turn_model_source,- )- .await- .map(AgentChatReply::into_outcome)+ Box::pin(async {+ agent_chat_reply_for_inner(+ config,+ target,+ message,+ model_override,+ temperature,+ thread_id,+ cwd,+ route,+ env,+ None,+ )+ .await+ .map(AgentChatReply::into_outcome)+ })}/// [`agent_chat_for`], keeping whether the turn stopped at its iteration cap.@@ -454,7 +402,7 @@ pub async fn agent_chat_reply_for(}#[allow(clippy::too_many_arguments)]-async fn agent_chat_reply_for_inner(+pub(super) async fn agent_chat_reply_for_inner(config: &mut Config,target: AgentChatTarget<'_>,message: &str,diff --git a/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_source.rs b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_source.rsnew file mode 100644index 0000000000..91d90444e1--- /dev/null+++ b/crates/openhuman-core/src/inference/host_runtime/ops/agent_chat_source.rs@@ -0,0 +1,37 @@+//! Internal entry point for agent chat turns that inherit a resolved model source.++use super::agent_chat::{+ agent_chat_reply_for_inner, AgentChatEnv, AgentChatReply, AgentChatTarget,+};+use crate::config::Config;++#[allow(clippy::too_many_arguments)]+pub(crate) fn agent_chat_for_with_turn_model_source<'a>(+ config: &'a mut Config,+ target: AgentChatTarget<'a>,+ message: &'a str,+ model_override: Option<String>,+ temperature: Option<f64>,+ thread_id: Option<String>,+ cwd: Option<String>,+ route: Option<crate::config::schema::EphemeralRoute>,+ env: AgentChatEnv,+ turn_model_source: (crate::agent::tinyagents::TurnModelSource, String),+) -> futures::future::BoxFuture<'a, Result<crate::core::Outcome<String>, String>> {+ Box::pin(async move {+ agent_chat_reply_for_inner(+ config,+ target,+ message,+ model_override,+ temperature,+ thread_id,+ cwd,+ route,+ env,+ Some(turn_model_source),+ )+ .await+ .map(AgentChatReply::into_outcome)+ })+}