feat(openai): extend version range to support openai v3 - #393
Merged
Conversation
Closed
Copilot
AI
changed the title
[WIP] Extend version range to support OpenAI v3
feat(openai): extend version range to support openai v3
Aug 15, 2026
lmolkova
reviewed
Aug 15, 2026
lmolkova
reviewed
Aug 15, 2026
Contributor
Author
Member
Contributor
Author
Added to this PR. |
lmolkova
approved these changes
Aug 15, 2026
Pull request dashboard statusMerged · refreshed 2026-08-19 23:18 UTC Status above doesn't look right?
|
lmolkova
force-pushed
the
copilot/support-openai-v3
branch
2 times, most recently
from
August 19, 2026 13:04
2cbd6bd to
818ec19
Compare
lmolkova
force-pushed
the
copilot/support-openai-v3
branch
from
August 19, 2026 13:05
818ec19 to
97b128e
Compare
Extend the supported version range for the openai library to include v3. openai v3 switched from httpx to httpx2 as its HTTP client library. Update the instrumentation to import URL and the HTTP response type from httpx with a fallback to httpx2, so both v1/v2 and v3 are supported. The httpx interop test is skipped when httpx is not installed (openai v3), since that test specifically exercises opentelemetry-instrumentation-httpx which only applies to the httpx transport used by openai v1/v2. Assisted-by: Claude Sonnet 4.6
…test
Instead of a dedicated pytest.importorskip("httpx"), move import httpx after
the existing pytest.importorskip("opentelemetry.instrumentation.httpx"). Since
the httpx instrumentation depends on httpx, the existing importorskip already
handles graceful skipping when httpx is absent (e.g. openai v3+).
Assisted-by: Claude Sonnet 4.6
…nai v3 Use getattr-based host/port extraction instead of isinstance(URL) so server.address and server.port are recorded with any URL implementation (httpx.URL, httpx2.URL, or future types). This also removes the now-unused httpx/httpx2 URL import from utils.py. Adds a regression test verifying server.address is populated for a non-httpx URL (simulating httpx2.URL via SimpleNamespace). Fixes: server.address/server.port silently absent on openai v3+. Assisted-by: Claude Sonnet 4.6
Assisted-by: Claude Sonnet 4.6
Adds a requirements.latest2.txt pinned to openai 2.54.0 + httpx 0.28.1 and a corresponding tox factor so the httpx interop tests continue to run under CI alongside the openai v3 (httpx2) latest factor.
lmolkova
force-pushed
the
copilot/support-openai-v3
branch
from
August 19, 2026 13:27
97b128e to
4e07915
Compare
lmolkova
enabled auto-merge
August 19, 2026 13:30
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Aug 19, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Aug 19, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Aug 19, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
openai v3 ships
httpx2instead ofhttpxas its HTTP transport. The instrumentation hard-importedhttpxdirectly, which broke on import with openai v3 installed.Changes
pyproject.toml— Extendinstrumentsextra upper bound:openai >= 1.26.0, < 4utils.py/_raw_response.py— Conditional import: tryhttpx, fall back tohttpx2tests/requirements.latest.txt— Pinopenai==3.1.0, replacehttpx==0.28.1→httpx2==2.7.0, dropopentelemetry-instrumentation-httpx(irrelevant for v3)test_raw_response_httpx_interop.py— Replace bareimport httpxwithpytest.importorskip("httpx")so the module auto-skips under v3 (the httpx instrumentation interop test only applies when openai uses httpx)test_embedding_invocation_unit.py— Same conditionalURLimport as production codeType of change
How has this been tested?
Full test suite run against openai 3.1.0: 249 passed, 1 skipped (httpx interop module, expected).
Checklist