[Bugfix] Fix test_invocations flaky failure with newer openai SDK (#44618)

Signed-off-by: Xu Zhou <xuzhou9417@163.com>
Co-authored-by: Xu Zhou <xuzhou9417@163.com>
This commit is contained in:
XuZhou
2026-06-05 07:36:20 +00:00
committed by GitHub
co-authored by Xu Zhou
parent ca73293fa6
commit 6542d48964
@@ -808,14 +808,20 @@ async def test_invocations(server: RemoteOpenAIServer, client: openai.AsyncOpenA
"logprobs": False,
}
chat_completion = await client.chat.completions.create(**request_args)
# Use raw HTTP for both endpoints so we compare server responses
# directly, without the openai SDK injecting extra fields
# (e.g. `moderation` added in newer SDK versions).
chat_response = requests.post(
server.url_for("v1/chat/completions"), json=request_args
)
chat_response.raise_for_status()
invocation_response = requests.post(
server.url_for("invocations"), json=request_args
)
invocation_response.raise_for_status()
chat_output = chat_completion.model_dump()
chat_output = chat_response.json()
invocation_output = invocation_response.json()
assert chat_output.keys() == invocation_output.keys()