Skip to content

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

test(turn_models): update name_of helper to handle ContentBlock variants

Steven Enamakel34fba84b38e0
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_models_tests.rs b/crates/openhuman-core/src/agent/tinyagents/turn_models_tests.rs
index 98092567bd..7c4523b17c 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_models_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_models_tests.rs
@@ -3,6 +3,7 @@ use std::sync::Arc;
use async_trait::async_trait;
use tinyagents_harness::host::{ModelResolveRequest, ModelResolver};
+use tinyinference_llm::message::ContentBlock;
use tinyinference_llm::model::{ChatModel, ModelRequest, ModelResponse};
use super::TurnModelResolver;
@@ -23,12 +24,19 @@ impl ChatModel<()> for NamedModel {
}
async fn name_of(model: &Arc<dyn ChatModel<()>>) -> String {
- model
+ let response = model
.invoke(&(), ModelRequest::default())
.await
- .expect("stub model never fails")
- .text()
- .unwrap_or_default()
+ .expect("stub model never fails");
+ response
+ .message
+ .content
+ .iter()
+ .filter_map(|block| match block {
+ ContentBlock::Text(text) => Some(text.as_str()),
+ _ => None,
+ })
+ .collect()
}
fn resolver() -> TurnModelResolver {