vllm.entrypoints.openai.responses.utils ¶
Functions:
-
construct_chat_messages_with_tool_call–Build chat messages from response items.
-
convert_tool_responses_to_completions_format–Convert a flat tool schema:
-
extract_tool_types–Extracts the tool types from the given tools.
-
should_continue_final_message–Determine if the last input message is a partial assistant message
_construct_message_from_response_item(item, prev_msg=None) ¶
Returns a new message or None. If None, prev_msg might be updated. If prev_msg is None, a new message is always returned.
Source code in vllm/entrypoints/openai/responses/utils.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
construct_chat_messages_with_tool_call(input_messages) ¶
Build chat messages from response items.
Some chat messages span multiple response items (e.g., reasoning + tool calls).
Source code in vllm/entrypoints/openai/responses/utils.py
convert_tool_responses_to_completions_format(tool) ¶
Convert a flat tool schema
{"type": "function", "name": "...", "description": "...", "parameters": {...}}
into: {"type": "function", "function": {...}}
Source code in vllm/entrypoints/openai/responses/utils.py
extract_tool_types(tools) ¶
Extracts the tool types from the given tools.
Source code in vllm/entrypoints/openai/responses/utils.py
should_continue_final_message(request_input) ¶
Determine if the last input message is a partial assistant message that should be continued rather than starting a new generation.
This enables partial message completion similar to Anthropic's Messages API, where users can provide an incomplete assistant message and have the model continue from where it left off.
A message is considered partial if: 1. It's a ResponseOutputMessage or ResponseReasoningItem 2. Its status is "in_progress" or "incomplete"
Parameters:
Returns:
-
bool–True if the final message should be continued, False otherwise