Improve Responses API input validation for multi-turn#5
Draft
daniel-salib wants to merge 2 commits into
Draft
Conversation
e7159c8 to
1e2b5bd
Compare
9885dc0 to
d1a187d
Compare
8d32fd5 to
5b53886
Compare
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.
Purpose
Enhance the function_call_parsing validator to handle
common client
serialization variations when echoing previous
responses:
validation
messages
consistently
These changes make the API more robust when clients
send back
previous response items as input in multi-turn
conversations.
Test Plan
Inside codex prompt:
› refactor parse output msgs in vllm/entrypoints/
harmony_utils.py
Test Result
Server side:
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:16:40 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:16:41 [loggers.py:236] Engine 000: Avg prompt throughput: 1560.3 tokens/s, Avg generation throughput: 120.1 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 4.5%, Prefix cache hit rate: 45.2%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:16:51 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 119.1 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 4.9%, Prefix cache hit rate: 45.2%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:17:01 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 117.1 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 5.2%, Prefix cache hit rate: 45.2%
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:17:02 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:17:11 [loggers.py:236] Engine 000: Avg prompt throughput: 1815.9 tokens/s, Avg generation throughput: 112.4 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 5.5%, Prefix cache hit rate: 61.0%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:17:21 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 111.7 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 5.9%, Prefix cache hit rate: 61.0%
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:17:24 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:17:31 [loggers.py:236] Engine 000: Avg prompt throughput: 2071.5 tokens/s, Avg generation throughput: 107.7 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 6.2%, Prefix cache hit rate: 69.2%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:17:41 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 109.1 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 6.5%, Prefix cache hit rate: 69.2%
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:17:48 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:17:51 [loggers.py:236] Engine 000: Avg prompt throughput: 2329.3 tokens/s, Avg generation throughput: 105.1 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 6.8%, Prefix cache hit rate: 74.3%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:18:01 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 104.6 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 7.1%, Prefix cache hit rate: 74.3%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:18:11 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 103.2 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 7.4%, Prefix cache hit rate: 74.3%
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:18:13 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:18:21 [loggers.py:236] Engine 000: Avg prompt throughput: 2586.4 tokens/s, Avg generation throughput: 98.3 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 7.7%, Prefix cache hit rate: 77.8%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:18:31 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 100.0 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 7.9%, Prefix cache hit rate: 77.8%
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:18:39 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:18:41 [loggers.py:236] Engine 000: Avg prompt throughput: 2842.3 tokens/s, Avg generation throughput: 96.1 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 8.2%, Prefix cache hit rate: 80.4%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:18:51 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 97.4 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 8.5%, Prefix cache hit rate: 80.4%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:19:01 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 96.0 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 8.8%, Prefix cache hit rate: 80.4%
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:19:06 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:19:11 [loggers.py:236] Engine 000: Avg prompt throughput: 3100.8 tokens/s, Avg generation throughput: 92.5 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 9.0%, Prefix cache hit rate: 82.3%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:19:21 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 93.3 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 9.3%, Prefix cache hit rate: 82.3%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:19:31 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 92.6 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 9.6%, Prefix cache hit rate: 82.3%
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:19:34 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:19:41 [loggers.py:236] Engine 000: Avg prompt throughput: 3357.9 tokens/s, Avg generation throughput: 89.0 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 9.8%, Prefix cache hit rate: 83.9%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:19:51 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 89.5 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 10.1%, Prefix cache hit rate: 83.9%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:20:01 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 88.5 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 10.3%, Prefix cache hit rate: 83.9%
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:20:03 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:20:11 [loggers.py:236] Engine 000: Avg prompt throughput: 3621.6 tokens/s, Avg generation throughput: 85.4 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 10.6%, Prefix cache hit rate: 85.2%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:20:21 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 85.8 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 10.8%, Prefix cache hit rate: 85.2%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:20:31 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 85.4 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 11.1%, Prefix cache hit rate: 85.2%
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:20:34 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:20:35 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:20:41 [loggers.py:236] Engine 000: Avg prompt throughput: 7771.6 tokens/s, Avg generation throughput: 81.9 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 11.3%, Prefix cache hit rate: 87.9%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:20:51 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 84.0 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 11.6%, Prefix cache hit rate: 87.9%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:21:01 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 83.0 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 11.8%, Prefix cache hit rate: 87.9%
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:21:05 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:21:11 [loggers.py:236] Engine 000: Avg prompt throughput: 4147.6 tokens/s, Avg generation throughput: 80.1 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 12.0%, Prefix cache hit rate: 88.6%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:21:21 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 81.5 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 12.3%, Prefix cache hit rate: 88.6%
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:21:31 [loggers.py:236] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 70.7 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 12.5%, Prefix cache hit rate: 88.6%
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:21:40 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO 11-17 14:21:41 [loggers.py:236] Engine 000: Avg prompt throughput: 4421.2 tokens/s, Avg generation throughput: 76.6 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 12.7%, Prefix cache hit rate: 89.2%
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:21:42 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
^[[1;36m(APIServer pid=3168319)^[[0;0m WARNING 11-17 14:21:44 [protocol.py:126] The following fields were present in the request but ignored: {'prompt_cache_key'}
^[[1;36m(APIServer pid=3168319)^[[0;0m INFO: 127.0.0.1:65258 - "POST /v1/responses HTTP/1.1" 200 OK
Client side:
Implemented a comprehensive refactor of
parse_output_message in vllm/entrypoints/harmony_utils.py:
Streamlined assistant role handling and early for
non‑assistant messages.
analysis, commentary, and final channels.
placeholder fallback.
comments.
or recipients.