Skip to content

Commit

Permalink
bump openai support to 1.26.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alizenhom committed Oct 21, 2024
1 parent 1dacf8d commit 4048410
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.


_instruments = ("openai >= 1.0.0",)
_instruments = ("openai >= 1.26.0",)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
openai==1.0.0
openai==1.26.0
pydantic==2.8.2
Deprecated==1.2.14
importlib-metadata==6.11.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ def test_chat_completion(exporter, openai_client):

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

Expand All @@ -34,7 +32,6 @@ def test_chat_completion(exporter, openai_client):
response_id = attributes[GenAIAttributes.GEN_AI_RESPONSE_ID]
input_tokens = attributes[GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS]
output_tokens = attributes[GenAIAttributes.GEN_AI_USAGE_OUTPUT_TOKENS]

# assert that the attributes are correct
assert (
operation_name == GenAIAttributes.GenAiOperationNameValues.CHAT.value
Expand Down Expand Up @@ -106,9 +103,7 @@ def test_chat_completion_streaming(exporter, openai_client):
response_stream_id = chunk.id

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

assert streaming_span.name == f"chat {llm_model_value}"
attributes = streaming_span.attributes
Expand Down

0 comments on commit 4048410

Please sign in to comment.