@ai-sdk/openai 3.0.88 → 3.0.89
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 +6 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +8 -0
- package/dist/internal/index.d.ts +8 -0
- package/dist/internal/index.js +8 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +8 -2
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +5 -1
- package/package.json +1 -1
- package/src/responses/openai-responses-api.ts +6 -1
- package/src/responses/openai-responses-prepare-tools.ts +4 -1
- package/src/tool/web-search.ts +12 -1
package/docs/03-openai.mdx
CHANGED
|
@@ -500,6 +500,7 @@ const result = await generateText({
|
|
|
500
500
|
},
|
|
501
501
|
filters: {
|
|
502
502
|
allowedDomains: ['sfchronicle.com', 'sfgate.com'],
|
|
503
|
+
blockedDomains: ['example.com'],
|
|
503
504
|
},
|
|
504
505
|
}),
|
|
505
506
|
},
|
|
@@ -526,7 +527,10 @@ The web search tool supports the following configuration options:
|
|
|
526
527
|
- **searchContextSize** _'low' | 'medium' | 'high'_ - Controls the amount of context used for the search. Higher values provide more comprehensive results but may have higher latency and cost.
|
|
527
528
|
- **userLocation** - Optional location information to provide geographically relevant results. Includes `type` (always `'approximate'`), `country`, `city`, `region`, and `timezone`.
|
|
528
529
|
- **filters** - Optional filter configuration to restrict search results.
|
|
529
|
-
- **allowedDomains** _string[]_ -
|
|
530
|
+
- **allowedDomains** _string[]_ - Up to 100 allowed domains for the search.
|
|
531
|
+
- **blockedDomains** _string[]_ - Up to 100 blocked domains for the search.
|
|
532
|
+
|
|
533
|
+
Omit the HTTP or HTTPS prefix from domain filters. Subdomains of configured domains are automatically included or excluded.
|
|
530
534
|
|
|
531
535
|
For detailed information on configuration options see the [OpenAI Web Search Tool documentation](https://platform.openai.com/docs/guides/tools-web-search?api-mode=responses).
|
|
532
536
|
|
package/package.json
CHANGED
|
@@ -351,7 +351,12 @@ export type OpenAIResponsesTool =
|
|
|
351
351
|
| {
|
|
352
352
|
type: 'web_search';
|
|
353
353
|
external_web_access: boolean | undefined;
|
|
354
|
-
filters:
|
|
354
|
+
filters:
|
|
355
|
+
| {
|
|
356
|
+
allowed_domains: string[] | undefined;
|
|
357
|
+
blocked_domains: string[] | undefined;
|
|
358
|
+
}
|
|
359
|
+
| undefined;
|
|
355
360
|
search_context_size: 'low' | 'medium' | 'high' | undefined;
|
|
356
361
|
user_location:
|
|
357
362
|
| {
|
|
@@ -187,7 +187,10 @@ export async function prepareResponsesTools({
|
|
|
187
187
|
type: 'web_search',
|
|
188
188
|
filters:
|
|
189
189
|
args.filters != null
|
|
190
|
-
? {
|
|
190
|
+
? {
|
|
191
|
+
allowed_domains: args.filters.allowedDomains,
|
|
192
|
+
blocked_domains: args.filters.blockedDomains,
|
|
193
|
+
}
|
|
191
194
|
: undefined,
|
|
192
195
|
external_web_access: args.externalWebAccess,
|
|
193
196
|
search_context_size: args.searchContextSize,
|
package/src/tool/web-search.ts
CHANGED
|
@@ -10,7 +10,10 @@ export const webSearchArgsSchema = lazySchema(() =>
|
|
|
10
10
|
z.object({
|
|
11
11
|
externalWebAccess: z.boolean().optional(),
|
|
12
12
|
filters: z
|
|
13
|
-
.object({
|
|
13
|
+
.object({
|
|
14
|
+
allowedDomains: z.array(z.string()).optional(),
|
|
15
|
+
blockedDomains: z.array(z.string()).optional(),
|
|
16
|
+
})
|
|
14
17
|
.optional(),
|
|
15
18
|
searchContextSize: z.enum(['low', 'medium', 'high']).optional(),
|
|
16
19
|
userLocation: z
|
|
@@ -140,8 +143,16 @@ export const webSearchToolFactory = createProviderToolFactoryWithOutputSchema<
|
|
|
140
143
|
* Allowed domains for the search.
|
|
141
144
|
* If not provided, all domains are allowed.
|
|
142
145
|
* Subdomains of the provided domains are allowed as well.
|
|
146
|
+
* Omit the HTTP or HTTPS prefix. Maximum 100 domains.
|
|
143
147
|
*/
|
|
144
148
|
allowedDomains?: string[];
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Blocked domains for the search.
|
|
152
|
+
* Subdomains of the provided domains are blocked as well.
|
|
153
|
+
* Omit the HTTP or HTTPS prefix. Maximum 100 domains.
|
|
154
|
+
*/
|
|
155
|
+
blockedDomains?: string[];
|
|
145
156
|
};
|
|
146
157
|
|
|
147
158
|
/**
|