[Evaluation] Fix OpenAI 2.54 test proxy compatibility - #48862
[Evaluation] Fix OpenAI 2.54 test proxy compatibility#48862Sydney Lister (slister1001) wants to merge 2 commits into
Conversation
Build proxy URLs with the request's concrete URL type, ignore transport-specific Accept-Encoding values in recordings, and remove the temporary OpenAI test pin now that both httpx generations are supported. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Patch the evaluation test-proxy wrapper directly so user-agent assertions observe requests from both httpx and httpx2 OpenAI clients. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Follow-up after public CI build 6780194: the standard matrix resolved OpenAI 3.3.1 + httpx2 and exposed seven user-agent assertions that mocked |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟢 Approval recommended
The compatibility fix is covered by regression tests, with no unresolved issues.
Pull request overview
Updates evaluation test infrastructure for compatibility with OpenAI clients using httpx2, without changing runtime APIs.
Changes:
- Preserves each request’s URL implementation during proxy routing.
- Excludes
Accept-Encodingfrom recording matching. - Removes the OpenAI version cap and adds regression coverage.
File summaries
| File | Description |
|---|---|
sdk/evaluation/azure-ai-evaluation/tests/unittests/test_openai_patcher.py |
Tests httpx and httpx2 routing. |
sdk/evaluation/azure-ai-evaluation/tests/e2etests/test_evaluate.py |
Mocks the proxy-aware async client. |
sdk/evaluation/azure-ai-evaluation/tests/e2etests/test_builtin_evaluators.py |
Updates evaluator user-agent mocking. |
sdk/evaluation/azure-ai-evaluation/tests/conftest.py |
Excludes Accept-Encoding from recording matching. |
sdk/evaluation/azure-ai-evaluation/tests/__openai_patcher.py |
Supports proxy routing for both URL implementations. |
sdk/evaluation/azure-ai-evaluation/dev_requirements.txt |
Removes the temporary OpenAI version cap. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
kdestin Ankit Singhal (@singankit) This test-only fix is now the release blocker for azure-ai-evaluation 1.18.5. PR CI build 6780484 is fully green (19/19 checks), and the exact 30 failures from release build 6779696 pass locally under OpenAI 2.54.0; the seven additional OpenAI 3.3.1/httpx2 CI assertions also pass across 2.43/2.54/3.3. Could one of you review and merge #48862 so we can rerun the release pipeline? |
| from tests.__openai_patcher import TestProxyAsyncHttpxClient | ||
|
|
||
| with self._transparent_mock_method(AsyncClient, "send") as mock: # OpenAI requests sent with httpx | ||
| with self._transparent_mock_method(TestProxyAsyncHttpxClient, "send") as mock: |
There was a problem hiding this comment.
Not a blocking comment.
When originally written, __openai_patcher would for openai to instantiate TestProxyAsyncHttpxClient automatically as an import side effect.
Did the migration to httpx2 break this behavior?
| from tests.__openai_patcher import TestProxyAsyncHttpxClient | ||
|
|
||
| with self._transparent_mock_method(AsyncClient, "send") as mock: | ||
| with self._transparent_mock_method(TestProxyAsyncHttpxClient, "send") as mock: |
There was a problem hiding this comment.
unclear what the value add is here, adding test code for test code.
Summary
Fix the
azure-ai-evaluationtest-proxy adapter for OpenAI clients that sendhttpx2request objects. This unblocks thelatestdependencyrelease check after OpenAI 2.54.0 began exercising the newer transport.Root cause
tests/__openai_patcher.pyalways constructed proxy URLs withhttpx.URL. OpenAI 2.54.0 can pass anhttpx2.URL, and joining URL instances from different implementations raises:After routing succeeds, the newer transport also advertises
zstdinAccept-Encoding; that transport-only header should not participate in recording matching.Changes
Accept-Encodingfrom test-proxy recording matchingopenai<3.0test pinhttpxandhttpx2URL routingValidation
git diff --check: passedThis is test infrastructure only and does not change the published package runtime API.