Skip to content

Conversation

@roblourens
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings November 1, 2025 18:09
@roblourens roblourens enabled auto-merge November 1, 2025 18:09
@roblourens roblourens self-assigned this Nov 1, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades the OpenAI SDK dependency from version 5.11.0 to 6.7.0 and adapts the code to handle changes in the Responses API format introduced in the newer version.

Key changes:

  • Upgraded openai package from ^5.11.0 to ^6.7.0
  • Enhanced handling of function_call_output items to support multi-part content (text, images, files) in addition to simple strings
  • Added filtering for unsupported web_search tool types in the language model server

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
package.json Updated openai dependency version from ^5.11.0 to ^6.7.0
package-lock.json Updated openai package lock entries and zod peer dependency requirement
src/platform/endpoint/node/responsesApi.ts Added support for multi-part function call outputs and type guard function
src/extension/externalAgents/node/oaiLanguageModelServer.ts Changed to type-only OpenAI import and added web_search tool filtering with warning logging

Comment on lines +256 to +263
if (isResponseFunctionCallOutputItem(item)) {
const content = responseFunctionOutputToRawContents(item.output);
messages.push({
role: Raw.ChatRole.Tool,
content,
toolCallId: item.call_id
});
}
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

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

The type guard check on line 256 is redundant. Since we're already inside a case 'function_call_output': block (line 254), the item type is already narrowed to have type: 'function_call_output'. The type guard isResponseFunctionCallOutputItem performs the same check again. Consider removing the conditional wrapper and calling responseFunctionOutputToRawContents directly.

Suggested change
if (isResponseFunctionCallOutputItem(item)) {
const content = responseFunctionOutputToRawContents(item.output);
messages.push({
role: Raw.ChatRole.Tool,
content,
toolCallId: item.call_id
});
}
const content = responseFunctionOutputToRawContents(item.output);
messages.push({
role: Raw.ChatRole.Tool,
content,
toolCallId: item.call_id
});

Copilot uses AI. Check for mistakes.
Comment on lines +340 to +361
function responseFunctionOutputItemToRawContent(part: OpenAI.Responses.ResponseFunctionCallOutputItem): Raw.ChatCompletionContentPart | undefined {
if (part.type === 'input_text') {
return { type: Raw.ChatCompletionContentPartKind.Text, text: part.text };
}
if (part.type === 'input_image') {
const detail = part.detail && part.detail !== 'auto' ? part.detail : undefined;
return {
type: Raw.ChatCompletionContentPartKind.Image,
imageUrl: {
url: part.image_url || '',
detail
}
};
}
if (part.type === 'input_file') {
return {
type: Raw.ChatCompletionContentPartKind.Opaque,
value: `[File Output - Filename: ${part.filename || 'unknown'}]`
};
}
return undefined;
}
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

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

This function duplicates logic from responseContentToRawContent (lines 313-329). Both functions handle input_text, input_image, and input_file types identically. Consider extracting the common conversion logic into a shared function or reusing responseContentToRawContent if the types are compatible, to maintain DRY principles and reduce maintenance burden.

Copilot uses AI. Check for mistakes.
@roblourens roblourens added this pull request to the merge queue Nov 1, 2025
Merged via the queue into main with commit 52032e4 Nov 1, 2025
22 checks passed
@roblourens roblourens deleted the roblou/impressive-turtle branch November 1, 2025 19:15
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.

3 participants