@ai-sdk/openai 2.0.70 → 2.0.72
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.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +84 -1
- package/dist/internal/index.d.ts +84 -1
- package/dist/internal/index.js +14 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +10 -3
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -477,4 +477,87 @@ declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_
|
|
|
477
477
|
result: string;
|
|
478
478
|
}>;
|
|
479
479
|
|
|
480
|
-
|
|
480
|
+
declare const webSearchPreviewArgsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
481
|
+
searchContextSize?: "low" | "medium" | "high" | undefined;
|
|
482
|
+
userLocation?: {
|
|
483
|
+
type: "approximate";
|
|
484
|
+
country?: string | undefined;
|
|
485
|
+
city?: string | undefined;
|
|
486
|
+
region?: string | undefined;
|
|
487
|
+
timezone?: string | undefined;
|
|
488
|
+
} | undefined;
|
|
489
|
+
}>;
|
|
490
|
+
declare const webSearchPreviewInputSchema: _ai_sdk_provider_utils.LazySchema<Record<string, never>>;
|
|
491
|
+
declare const webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
|
|
492
|
+
/**
|
|
493
|
+
* An object describing the specific action taken in this web search call.
|
|
494
|
+
* Includes details on how the model used the web (search, open_page, find).
|
|
495
|
+
*/
|
|
496
|
+
action: {
|
|
497
|
+
/**
|
|
498
|
+
* Action type "search" - Performs a web search query.
|
|
499
|
+
*/
|
|
500
|
+
type: "search";
|
|
501
|
+
/**
|
|
502
|
+
* The search query.
|
|
503
|
+
*/
|
|
504
|
+
query?: string;
|
|
505
|
+
} | {
|
|
506
|
+
/**
|
|
507
|
+
* Action type "openPage" - Opens a specific URL from search results.
|
|
508
|
+
*/
|
|
509
|
+
type: "openPage";
|
|
510
|
+
/**
|
|
511
|
+
* The URL opened by the model.
|
|
512
|
+
*/
|
|
513
|
+
url: string;
|
|
514
|
+
} | {
|
|
515
|
+
/**
|
|
516
|
+
* Action type "find": Searches for a pattern within a loaded page.
|
|
517
|
+
*/
|
|
518
|
+
type: "find";
|
|
519
|
+
/**
|
|
520
|
+
* The URL of the page searched for the pattern.
|
|
521
|
+
*/
|
|
522
|
+
url: string;
|
|
523
|
+
/**
|
|
524
|
+
* The pattern or text to search for within the page.
|
|
525
|
+
*/
|
|
526
|
+
pattern: string;
|
|
527
|
+
};
|
|
528
|
+
}, {
|
|
529
|
+
/**
|
|
530
|
+
* Search context size to use for the web search.
|
|
531
|
+
* - high: Most comprehensive context, highest cost, slower response
|
|
532
|
+
* - medium: Balanced context, cost, and latency (default)
|
|
533
|
+
* - low: Least context, lowest cost, fastest response
|
|
534
|
+
*/
|
|
535
|
+
searchContextSize?: "low" | "medium" | "high";
|
|
536
|
+
/**
|
|
537
|
+
* User location information to provide geographically relevant search results.
|
|
538
|
+
*/
|
|
539
|
+
userLocation?: {
|
|
540
|
+
/**
|
|
541
|
+
* Type of location (always 'approximate')
|
|
542
|
+
*/
|
|
543
|
+
type: "approximate";
|
|
544
|
+
/**
|
|
545
|
+
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
546
|
+
*/
|
|
547
|
+
country?: string;
|
|
548
|
+
/**
|
|
549
|
+
* City name (free text, e.g., 'Minneapolis')
|
|
550
|
+
*/
|
|
551
|
+
city?: string;
|
|
552
|
+
/**
|
|
553
|
+
* Region name (free text, e.g., 'Minnesota')
|
|
554
|
+
*/
|
|
555
|
+
region?: string;
|
|
556
|
+
/**
|
|
557
|
+
* IANA timezone (e.g., 'America/Chicago')
|
|
558
|
+
*/
|
|
559
|
+
timezone?: string;
|
|
560
|
+
};
|
|
561
|
+
}>;
|
|
562
|
+
|
|
563
|
+
export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions, openaiSpeechProviderOptionsSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema };
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -477,4 +477,87 @@ declare const imageGeneration: (args?: ImageGenerationArgs) => _ai_sdk_provider_
|
|
|
477
477
|
result: string;
|
|
478
478
|
}>;
|
|
479
479
|
|
|
480
|
-
|
|
480
|
+
declare const webSearchPreviewArgsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
481
|
+
searchContextSize?: "low" | "medium" | "high" | undefined;
|
|
482
|
+
userLocation?: {
|
|
483
|
+
type: "approximate";
|
|
484
|
+
country?: string | undefined;
|
|
485
|
+
city?: string | undefined;
|
|
486
|
+
region?: string | undefined;
|
|
487
|
+
timezone?: string | undefined;
|
|
488
|
+
} | undefined;
|
|
489
|
+
}>;
|
|
490
|
+
declare const webSearchPreviewInputSchema: _ai_sdk_provider_utils.LazySchema<Record<string, never>>;
|
|
491
|
+
declare const webSearchPreview: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{}, {
|
|
492
|
+
/**
|
|
493
|
+
* An object describing the specific action taken in this web search call.
|
|
494
|
+
* Includes details on how the model used the web (search, open_page, find).
|
|
495
|
+
*/
|
|
496
|
+
action: {
|
|
497
|
+
/**
|
|
498
|
+
* Action type "search" - Performs a web search query.
|
|
499
|
+
*/
|
|
500
|
+
type: "search";
|
|
501
|
+
/**
|
|
502
|
+
* The search query.
|
|
503
|
+
*/
|
|
504
|
+
query?: string;
|
|
505
|
+
} | {
|
|
506
|
+
/**
|
|
507
|
+
* Action type "openPage" - Opens a specific URL from search results.
|
|
508
|
+
*/
|
|
509
|
+
type: "openPage";
|
|
510
|
+
/**
|
|
511
|
+
* The URL opened by the model.
|
|
512
|
+
*/
|
|
513
|
+
url: string;
|
|
514
|
+
} | {
|
|
515
|
+
/**
|
|
516
|
+
* Action type "find": Searches for a pattern within a loaded page.
|
|
517
|
+
*/
|
|
518
|
+
type: "find";
|
|
519
|
+
/**
|
|
520
|
+
* The URL of the page searched for the pattern.
|
|
521
|
+
*/
|
|
522
|
+
url: string;
|
|
523
|
+
/**
|
|
524
|
+
* The pattern or text to search for within the page.
|
|
525
|
+
*/
|
|
526
|
+
pattern: string;
|
|
527
|
+
};
|
|
528
|
+
}, {
|
|
529
|
+
/**
|
|
530
|
+
* Search context size to use for the web search.
|
|
531
|
+
* - high: Most comprehensive context, highest cost, slower response
|
|
532
|
+
* - medium: Balanced context, cost, and latency (default)
|
|
533
|
+
* - low: Least context, lowest cost, fastest response
|
|
534
|
+
*/
|
|
535
|
+
searchContextSize?: "low" | "medium" | "high";
|
|
536
|
+
/**
|
|
537
|
+
* User location information to provide geographically relevant search results.
|
|
538
|
+
*/
|
|
539
|
+
userLocation?: {
|
|
540
|
+
/**
|
|
541
|
+
* Type of location (always 'approximate')
|
|
542
|
+
*/
|
|
543
|
+
type: "approximate";
|
|
544
|
+
/**
|
|
545
|
+
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
546
|
+
*/
|
|
547
|
+
country?: string;
|
|
548
|
+
/**
|
|
549
|
+
* City name (free text, e.g., 'Minneapolis')
|
|
550
|
+
*/
|
|
551
|
+
city?: string;
|
|
552
|
+
/**
|
|
553
|
+
* Region name (free text, e.g., 'Minnesota')
|
|
554
|
+
*/
|
|
555
|
+
region?: string;
|
|
556
|
+
/**
|
|
557
|
+
* IANA timezone (e.g., 'America/Chicago')
|
|
558
|
+
*/
|
|
559
|
+
timezone?: string;
|
|
560
|
+
};
|
|
561
|
+
}>;
|
|
562
|
+
|
|
563
|
+
export { OpenAIChatLanguageModel, type OpenAIChatLanguageModelOptions, type OpenAIChatModelId, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionProviderOptions, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingProviderOptions, OpenAIImageModel, type OpenAIImageModelId, OpenAIResponsesLanguageModel, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionProviderOptions, codeInterpreter, codeInterpreterArgsSchema, codeInterpreterInputSchema, codeInterpreterOutputSchema, codeInterpreterToolFactory, fileSearch, fileSearchArgsSchema, fileSearchOutputSchema, hasDefaultResponseFormat, imageGeneration, imageGenerationArgsSchema, imageGenerationOutputSchema, modelMaxImagesPerCall, openAITranscriptionProviderOptions, openaiChatLanguageModelOptions, openaiCompletionProviderOptions, openaiEmbeddingProviderOptions, openaiSpeechProviderOptionsSchema, webSearchPreview, webSearchPreviewArgsSchema, webSearchPreviewInputSchema };
|
package/dist/internal/index.js
CHANGED
|
@@ -44,7 +44,10 @@ __export(internal_exports, {
|
|
|
44
44
|
openaiChatLanguageModelOptions: () => openaiChatLanguageModelOptions,
|
|
45
45
|
openaiCompletionProviderOptions: () => openaiCompletionProviderOptions,
|
|
46
46
|
openaiEmbeddingProviderOptions: () => openaiEmbeddingProviderOptions,
|
|
47
|
-
openaiSpeechProviderOptionsSchema: () => openaiSpeechProviderOptionsSchema
|
|
47
|
+
openaiSpeechProviderOptionsSchema: () => openaiSpeechProviderOptionsSchema,
|
|
48
|
+
webSearchPreview: () => webSearchPreview,
|
|
49
|
+
webSearchPreviewArgsSchema: () => webSearchPreviewArgsSchema,
|
|
50
|
+
webSearchPreviewInputSchema: () => webSearchPreviewInputSchema
|
|
48
51
|
});
|
|
49
52
|
module.exports = __toCommonJS(internal_exports);
|
|
50
53
|
|
|
@@ -2683,6 +2686,8 @@ var openaiResponsesChunkSchema = (0, import_provider_utils21.lazyValidator)(
|
|
|
2683
2686
|
annotation: import_v414.z.discriminatedUnion("type", [
|
|
2684
2687
|
import_v414.z.object({
|
|
2685
2688
|
type: import_v414.z.literal("url_citation"),
|
|
2689
|
+
start_index: import_v414.z.number(),
|
|
2690
|
+
end_index: import_v414.z.number(),
|
|
2686
2691
|
url: import_v414.z.string(),
|
|
2687
2692
|
title: import_v414.z.string()
|
|
2688
2693
|
}),
|
|
@@ -3143,6 +3148,7 @@ var import_v418 = require("zod/v4");
|
|
|
3143
3148
|
var webSearchArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
3144
3149
|
() => (0, import_provider_utils25.zodSchema)(
|
|
3145
3150
|
import_v418.z.object({
|
|
3151
|
+
externalWebAccess: import_v418.z.boolean().optional(),
|
|
3146
3152
|
filters: import_v418.z.object({ allowedDomains: import_v418.z.array(import_v418.z.string()).optional() }).optional(),
|
|
3147
3153
|
searchContextSize: import_v418.z.enum(["low", "medium", "high"]).optional(),
|
|
3148
3154
|
userLocation: import_v418.z.object({
|
|
@@ -3343,6 +3349,7 @@ async function prepareResponsesTools({
|
|
|
3343
3349
|
openaiTools.push({
|
|
3344
3350
|
type: "web_search",
|
|
3345
3351
|
filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
|
|
3352
|
+
external_web_access: args.externalWebAccess,
|
|
3346
3353
|
search_context_size: args.searchContextSize,
|
|
3347
3354
|
user_location: args.userLocation
|
|
3348
3355
|
});
|
|
@@ -3998,7 +4005,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3998
4005
|
controller.enqueue({
|
|
3999
4006
|
type: "tool-call",
|
|
4000
4007
|
toolCallId: value.item.id,
|
|
4001
|
-
toolName: "web_search",
|
|
4008
|
+
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
4002
4009
|
input: JSON.stringify({}),
|
|
4003
4010
|
providerExecuted: true
|
|
4004
4011
|
});
|
|
@@ -4099,7 +4106,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4099
4106
|
controller.enqueue({
|
|
4100
4107
|
type: "tool-result",
|
|
4101
4108
|
toolCallId: value.item.id,
|
|
4102
|
-
toolName: "web_search",
|
|
4109
|
+
toolName: webSearchToolName != null ? webSearchToolName : "web_search",
|
|
4103
4110
|
result: mapWebSearchOutput(value.item.action),
|
|
4104
4111
|
providerExecuted: true
|
|
4105
4112
|
});
|
|
@@ -4499,6 +4506,9 @@ function mapWebSearchOutput(action) {
|
|
|
4499
4506
|
openaiChatLanguageModelOptions,
|
|
4500
4507
|
openaiCompletionProviderOptions,
|
|
4501
4508
|
openaiEmbeddingProviderOptions,
|
|
4502
|
-
openaiSpeechProviderOptionsSchema
|
|
4509
|
+
openaiSpeechProviderOptionsSchema,
|
|
4510
|
+
webSearchPreview,
|
|
4511
|
+
webSearchPreviewArgsSchema,
|
|
4512
|
+
webSearchPreviewInputSchema
|
|
4503
4513
|
});
|
|
4504
4514
|
//# sourceMappingURL=index.js.map
|