From ed9cc799a89fde90599495a5594cfaef2fd21292 Mon Sep 17 00:00:00 2001 From: "agentfarmx[bot]" <198411105+agentfarmx[bot]@users.noreply.github.com> Date: Sun, 23 Mar 2025 00:09:43 +0000 Subject: [PATCH] feat: handle ping events from Anthropic API in stream processing --- llm_client/src/clients/anthropic.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/llm_client/src/clients/anthropic.rs b/llm_client/src/clients/anthropic.rs index ac28681ff..447c6d533 100644 --- a/llm_client/src/clients/anthropic.rs +++ b/llm_client/src/clients/anthropic.rs @@ -580,6 +580,9 @@ impl AnthropicClient { message.usage.cache_read_input_tokens ); } + Ok(AnthropicEvent::Ping) => { + debug!("Received ping event from Anthropic API in tool completion"); + } Err(e) => { error!("Error parsing event: {:?}", e); // break; @@ -838,6 +841,9 @@ impl LLMClient for AnthropicClient { input_cached_tokens = input_cached_tokens + usage.cache_read_input_tokens.unwrap_or_default(); } + Ok(AnthropicEvent::Ping) => { + debug!("Received ping event from Anthropic API"); + } Err(e) => { println!("{:?}", e); // break; @@ -937,6 +943,9 @@ impl LLMClient for AnthropicClient { println!("input_json_delta::{}", &partial_json); } }, + Ok(AnthropicEvent::Ping) => { + debug!("Received ping event from Anthropic API in prompt completion"); + } Err(_) => { break; } @@ -948,4 +957,4 @@ impl LLMClient for AnthropicClient { Ok(buffered_string) } -} +} \ No newline at end of file