-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Filter out unsupported codex tool type #1748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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
openaipackage from^5.11.0to^6.7.0 - Enhanced handling of
function_call_outputitems to support multi-part content (text, images, files) in addition to simple strings - Added filtering for unsupported
web_searchtool 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 |
| if (isResponseFunctionCallOutputItem(item)) { | ||
| const content = responseFunctionOutputToRawContents(item.output); | ||
| messages.push({ | ||
| role: Raw.ChatRole.Tool, | ||
| content, | ||
| toolCallId: item.call_id | ||
| }); | ||
| } |
Copilot
AI
Nov 1, 2025
There was a problem hiding this comment.
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.
| 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 | |
| }); |
| 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; | ||
| } |
Copilot
AI
Nov 1, 2025
There was a problem hiding this comment.
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.
No description provided.