Repository navigation
[Bugfix] Responses API assistant EasyInputMessageParam input - #44361
Conversation
Signed-off-by: Yifan Zong <yzong@redhat.com>
|
Small edge case that seems worth covering if this keeps the dict fallback path: assistant EasyInput content can also be a list of input content parts, and the new branch in For example, a valid assistant input shaped like |
Yeah this a known issue. Many places in responses API don't handle content list correctly right now. vllm/vllm/entrypoints/openai/responses/utils.py Lines 285 to 295 in 8a91228 I encountered this when refactoring Responses rendering previously (#42189) This fix copies mirrors the existing behavior but we do need a proper fix for these things. We probly should have a helper to do this. We'll need to decide how to handle refusal and concat text content ( |
bbrowning
left a comment
There was a problem hiding this comment.
The changes look reasonable and well-tested. Pulled locally - pre-commit passes as well as the tests below - both ones changed here and ones adjacent to the changed code.
# unit tests
pytest -v \
tests/entrypoints/openai/responses/test_function_call_parsing.py \
tests/entrypoints/openai/responses/test_harmony_utils.py \
tests/entrypoints/openai/responses/test_protocol.py \
tests/entrypoints/openai/responses/test_response_input_to_harmony.py \
tests/entrypoints/openai/responses/test_responses_utils.py
# integration tests
pytest -v \
tests/entrypoints/openai/responses/test_basic.py \
tests/entrypoints/openai/responses/test_harmony.py
The manual curl example failed for me locally with a Nemotron 3 Super model served via Responses API before this change and success afterwards.
Thanks!
…oject#44361) Signed-off-by: Yifan Zong <yzong@redhat.com> Co-authored-by: Ben Browning <bbrownin@redhat.com>
…oject#44361) Signed-off-by: Yifan Zong <yzong@redhat.com> Co-authored-by: Ben Browning <bbrownin@redhat.com>
…oject#44361) Signed-off-by: Yifan Zong <yzong@redhat.com> Co-authored-by: Ben Browning <bbrownin@redhat.com>
…oject#44361) Signed-off-by: Yifan Zong <yzong@redhat.com> Co-authored-by: Ben Browning <bbrownin@redhat.com>
Purpose
Fix Responses API running into Pydantic errors on assistant
EasyInputMessageParams with string content (anything like{"role": "assistant", "type": "message", "content": "some string"})The error was caused by assistant string content being incorrectly coerced into
ResponseOutputMessage, causing Pydantic to try parsing each character of the string as an output content item.This PR fixes the issue by not coercing
EasyInputMessageParamintoResponseOutputMessage.EasyInputMessageParamis also now handled similarly toResponseOutputMessageinconstruct_chat_messages_with_tool_call.Test Plan
Updated unit test files:
tests/entrypoints/openai/responses/test_function_call_parsing.pytests/entrypoints/openai/responses/test_responses_utils.pyManual e2e validation:
Qwen/Qwen3-8Bopenai/gpt-oss-20bSend request:
Test Result
Unit tests pass.
Non-harmony Results:
Before:
BadRequestError2 validation errors for ValidatorIterator0.ResponseOutputTextParam0.ResponseOutputRefusalParamAfter:
15. QED.30. QED.non_harmony_response.json
non_harmony_response_after.json
Harmony Results:
Before:
BadRequestError2 validation errors for ValidatorIterator0.ResponseOutputTextParam0.ResponseOutputRefusalParamAfter:
input_messagespreserves the assistant turn asrole="assistant",channel="final", content15. QED.30 QED.harmony_response.json
harmony_response_after.json
Made with Cursor
cc @sfeng33 @bbrowning
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.