Skip to content

Commit 4048410

Browse files
committed
bump openai support to 1.26.0
1 parent 1dacf8d commit 4048410

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

instrumentation/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414

1515

16-
_instruments = ("openai >= 1.0.0",)
16+
_instruments = ("openai >= 1.26.0",)

instrumentation/opentelemetry-instrumentation-openai-v2/test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
openai==1.0.0
1+
openai==1.26.0
22
pydantic==2.8.2
33
Deprecated==1.2.14
44
importlib-metadata==6.11.0

instrumentation/opentelemetry-instrumentation-openai-v2/tests/test_chat_completions.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ def test_chat_completion(exporter, openai_client):
2020

2121
response = openai_client.chat.completions.create(**kwargs)
2222
spans = exporter.get_finished_spans()
23-
# ignore by default added spans etc: http spans.
24-
# we are only interested in the last span which is the chat completion span
25-
chat_completion_span = spans[-1]
23+
chat_completion_span = spans[0]
2624
# assert that the span name is correct
2725
assert chat_completion_span.name == f"chat {llm_model_value}"
2826

@@ -34,7 +32,6 @@ def test_chat_completion(exporter, openai_client):
3432
response_id = attributes[GenAIAttributes.GEN_AI_RESPONSE_ID]
3533
input_tokens = attributes[GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS]
3634
output_tokens = attributes[GenAIAttributes.GEN_AI_USAGE_OUTPUT_TOKENS]
37-
3835
# assert that the attributes are correct
3936
assert (
4037
operation_name == GenAIAttributes.GenAiOperationNameValues.CHAT.value
@@ -106,9 +103,7 @@ def test_chat_completion_streaming(exporter, openai_client):
106103
response_stream_id = chunk.id
107104

108105
spans = exporter.get_finished_spans()
109-
# ignore by default added spans etc: http spans.
110-
# we are only interested in the last span which is the chat completion span
111-
streaming_span = spans[-1]
106+
streaming_span = spans[0]
112107

113108
assert streaming_span.name == f"chat {llm_model_value}"
114109
attributes = streaming_span.attributes

0 commit comments

Comments
 (0)