Skip to content

Commit a8c276f

Browse files
Nik-Reddynikhilpallepati
authored andcommitted
skip structured output tests on openai < 1.40.0
1 parent 0c0e63a commit a8c276f

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_async_structured_outputs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"""Tests for async OpenAI structured outputs (chat.completions.parse) instrumentation."""
1616

1717
import pytest
18+
from openai.resources.chat.completions import Completions
1819

1920
from opentelemetry.semconv._incubating.attributes import (
2021
gen_ai_attributes as GenAIAttributes,
@@ -34,6 +35,11 @@
3435
format_simple_expected_output_message,
3536
)
3637

38+
pytestmark = pytest.mark.skipif(
39+
not hasattr(Completions, "parse"),
40+
reason="parse() requires openai >= 1.40.0",
41+
)
42+
3743

3844
@pytest.mark.asyncio()
3945
async def test_async_structured_output_with_content(

instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_structured_outputs.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
"""Tests for OpenAI structured outputs (chat.completions.parse) instrumentation."""
1616

17+
import pytest
18+
from openai.resources.chat.completions import Completions
19+
1720
from opentelemetry.semconv._incubating.attributes import (
1821
gen_ai_attributes as GenAIAttributes,
1922
)
@@ -32,6 +35,11 @@
3235
format_simple_expected_output_message,
3336
)
3437

38+
pytestmark = pytest.mark.skipif(
39+
not hasattr(Completions, "parse"),
40+
reason="parse() requires openai >= 1.40.0",
41+
)
42+
3543

3644
def test_structured_output_with_content(
3745
span_exporter, log_exporter, openai_client, instrument_with_content, vcr

0 commit comments

Comments
 (0)