[ResponseAPI] Further polish message serialization and unit tests#26728
[ResponseAPI] Further polish message serialization and unit tests#26728yeqcharlotte merged 1 commit intovllm-project:mainfrom
Conversation
Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com>
There was a problem hiding this comment.
Code Review
This pull request refactors the unit tests for message serialization and improves the serialization logic. The movement of tests into a dedicated file test_protocol.py is a good change for code organization. The update in serialize_message to check for hasattr(msg, "to_dict") is more explicit and robust than checking for __dict__.
However, I've found a critical issue in the serialize_message function where it can return inconsistent types (a dict or a str), which will lead to incorrect JSON serialization for certain messages. I've left a detailed comment with a recommended fix. Addressing this is crucial for the correctness of the Response API.
yeqcharlotte
left a comment
There was a problem hiding this comment.
thanks for the change!
…lm-project#26728) Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com> Signed-off-by: 1994 <1994@users.noreply.github.com>
…lm-project#26728) Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com> Signed-off-by: Dhruvil Bhatt <bhattdbh@amazon.com>
…lm-project#26728) Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com> Signed-off-by: bbartels <benjamin@bartels.dev>
…lm-project#26728) Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com>
…lm-project#26728) Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com>
…lm-project#26728) Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com> Signed-off-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>
…lm-project#26728) Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com> Signed-off-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>
…lm-project#26728) Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com>
…lm-project#26728) Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com>
Purpose
Address leftover comments in #26620
Test Plan & Test Result
With the change, unit tests are still finished successfully
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.