Skip to content

@ai-sdk/openai file search tool is not supported #7179

@matthewhausman

Description

@matthewhausman

Description

Inspection of the ai sdk open ai package shows that while prepareTool function allows file search tool calling:

switch (tool.id) {
  case 'openai.file_search': {
    const args = fileSearchArgsSchema.parse(tool.args);
    openaiTools.push({
      type: 'file_search',
      vector_store_ids: args.vectorStoreIds,
      max_results: args.maxResults,
      search_type: args.searchType,
    });
    break;
  }
  case 'openai.web_search_preview': {
    const args = webSearchPreviewArgsSchema.parse(tool.args);
    openaiTools.push({
      type: 'web_search_preview',
      search_context_size: args.searchContextSize,
      user_location: args.userLocation,
    });
    break;
  }
  default:
    toolWarnings.push({ type: 'unsupported-tool', tool });
    break;
}

The prepareResponsesTools will treat the file search tool as unsupported

packages/openai/src/responses/openai-responses-prepare-tools.ts:

 case 'provider-defined':
  switch (tool.id) {
    case 'openai.web_search_preview':
      openaiTools.push({
        type: 'web_search_preview',
        search_context_size: tool.args.searchContextSize as
          | 'low'
          | 'medium'
          | 'high',
        user_location: tool.args.userLocation as {
          type: 'approximate';
          city: string;
          region: string;
        },
      });
      break;
    default:
      toolWarnings.push({ type: 'unsupported-tool', tool });
      break;
  }

This is just one example of the lack of support

AI SDK Version

"@ai-sdk/openai": "2.0.0-beta.6"
"@ai-sdk/react": "2.0.0-beta.6"
"ai": "5.0.0-beta.6"

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy