Skip to content

Commit 1afcae5

Browse files
committed
test
1 parent 9a2a0ec commit 1afcae5

File tree

3 files changed

+26
-691
lines changed

3 files changed

+26
-691
lines changed

instrumentation-genai/opentelemetry-instrumentation-cohere-v2/src/opentelemetry/instrumentation/cohere_v2/utils.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,9 @@ def _response_to_event(response: cohere.ChatResponse, capture_content):
181181
}
182182

183183
if response.message:
184-
message = {
185-
"role": (
186-
response.message.role
187-
if response.message.role and response.message.role != "assistant"
188-
else None
189-
)
190-
}
184+
message = {}
185+
if response.message.role and response.message.role != "assistant":
186+
message["role"] = response.message.role
191187
tool_calls = extract_tool_calls(response.message, capture_content)
192188
if tool_calls:
193189
message["tool_calls"] = tool_calls

instrumentation-genai/opentelemetry-instrumentation-cohere-v2/tests/cassettes/test_chat_completion_with_content.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ interactions:
4040
body:
4141
string: |-
4242
{
43-
"id": "06e43724-5286-4eeb-bb10-bad73f976655",
43+
"id": "e7d8e128-c2b6-452b-9274-a52298d4e279",
4444
"message": {
4545
"role": "assistant",
4646
"content": [
@@ -77,7 +77,7 @@ interactions:
7777
content-type:
7878
- application/json
7979
date:
80-
- Mon, 09 Dec 2024 21:08:41 GMT
80+
- Mon, 09 Dec 2024 21:18:26 GMT
8181
expires:
8282
- Thu, 01 Jan 1970 00:00:00 UTC
8383
num_chars:
@@ -93,15 +93,15 @@ interactions:
9393
x-accel-expires:
9494
- '0'
9595
x-debug-trace-id:
96-
- 52412790708b1cfbe79a11850fbc09ec
96+
- afec42690070e90f99584d392dcd1d5d
9797
x-endpoint-monthly-call-limit:
9898
- '1000'
9999
x-envoy-upstream-service-time:
100-
- '173'
100+
- '192'
101101
x-trial-endpoint-call-limit:
102102
- '40'
103103
x-trial-endpoint-call-remaining:
104-
- '37'
104+
- '39'
105105
status:
106106
code: 200
107107
message: OK

0 commit comments

Comments
 (0)