Skip to content

Fix responses funtion call output - #4431

Open
michalkulakowski wants to merge 1 commit into
mainfrom
mkulakow/responses_fix_3
Open

Fix responses funtion call output#4431
michalkulakowski wants to merge 1 commit into
mainfrom
mkulakow/responses_fix_3

Conversation

@michalkulakowski

Copy link
Copy Markdown
Collaborator

🛠 Summary

JIRA/Issue if applicable.
Describe the changes.

🧪 Checklist

  • Unit tests added.
  • The documentation updated.
  • Change follows security best practices.
    ``

Copilot AI lite review requested due to automatic review settings August 5, 2026 14:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new parsing/normalization behavior (array output + missing/invalid output handling) should be covered by unit tests to prevent regressions in Responses-to-chat translation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Adds normalization for OpenAI Responses API function_call_output.output so tool outputs can be consumed reliably when the output is delivered as either a string or an array of typed content items, improving compatibility with Responses payload variants.

Changes:

  • Introduces normalizeFunctionCallOutput() to convert function_call_output.output into a single string (extracting input_text/output_text when present, otherwise JSON-stringifying the array).
  • Updates ResponsesInputBuilder::onFunctionCallOutputItem() to require an output field and to use the new normalization path before emitting tool messages.
File summaries
File Description
src/llm/apis/openai_responses.cpp Normalizes function_call_output.output (string/array) into a tool message content string and adds stricter validation for missing output.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment on lines +170 to +176
static absl::StatusOr<std::string> normalizeFunctionCallOutput(const rapidjson::Value& outputValue) {
if (outputValue.IsString()) {
return std::string(outputValue.GetString());
}
if (!outputValue.IsArray()) {
return absl::InvalidArgumentError("function_call_output.output must be a string or array");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants