@ai-sdk/openai 2.0.115 → 2.0.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -500,6 +500,195 @@ declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_
500
500
  result: string;
501
501
  }>;
502
502
 
503
+ declare const webSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{
504
+ externalWebAccess?: boolean | undefined;
505
+ filters?: {
506
+ allowedDomains?: string[] | undefined;
507
+ blockedDomains?: string[] | undefined;
508
+ } | undefined;
509
+ searchContextSize?: "low" | "medium" | "high" | undefined;
510
+ userLocation?: {
511
+ type: "approximate";
512
+ country?: string | undefined;
513
+ city?: string | undefined;
514
+ region?: string | undefined;
515
+ timezone?: string | undefined;
516
+ } | undefined;
517
+ }>;
518
+ declare const webSearchOutputSchema: _ai_sdk_provider_utils.LazySchema<{
519
+ action?: {
520
+ type: "search";
521
+ query?: string | undefined;
522
+ } | {
523
+ type: "openPage";
524
+ url?: string | null | undefined;
525
+ } | {
526
+ type: "findInPage";
527
+ url?: string | null | undefined;
528
+ pattern?: string | null | undefined;
529
+ } | undefined;
530
+ sources?: ({
531
+ type: "url";
532
+ url: string;
533
+ } | {
534
+ type: "api";
535
+ name: string;
536
+ })[] | undefined;
537
+ }>;
538
+ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
539
+ /**
540
+ * An object describing the specific action taken in this web search call.
541
+ * Includes details on how the model used the web (search, open_page, findInPage).
542
+ */
543
+ action?: {
544
+ /**
545
+ * Action type "search" - Performs a web search query.
546
+ */
547
+ type: "search";
548
+ /**
549
+ * The search query.
550
+ */
551
+ query?: string;
552
+ } | {
553
+ /**
554
+ * Action type "openPage" - Opens a specific URL from search results.
555
+ */
556
+ type: "openPage";
557
+ /**
558
+ * The URL opened by the model.
559
+ */
560
+ url?: string | null;
561
+ } | {
562
+ /**
563
+ * Action type "findInPage": Searches for a pattern within a loaded page.
564
+ */
565
+ type: "findInPage";
566
+ /**
567
+ * The URL of the page searched for the pattern.
568
+ */
569
+ url?: string | null;
570
+ /**
571
+ * The pattern or text to search for within the page.
572
+ */
573
+ pattern?: string | null;
574
+ };
575
+ /**
576
+ * Optional sources cited by the model for the web search call.
577
+ */
578
+ sources?: Array<{
579
+ type: "url";
580
+ url: string;
581
+ } | {
582
+ type: "api";
583
+ name: string;
584
+ }>;
585
+ }, {
586
+ /**
587
+ * Whether to use external web access for fetching live content.
588
+ * - true: Fetch live web content (default)
589
+ * - false: Use cached/indexed results
590
+ */
591
+ externalWebAccess?: boolean;
592
+ /**
593
+ * Filters for the search.
594
+ */
595
+ filters?: {
596
+ /**
597
+ * Allowed domains for the search.
598
+ * If not provided, all domains are allowed.
599
+ * Subdomains of the provided domains are allowed as well.
600
+ * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
601
+ */
602
+ allowedDomains?: string[];
603
+ /**
604
+ * Blocked domains for the search.
605
+ * Subdomains of the provided domains are blocked as well.
606
+ * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
607
+ */
608
+ blockedDomains?: string[];
609
+ };
610
+ /**
611
+ * Search context size to use for the web search.
612
+ * - high: Most comprehensive context, highest cost, slower response
613
+ * - medium: Balanced context, cost, and latency (default)
614
+ * - low: Least context, lowest cost, fastest response
615
+ */
616
+ searchContextSize?: "low" | "medium" | "high";
617
+ /**
618
+ * User location information to provide geographically relevant search results.
619
+ */
620
+ userLocation?: {
621
+ /**
622
+ * Type of location (always 'approximate')
623
+ */
624
+ type: "approximate";
625
+ /**
626
+ * Two-letter ISO country code (e.g., 'US', 'GB')
627
+ */
628
+ country?: string;
629
+ /**
630
+ * City name (free text, e.g., 'Minneapolis')
631
+ */
632
+ city?: string;
633
+ /**
634
+ * Region name (free text, e.g., 'Minnesota')
635
+ */
636
+ region?: string;
637
+ /**
638
+ * IANA timezone (e.g., 'America/Chicago')
639
+ */
640
+ timezone?: string;
641
+ };
642
+ }>;
643
+ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
644
+ /**
645
+ * An object describing the specific action taken in this web search call.
646
+ * Includes details on how the model used the web (search, open_page, findInPage).
647
+ */
648
+ action?: {
649
+ /**
650
+ * Action type "search" - Performs a web search query.
651
+ */
652
+ type: "search";
653
+ /**
654
+ * The search query.
655
+ */
656
+ query?: string;
657
+ } | {
658
+ /**
659
+ * Action type "openPage" - Opens a specific URL from search results.
660
+ */
661
+ type: "openPage";
662
+ /**
663
+ * The URL opened by the model.
664
+ */
665
+ url?: string | null;
666
+ } | {
667
+ /**
668
+ * Action type "findInPage": Searches for a pattern within a loaded page.
669
+ */
670
+ type: "findInPage";
671
+ /**
672
+ * The URL of the page searched for the pattern.
673
+ */
674
+ url?: string | null;
675
+ /**
676
+ * The pattern or text to search for within the page.
677
+ */
678
+ pattern?: string | null;
679
+ };
680
+ /**
681
+ * Optional sources cited by the model for the web search call.
682
+ */
683
+ sources?: Array<{
684
+ type: "url";
685
+ url: string;
686
+ } | {
687
+ type: "api";
688
+ name: string;
689
+ }>;
690
+ }>;
691
+
503
692
  declare const webSearchPreviewArgsSchema: _ai_sdk_provider_utils.LazySchema<{
504
693
  searchContextSize?: "low" | "medium" | "high" | undefined;
505
694
  userLocation?: {
@@ -583,4 +772,4 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactor
583
772
  };
584
773
  }>;
585
774
 
586
- export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, OpenAIResponsesLanguageModel, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiSpeechProviderOptionsSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema };
775
+ export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, OpenAIResponsesLanguageModel, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiSpeechProviderOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
@@ -500,6 +500,195 @@ declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_
500
500
  result: string;
501
501
  }>;
502
502
 
503
+ declare const webSearchArgsSchema: _ai_sdk_provider_utils.LazySchema<{
504
+ externalWebAccess?: boolean | undefined;
505
+ filters?: {
506
+ allowedDomains?: string[] | undefined;
507
+ blockedDomains?: string[] | undefined;
508
+ } | undefined;
509
+ searchContextSize?: "low" | "medium" | "high" | undefined;
510
+ userLocation?: {
511
+ type: "approximate";
512
+ country?: string | undefined;
513
+ city?: string | undefined;
514
+ region?: string | undefined;
515
+ timezone?: string | undefined;
516
+ } | undefined;
517
+ }>;
518
+ declare const webSearchOutputSchema: _ai_sdk_provider_utils.LazySchema<{
519
+ action?: {
520
+ type: "search";
521
+ query?: string | undefined;
522
+ } | {
523
+ type: "openPage";
524
+ url?: string | null | undefined;
525
+ } | {
526
+ type: "findInPage";
527
+ url?: string | null | undefined;
528
+ pattern?: string | null | undefined;
529
+ } | undefined;
530
+ sources?: ({
531
+ type: "url";
532
+ url: string;
533
+ } | {
534
+ type: "api";
535
+ name: string;
536
+ })[] | undefined;
537
+ }>;
538
+ declare const webSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
539
+ /**
540
+ * An object describing the specific action taken in this web search call.
541
+ * Includes details on how the model used the web (search, open_page, findInPage).
542
+ */
543
+ action?: {
544
+ /**
545
+ * Action type "search" - Performs a web search query.
546
+ */
547
+ type: "search";
548
+ /**
549
+ * The search query.
550
+ */
551
+ query?: string;
552
+ } | {
553
+ /**
554
+ * Action type "openPage" - Opens a specific URL from search results.
555
+ */
556
+ type: "openPage";
557
+ /**
558
+ * The URL opened by the model.
559
+ */
560
+ url?: string | null;
561
+ } | {
562
+ /**
563
+ * Action type "findInPage": Searches for a pattern within a loaded page.
564
+ */
565
+ type: "findInPage";
566
+ /**
567
+ * The URL of the page searched for the pattern.
568
+ */
569
+ url?: string | null;
570
+ /**
571
+ * The pattern or text to search for within the page.
572
+ */
573
+ pattern?: string | null;
574
+ };
575
+ /**
576
+ * Optional sources cited by the model for the web search call.
577
+ */
578
+ sources?: Array<{
579
+ type: "url";
580
+ url: string;
581
+ } | {
582
+ type: "api";
583
+ name: string;
584
+ }>;
585
+ }, {
586
+ /**
587
+ * Whether to use external web access for fetching live content.
588
+ * - true: Fetch live web content (default)
589
+ * - false: Use cached/indexed results
590
+ */
591
+ externalWebAccess?: boolean;
592
+ /**
593
+ * Filters for the search.
594
+ */
595
+ filters?: {
596
+ /**
597
+ * Allowed domains for the search.
598
+ * If not provided, all domains are allowed.
599
+ * Subdomains of the provided domains are allowed as well.
600
+ * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
601
+ */
602
+ allowedDomains?: string[];
603
+ /**
604
+ * Blocked domains for the search.
605
+ * Subdomains of the provided domains are blocked as well.
606
+ * Omit the HTTP or HTTPS prefix. Maximum 100 domains.
607
+ */
608
+ blockedDomains?: string[];
609
+ };
610
+ /**
611
+ * Search context size to use for the web search.
612
+ * - high: Most comprehensive context, highest cost, slower response
613
+ * - medium: Balanced context, cost, and latency (default)
614
+ * - low: Least context, lowest cost, fastest response
615
+ */
616
+ searchContextSize?: "low" | "medium" | "high";
617
+ /**
618
+ * User location information to provide geographically relevant search results.
619
+ */
620
+ userLocation?: {
621
+ /**
622
+ * Type of location (always 'approximate')
623
+ */
624
+ type: "approximate";
625
+ /**
626
+ * Two-letter ISO country code (e.g., 'US', 'GB')
627
+ */
628
+ country?: string;
629
+ /**
630
+ * City name (free text, e.g., 'Minneapolis')
631
+ */
632
+ city?: string;
633
+ /**
634
+ * Region name (free text, e.g., 'Minnesota')
635
+ */
636
+ region?: string;
637
+ /**
638
+ * IANA timezone (e.g., 'America/Chicago')
639
+ */
640
+ timezone?: string;
641
+ };
642
+ }>;
643
+ declare const webSearch: (args?: Parameters<typeof webSearchToolFactory>[0]) => _ai_sdk_provider_utils.Tool<{}, {
644
+ /**
645
+ * An object describing the specific action taken in this web search call.
646
+ * Includes details on how the model used the web (search, open_page, findInPage).
647
+ */
648
+ action?: {
649
+ /**
650
+ * Action type "search" - Performs a web search query.
651
+ */
652
+ type: "search";
653
+ /**
654
+ * The search query.
655
+ */
656
+ query?: string;
657
+ } | {
658
+ /**
659
+ * Action type "openPage" - Opens a specific URL from search results.
660
+ */
661
+ type: "openPage";
662
+ /**
663
+ * The URL opened by the model.
664
+ */
665
+ url?: string | null;
666
+ } | {
667
+ /**
668
+ * Action type "findInPage": Searches for a pattern within a loaded page.
669
+ */
670
+ type: "findInPage";
671
+ /**
672
+ * The URL of the page searched for the pattern.
673
+ */
674
+ url?: string | null;
675
+ /**
676
+ * The pattern or text to search for within the page.
677
+ */
678
+ pattern?: string | null;
679
+ };
680
+ /**
681
+ * Optional sources cited by the model for the web search call.
682
+ */
683
+ sources?: Array<{
684
+ type: "url";
685
+ url: string;
686
+ } | {
687
+ type: "api";
688
+ name: string;
689
+ }>;
690
+ }>;
691
+
503
692
  declare const webSearchPreviewArgsSchema: _ai_sdk_provider_utils.LazySchema<{
504
693
  searchContextSize?: "low" | "medium" | "high" | undefined;
505
694
  userLocation?: {
@@ -583,4 +772,4 @@ declare const webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactor
583
772
  };
584
773
  }>;
585
774
 
586
- export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, OpenAIResponsesLanguageModel, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiSpeechProviderOptionsSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema };
775
+ export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelGenerationOptions, type OpenAIImageModelId, type OpenAIImageModelOptions, OpenAIResponsesLanguageModel, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, getMaxImagesPerCall, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions, openaiImageModelGenerationOptions, openaiImageModelOptions, openaiSpeechProviderOptionsSchema, webSearch, webSearchArgsSchema, webSearchOutputSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema, webSearchToolFactory };
@@ -48,9 +48,13 @@ __export(index_exports, {
48
48
  openaiImageModelGenerationOptions: () => openaiImageModelGenerationOptions,
49
49
  openaiImageModelOptions: () => openaiImageModelOptions,
50
50
  openaiSpeechProviderOptionsSchema: () => openaiSpeechProviderOptionsSchema,
51
+ webSearch: () => webSearch,
52
+ webSearchArgsSchema: () => webSearchArgsSchema,
53
+ webSearchOutputSchema: () => webSearchOutputSchema,
51
54
  webSearchPreview: () => webSearchPreview,
52
55
  webSearchPreviewArgsSchema: () => webSearchPreviewArgsSchema,
53
- webSearchPreviewInputSchema: () => webSearchPreviewInputSchema
56
+ webSearchPreviewInputSchema: () => webSearchPreviewInputSchema,
57
+ webSearchToolFactory: () => webSearchToolFactory
54
58
  });
55
59
  module.exports = __toCommonJS(index_exports);
56
60
 
@@ -3533,7 +3537,10 @@ var webSearchArgsSchema = (0, import_provider_utils26.lazySchema)(
3533
3537
  () => (0, import_provider_utils26.zodSchema)(
3534
3538
  import_v419.z.object({
3535
3539
  externalWebAccess: import_v419.z.boolean().optional(),
3536
- filters: import_v419.z.object({ allowedDomains: import_v419.z.array(import_v419.z.string()).optional() }).optional(),
3540
+ filters: import_v419.z.object({
3541
+ allowedDomains: import_v419.z.array(import_v419.z.string()).optional(),
3542
+ blockedDomains: import_v419.z.array(import_v419.z.string()).optional()
3543
+ }).optional(),
3537
3544
  searchContextSize: import_v419.z.enum(["low", "medium", "high"]).optional(),
3538
3545
  userLocation: import_v419.z.object({
3539
3546
  type: import_v419.z.literal("approximate"),
@@ -3579,6 +3586,7 @@ var webSearchToolFactory = (0, import_provider_utils26.createProviderDefinedTool
3579
3586
  inputSchema: webSearchInputSchema,
3580
3587
  outputSchema: webSearchOutputSchema
3581
3588
  });
3589
+ var webSearch = (args = {}) => webSearchToolFactory(args);
3582
3590
 
3583
3591
  // src/tool/web-search-preview.ts
3584
3592
  var import_provider_utils27 = require("@ai-sdk/provider-utils");
@@ -3732,7 +3740,10 @@ async function prepareResponsesTools({
3732
3740
  });
3733
3741
  openaiTools.push({
3734
3742
  type: "web_search",
3735
- filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
3743
+ filters: args.filters != null ? {
3744
+ allowed_domains: args.filters.allowedDomains,
3745
+ blocked_domains: args.filters.blockedDomains
3746
+ } : void 0,
3736
3747
  external_web_access: args.externalWebAccess,
3737
3748
  search_context_size: args.searchContextSize,
3738
3749
  user_location: args.userLocation
@@ -4979,8 +4990,12 @@ function getResponsesUsageMetadata(usage) {
4979
4990
  openaiImageModelGenerationOptions,
4980
4991
  openaiImageModelOptions,
4981
4992
  openaiSpeechProviderOptionsSchema,
4993
+ webSearch,
4994
+ webSearchArgsSchema,
4995
+ webSearchOutputSchema,
4982
4996
  webSearchPreview,
4983
4997
  webSearchPreviewArgsSchema,
4984
- webSearchPreviewInputSchema
4998
+ webSearchPreviewInputSchema,
4999
+ webSearchToolFactory
4985
5000
  });
4986
5001
  //# sourceMappingURL=index.js.map