Skip to content

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

refactor(multimodal): remove unused `contains_image_markers` and `contains_file_markers` helpers

Steven Enamakel817a2eed2c1a
diff --git a/crates/openhuman-core/src/agent/multimodal.rs b/crates/openhuman-core/src/agent/multimodal.rs
index 9651f29e68..7fe092921c 100644
--- a/crates/openhuman-core/src/agent/multimodal.rs
+++ b/crates/openhuman-core/src/agent/multimodal.rs
@@ -213,11 +213,6 @@ pub fn count_image_markers(messages: &[ChatMessage]) -> usize {
.unwrap_or(0)
}
-/// Whether the latest user message carries any image marker.
-pub fn contains_image_markers(messages: &[ChatMessage]) -> bool {
- count_image_markers(messages) > 0
-}
-
/// Count `[FILE:…]` markers in the **latest** user message only — same
/// per-turn semantics as [`count_image_markers`].
pub fn count_file_markers(messages: &[ChatMessage]) -> usize {
@@ -226,11 +221,6 @@ pub fn count_file_markers(messages: &[ChatMessage]) -> usize {
.unwrap_or(0)
}
-/// Whether the latest user message carries any file marker.
-pub fn contains_file_markers(messages: &[ChatMessage]) -> bool {
- count_file_markers(messages) > 0
-}
-
fn latest_user_message(messages: &[ChatMessage]) -> Option<&ChatMessage> {
messages.iter().rev().find(|m| m.role == "user")
}
diff --git a/crates/openhuman-core/src/agent/multimodal_attachment_handling_tests.rs b/crates/openhuman-core/src/agent/multimodal_attachment_handling_tests.rs
index 8ecd916b38..a6590b2b0f 100644
--- a/crates/openhuman-core/src/agent/multimodal_attachment_handling_tests.rs
+++ b/crates/openhuman-core/src/agent/multimodal_attachment_handling_tests.rs
@@ -50,7 +50,6 @@ fn count_markers_only_inspects_latest_user_message() {
ChatMessage::user("now just one [FILE:/tmp/e.txt]".to_string()),
];
assert_eq!(count_file_markers(&history), 1);
- assert!(contains_file_markers(&history));
let history_no_new_files = vec![
ChatMessage::user("[FILE:/tmp/a.txt] [FILE:/tmp/b.txt]".to_string()),
@@ -58,7 +57,6 @@ fn count_markers_only_inspects_latest_user_message() {
ChatMessage::user("no attachments this turn".to_string()),
];
assert_eq!(count_file_markers(&history_no_new_files), 0);
- assert!(!contains_file_markers(&history_no_new_files));
// Same semantics for the image counter.
let image_history = vec![
diff --git a/tests/agent_multimodal_public.rs b/tests/agent_multimodal_public.rs
index 015cdd7b75..84f8d6d49a 100644
--- a/tests/agent_multimodal_public.rs
+++ b/tests/agent_multimodal_public.rs
@@ -1,7 +1,7 @@
use anyhow::Result;
use openhuman_core::agent::messages::ChatMessage;
use openhuman_core::agent::multimodal::{
- contains_image_markers, count_image_markers, extract_ollama_image_payload, parse_image_markers,
+ count_image_markers, extract_ollama_image_payload, parse_image_markers,
prepare_messages_for_provider,
};
use openhuman_core::config::{MultimodalConfig, MultimodalFileConfig};
@@ -17,7 +17,6 @@ fn marker_helpers_cover_mixed_content_and_payload_extraction() {
assert_eq!(cleaned, "look then");
assert_eq!(refs.len(), 2);
assert_eq!(count_image_markers(&messages), 2);
- assert!(contains_image_markers(&messages));
assert_eq!(
extract_ollama_image_payload("data:image/png;base64,abcd").as_deref(),
Some("abcd")
@@ -37,10 +36,6 @@ fn marker_helpers_cover_mixed_content_and_payload_extraction() {
let (cleaned_empty, refs_empty) = parse_image_markers("keep [IMAGE:] literal");
assert_eq!(cleaned_empty, "keep [IMAGE:] literal");
assert!(refs_empty.is_empty());
-
- assert!(!contains_image_markers(&[ChatMessage::assistant(
- "no user refs"
- )]));
}
#[tokio::test]