From 6af758c390c02102dd386992e82132934456d519 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Fri, 13 Mar 2026 10:36:08 +0100 Subject: [PATCH] fix(cohere): Response streaming attribute --- sentry_sdk/integrations/cohere.py | 2 +- tests/integrations/cohere/test_cohere.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/cohere.py b/sentry_sdk/integrations/cohere.py index f45a02f2b5..df776ad37b 100644 --- a/sentry_sdk/integrations/cohere.py +++ b/sentry_sdk/integrations/cohere.py @@ -181,7 +181,7 @@ def new_chat(*args: "Any", **kwargs: "Any") -> "Any": for k, v in COLLECTED_CHAT_PARAMS.items(): if k in kwargs: set_data_normalized(span, v, kwargs[k]) - set_data_normalized(span, SPANDATA.AI_STREAMING, False) + span.set_data(SPANDATA.AI_STREAMING, streaming) if streaming: old_iterator = res diff --git a/tests/integrations/cohere/test_cohere.py b/tests/integrations/cohere/test_cohere.py index 9ff56ed697..74da113281 100644 --- a/tests/integrations/cohere/test_cohere.py +++ b/tests/integrations/cohere/test_cohere.py @@ -54,6 +54,7 @@ def test_nonstreaming_chat( assert tx["type"] == "transaction" span = tx["spans"][0] assert span["op"] == "ai.chat_completions.create.cohere" + assert span["data"][SPANDATA.AI_STREAMING] is False assert span["data"][SPANDATA.AI_MODEL_ID] == "some-model" if send_default_pii and include_prompts: @@ -131,6 +132,7 @@ def test_streaming_chat(sentry_init, capture_events, send_default_pii, include_p assert tx["type"] == "transaction" span = tx["spans"][0] assert span["op"] == "ai.chat_completions.create.cohere" + assert span["data"][SPANDATA.AI_STREAMING] is True assert span["data"][SPANDATA.AI_MODEL_ID] == "some-model" if send_default_pii and include_prompts: