Skip to content

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

refactor(core): update chatresponse usage in tests

Steven Enamakel6dbdc9250d9b
diff --git a/crates/openhuman-core/src/agent/agent_tests.rs b/crates/openhuman-core/src/agent/agent_tests.rs
index 5e21980254..2ad63b74d1 100644
--- a/crates/openhuman-core/src/agent/agent_tests.rs
+++ b/crates/openhuman-core/src/agent/agent_tests.rs
@@ -29,13 +29,15 @@ use crate::config::AgentConfig;
use anyhow::Result;
use async_trait::async_trait;
use std::sync::{Arc, Mutex};
-use tinyinference_llm::model::ChatResponse;
use tinyinference_llm::model::{ChatModel, ModelProfile, ModelRequest, ModelResponse};
+use tinyinference_llm::usage::BilledUsage;
use tinytools::{Tool, ToolResult};
use tinytools_agent::dialect::NativeToolCall;
use tinytools_agent::dialect::TranscriptEntry;
use tinytools_agent::dialect::{NativeDialect, ToolDialect, XmlDialect};
+type ChatResponse = tinyinference_llm::model::ChatResponse<BilledUsage, NativeToolCall>;
+
// ═══════════════════════════════════════════════════════════════════════════
// Test Helpers — Mock Provider, Mock Tool, Mock Memory
// ═══════════════════════════════════════════════════════════════════════════
diff --git a/crates/openhuman-core/src/agent/agent_turn_loop_nudge_tests.rs b/crates/openhuman-core/src/agent/agent_turn_loop_nudge_tests.rs
index 938961edfc..d08261f7e2 100644
--- a/crates/openhuman-core/src/agent/agent_turn_loop_nudge_tests.rs
+++ b/crates/openhuman-core/src/agent/agent_turn_loop_nudge_tests.rs
@@ -1,5 +1,9 @@
use super::*;
use tinyinference_llm::message::Message;
+use tinyinference_llm::usage::BilledUsage;
+use tinytools_agent::dialect::NativeToolCall;
+
+type ChatResponse = tinyinference_llm::model::ChatResponse<BilledUsage, NativeToolCall>;
// #6725: the repeated-failure breaker's corrective nudge reaches the next model
// request only. It used to be a steering `InjectMessage`, which joined the
diff --git a/crates/openhuman-core/src/agent/cost_tests.rs b/crates/openhuman-core/src/agent/cost_tests.rs
index 10b022da54..3f98366f27 100644
--- a/crates/openhuman-core/src/agent/cost_tests.rs
+++ b/crates/openhuman-core/src/agent/cost_tests.rs
@@ -11,7 +11,10 @@ fn counts(input: u64, output: u64, cached: u64) -> BilledUsage {
fn record(turn: &mut tinyagents_harness::cost::TurnCost, model: &str, usage: &BilledUsage) {
use tinyagents_hooks::stop::StopHookMetrics as _;
let response = tinyinference_llm::model::response_to_model_response(
- &tinyinference_llm::model::ChatResponse {
+ &tinyinference_llm::model::ChatResponse::<
+ tinyinference_llm::usage::BilledUsage,
+ tinytools_agent::dialect::NativeToolCall,
+ > {
text: Some("ok".into()),
usage: Some(*usage),
..Default::default()
diff --git a/crates/openhuman-core/src/inference/ops.rs b/crates/openhuman-core/src/inference/ops.rs
index f4ff5951d9..5a6688e8b5 100644
--- a/crates/openhuman-core/src/inference/ops.rs
+++ b/crates/openhuman-core/src/inference/ops.rs
@@ -5,7 +5,8 @@ mod oauth;
mod sentiment;
mod status;
-pub(super) use models::is_unknown_provider_user_config;
+#[cfg(test)]
+use models::is_unknown_provider_user_config;
pub use models::{
inference_get_client_config, inference_list_models, inference_update_local_settings,
inference_update_model_settings,
@@ -16,7 +17,9 @@ pub use oauth::{
inference_openai_oauth_status, inference_provider_auth_errors,
};
pub use sentiment::inference_analyze_sentiment;
-pub(super) use status::{expected_test_provider_model_error_kind, InferenceTestChatModelResult};
+#[cfg(test)]
+use status::expected_test_provider_model_error_kind;
+pub use status::InferenceTestChatModelResult;
pub use status::{
inference_diagnostics, inference_prompt, inference_status, inference_summarize,
inference_test_provider_model, inference_vision_prompt,
diff --git a/crates/openhuman-core/src/inference/ops/models.rs b/crates/openhuman-core/src/inference/ops/models.rs
index f6bece725b..95c0e6515d 100644
--- a/crates/openhuman-core/src/inference/ops/models.rs
+++ b/crates/openhuman-core/src/inference/ops/models.rs
@@ -1,10 +1,9 @@
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 tracing::{debug, error, warn};
const LOG_PREFIX: &str = "[inference::ops]";
diff --git a/crates/openhuman-core/src/inference/ops_tests.rs b/crates/openhuman-core/src/inference/ops_tests.rs
index b0f3b88180..d0463dab25 100644
--- a/crates/openhuman-core/src/inference/ops_tests.rs
+++ b/crates/openhuman-core/src/inference/ops_tests.rs
@@ -1,4 +1,5 @@
use super::*;
+use crate::config::Config;
use crate::core::runtime::DispatchCtx;
use crate::security::credentials::openai_oauth::{OPENAI_OAUTH_PROFILE_NAME, OPENAI_PROVIDER_KEY};
use crate::security::credentials::profiles::{AuthProfile, AuthProfilesStore, TokenSet};
diff --git a/crates/openhuman-core/src/platform/cost/global_tests.rs b/crates/openhuman-core/src/platform/cost/global_tests.rs
index 8254a1f40f..5b6a2e0db8 100644
--- a/crates/openhuman-core/src/platform/cost/global_tests.rs
+++ b/crates/openhuman-core/src/platform/cost/global_tests.rs
@@ -113,7 +113,10 @@ fn native_usage_round_trip_preserves_submicro_usd_and_charge_state_in_cost_rows(
let billed = BilledUsage::from_counts(4, 2).with_charged_usd(0.00000042);
let response = tinyinference_llm::model::response_to_model_response(
- &tinyinference_llm::model::ChatResponse {
+ &tinyinference_llm::model::ChatResponse::<
+ tinyinference_llm::usage::BilledUsage,
+ tinytools_agent::dialect::NativeToolCall,
+ > {
usage: Some(billed),
..Default::default()
},
@@ -131,7 +134,10 @@ fn native_usage_round_trip_preserves_submicro_usd_and_charge_state_in_cost_rows(
let free = tinyinference_llm::usage::usage_info_from_response(
&tinyinference_llm::model::response_to_model_response(
- &tinyinference_llm::model::ChatResponse {
+ &tinyinference_llm::model::ChatResponse::<
+ tinyinference_llm::usage::BilledUsage,
+ tinytools_agent::dialect::NativeToolCall,
+ > {
usage: Some(BilledUsage::from_counts(4, 2).with_charged_usd(0.0)),
..Default::default()
},
@@ -145,7 +151,10 @@ fn native_usage_round_trip_preserves_submicro_usd_and_charge_state_in_cost_rows(
let unknown = tinyinference_llm::usage::usage_info_from_response(
&tinyinference_llm::model::response_to_model_response(
- &tinyinference_llm::model::ChatResponse {
+ &tinyinference_llm::model::ChatResponse::<
+ tinyinference_llm::usage::BilledUsage,
+ tinytools_agent::dialect::NativeToolCall,
+ > {
usage: Some(BilledUsage::from_counts(4, 2)),
..Default::default()
},