diff --git a/crates/anthropic/src/anthropic.rs b/crates/anthropic/src/anthropic.rs index bd72fe1ef3db09c97ea853f7691f50a202b7f5ae..bc2516b8b0f53e79a03fca40f6ce4dc5b564efc1 100644 --- a/crates/anthropic/src/anthropic.rs +++ b/crates/anthropic/src/anthropic.rs @@ -781,7 +781,10 @@ pub async fn stream_completion_with_rate_limit_info( .filter_map(|line| async move { match line { Ok(line) => { - let line = line.strip_prefix("data: ")?; + let line = line + .strip_prefix("data: ") + .or_else(|| line.strip_prefix("data:"))?; + match serde_json::from_str(line) { Ok(response) => Some(Ok(response)), Err(error) => Some(Err(AnthropicError::DeserializeResponse(error))),