diff --git a/changelog.d/fixes/7540-custom-tool-output-images.md b/changelog.d/fixes/7540-custom-tool-output-images.md new file mode 100644 index 0000000000..c22b4970a9 --- /dev/null +++ b/changelog.d/fixes/7540-custom-tool-output-images.md @@ -0,0 +1 @@ +- **fix(sse):** preserve `input_image` parts in array-valued Codex `custom_tool_call_output` payloads instead of rewriting them to invalid `output_text` parts ([#7540](https://github.com/diegosouzapw/OmniRoute/pull/7540)) - thanks @loulanyue diff --git a/tests/unit/responses-input-sanitizer-name.test.ts b/tests/unit/responses-input-sanitizer-name.test.ts index 067e233b59..7ac09604c7 100644 --- a/tests/unit/responses-input-sanitizer-name.test.ts +++ b/tests/unit/responses-input-sanitizer-name.test.ts @@ -194,3 +194,19 @@ test("normalizes function_call_output image output parts to input_image", () => }); assert.equal(JSON.stringify(result).includes('"type":"image_url"'), false); }); + +test("preserves custom_tool_call_output input content parts", () => { + const items = [ + { + type: "custom_tool_call_output", + call_id: "call_2", + output: [ + { type: "input_text", text: "image tool output" }, + { type: "input_image", image_url: "data:image/png;base64,AAAA" }, + ], + }, + ]; + const result = sanitizeResponsesInputItems(items) as Array>; + assert.deepEqual(result[0], items[0]); + assert.equal(JSON.stringify(result).includes('"type":"output_text"'), false); +});