Responses minor fix + UTs#4225
Open
michalkulakowski wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates OVMS’s OpenAI Responses behavior to better match vLLM/OpenAI client expectations around (1) how historical reasoning is replayed in multi-turn conversations and (2) how Responses output[] is serialized when the model emits tool calls without any text. It also expands test coverage for multimodal image parsing and media authorization allowlists.
Changes:
- Add a post-processing step to drop/strip stale
reasoning_contentfrom earlier assistant turns before the last “final answer” assistant turn when building chat/completions-shaped messages from a Responsesinput[]. - Update Responses serialization to omit the
messageoutput item when no text content was produced (tool-calls-only outputs). - Extend unit tests for multimodal images (base64, local filesystem allowlist, domain allowlist) and for Responses
input_image.image_urlaccepted shapes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/llm/apis/openai_responses.cpp |
Adds dropHistoricalReasoning() post-processing to the Responses-input builder sinks; skips emitting empty message output items when no text was generated. |
src/test/http_openai_handler_test.cpp |
Adds extensive parsing/authorization tests for images and multi-turn reasoning-drop behavior; adds Responses-only coverage for input_image.image_url shape variants and negative cases. |
Comment on lines
+548
to
+552
| auto msg = messages[static_cast<size_t>(i)]; | ||
| if (!msg.contains("role") || msg["role"].get_string() != "assistant") | ||
| continue; | ||
| if (!msg.contains("reasoning_content")) | ||
| continue; |
| })"); | ||
| } | ||
|
|
||
| TEST_F(HttpOpenAIHandlerParsingTest, ResponsesDropHistoricalReasoningPreservesReasoningOnAssistantWithToolCalls) { |
89f1d2b to
f93c025
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.
🛠 Summary
JIRA/Issue if applicable.
Describe the changes.
🧪 Checklist
``