Add filtering for agentVisible: false messages on streaming providers (#4847)

This commit is contained in:
David Katz
2025-09-29 17:20:57 -04:00
committed by GitHub
parent cb0eca9966
commit 1a92111f1a
12 changed files with 33 additions and 31 deletions
+1 -2
View File
@@ -43,10 +43,9 @@ pub fn get_messages_token_counts_async(
token_counter: &AsyncTokenCounter,
messages: &[Message],
) -> Vec<usize> {
// Calculate current token count of each message, use count_chat_tokens to ensure we
// capture the full content of the message, include ToolRequests and ToolResponses
messages
.iter()
.filter(|m| m.is_agent_visible())
.map(|msg| token_counter.count_chat_tokens("", std::slice::from_ref(msg), &[]))
.collect()
}