|
7 | 7 | from httpx import Client as HTTPXClient |
8 | 8 |
|
9 | 9 | import sentry_sdk |
10 | | -from sentry_sdk.consts import SPANDATA |
| 10 | +from sentry_sdk.consts import OP, SPANDATA |
11 | 11 | from sentry_sdk.integrations.cohere import CohereIntegration |
12 | 12 |
|
13 | 13 |
|
@@ -55,7 +55,7 @@ def test_nonstreaming_chat( |
55 | 55 | assert len(items) == 1 |
56 | 56 | span = items[0].payload |
57 | 57 |
|
58 | | - assert span["attributes"]["sentry.op"] == "ai.chat_completions.create.cohere" |
| 58 | + assert span["attributes"]["sentry.op"] == OP.GEN_AI_CHAT |
59 | 59 | assert span["attributes"][SPANDATA.AI_MODEL_ID] == "some-model" |
60 | 60 |
|
61 | 61 | assert ( |
@@ -117,7 +117,7 @@ def test_nonstreaming_chat_no_sensitive_data( |
117 | 117 | assert len(items) == 1 |
118 | 118 | span = items[0].payload |
119 | 119 |
|
120 | | - assert span["attributes"]["sentry.op"] == "ai.chat_completions.create.cohere" |
| 120 | + assert span["attributes"]["sentry.op"] == OP.GEN_AI_CHAT |
121 | 121 | assert span["attributes"][SPANDATA.AI_MODEL_ID] == "some-model" |
122 | 122 |
|
123 | 123 | assert SPANDATA.AI_INPUT_MESSAGES not in span["attributes"] |
@@ -187,7 +187,7 @@ def test_streaming_chat( |
187 | 187 | assert len(items) == 1 |
188 | 188 | span = items[0].payload |
189 | 189 |
|
190 | | - assert span["attributes"]["sentry.op"] == "ai.chat_completions.create.cohere" |
| 190 | + assert span["attributes"]["sentry.op"] == OP.GEN_AI_CHAT |
191 | 191 | assert span["attributes"][SPANDATA.AI_MODEL_ID] == "some-model" |
192 | 192 |
|
193 | 193 | assert ( |
@@ -264,7 +264,7 @@ def test_streaming_chat_no_sensitive_data( |
264 | 264 | assert len(items) == 1 |
265 | 265 | span = items[0].payload |
266 | 266 |
|
267 | | - assert span["attributes"]["sentry.op"] == "ai.chat_completions.create.cohere" |
| 267 | + assert span["attributes"]["sentry.op"] == OP.GEN_AI_CHAT |
268 | 268 | assert span["attributes"][SPANDATA.AI_MODEL_ID] == "some-model" |
269 | 269 |
|
270 | 270 | assert SPANDATA.AI_INPUT_MESSAGES not in span["attributes"] |
@@ -317,7 +317,7 @@ def test_embed( |
317 | 317 | assert len(items) == 1 |
318 | 318 | span = items[0].payload |
319 | 319 |
|
320 | | - assert span["attributes"]["sentry.op"] == "ai.embeddings.create.cohere" |
| 320 | + assert span["attributes"]["sentry.op"] == OP.GEN_AI_EMBEDDINGS |
321 | 321 | assert "hello" in span["attributes"][SPANDATA.AI_INPUT_MESSAGES] |
322 | 322 |
|
323 | 323 | assert span["attributes"]["gen_ai.usage.input_tokens"] == 10 |
@@ -366,7 +366,7 @@ def test_embed_no_sensitive_data( |
366 | 366 | assert len(items) == 1 |
367 | 367 | span = items[0].payload |
368 | 368 |
|
369 | | - assert span["attributes"]["sentry.op"] == "ai.embeddings.create.cohere" |
| 369 | + assert span["attributes"]["sentry.op"] == OP.GEN_AI_EMBEDDINGS |
370 | 370 | assert SPANDATA.AI_INPUT_MESSAGES not in span["attributes"] |
371 | 371 |
|
372 | 372 | assert span["attributes"]["gen_ai.usage.input_tokens"] == 10 |
|
0 commit comments