@ai-sdk/openai 2.0.0-beta.1 → 2.0.0-beta.3
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 +16 -0
- package/dist/index.d.mts +7 -26
- package/dist/index.d.ts +7 -26
- package/dist/index.js +347 -341
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -39
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +30 -204
- package/dist/internal/index.d.ts +30 -204
- package/dist/internal/index.js +347 -341
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +45 -39
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
|
31
31
|
// src/openai-chat-language-model.ts
|
|
32
32
|
var import_provider3 = require("@ai-sdk/provider");
|
|
33
33
|
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
34
|
-
var
|
|
34
|
+
var import_v45 = require("zod/v4");
|
|
35
35
|
|
|
36
36
|
// src/convert-to-openai-chat-messages.ts
|
|
37
37
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -242,15 +242,15 @@ function mapOpenAIFinishReason(finishReason) {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
// src/openai-chat-options.ts
|
|
245
|
-
var
|
|
246
|
-
var openaiProviderOptions =
|
|
245
|
+
var import_v4 = require("zod/v4");
|
|
246
|
+
var openaiProviderOptions = import_v4.z.object({
|
|
247
247
|
/**
|
|
248
248
|
* Modify the likelihood of specified tokens appearing in the completion.
|
|
249
249
|
*
|
|
250
250
|
* Accepts a JSON object that maps tokens (specified by their token ID in
|
|
251
251
|
* the GPT tokenizer) to an associated bias value from -100 to 100.
|
|
252
252
|
*/
|
|
253
|
-
logitBias:
|
|
253
|
+
logitBias: import_v4.z.record(import_v4.z.coerce.number(), import_v4.z.number()).optional(),
|
|
254
254
|
/**
|
|
255
255
|
* Return the log probabilities of the tokens.
|
|
256
256
|
*
|
|
@@ -260,63 +260,69 @@ var openaiProviderOptions = import_zod.z.object({
|
|
|
260
260
|
* Setting to a number will return the log probabilities of the top n
|
|
261
261
|
* tokens that were generated.
|
|
262
262
|
*/
|
|
263
|
-
logprobs:
|
|
263
|
+
logprobs: import_v4.z.union([import_v4.z.boolean(), import_v4.z.number()]).optional(),
|
|
264
264
|
/**
|
|
265
265
|
* Whether to enable parallel function calling during tool use. Default to true.
|
|
266
266
|
*/
|
|
267
|
-
parallelToolCalls:
|
|
267
|
+
parallelToolCalls: import_v4.z.boolean().optional(),
|
|
268
268
|
/**
|
|
269
269
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
270
270
|
* monitor and detect abuse.
|
|
271
271
|
*/
|
|
272
|
-
user:
|
|
272
|
+
user: import_v4.z.string().optional(),
|
|
273
273
|
/**
|
|
274
274
|
* Reasoning effort for reasoning models. Defaults to `medium`.
|
|
275
275
|
*/
|
|
276
|
-
reasoningEffort:
|
|
276
|
+
reasoningEffort: import_v4.z.enum(["low", "medium", "high"]).optional(),
|
|
277
277
|
/**
|
|
278
278
|
* Maximum number of completion tokens to generate. Useful for reasoning models.
|
|
279
279
|
*/
|
|
280
|
-
maxCompletionTokens:
|
|
280
|
+
maxCompletionTokens: import_v4.z.number().optional(),
|
|
281
281
|
/**
|
|
282
282
|
* Whether to enable persistence in responses API.
|
|
283
283
|
*/
|
|
284
|
-
store:
|
|
284
|
+
store: import_v4.z.boolean().optional(),
|
|
285
285
|
/**
|
|
286
286
|
* Metadata to associate with the request.
|
|
287
287
|
*/
|
|
288
|
-
metadata:
|
|
288
|
+
metadata: import_v4.z.record(import_v4.z.string().max(64), import_v4.z.string().max(512)).optional(),
|
|
289
289
|
/**
|
|
290
290
|
* Parameters for prediction mode.
|
|
291
291
|
*/
|
|
292
|
-
prediction:
|
|
292
|
+
prediction: import_v4.z.record(import_v4.z.string(), import_v4.z.any()).optional(),
|
|
293
293
|
/**
|
|
294
294
|
* Whether to use structured outputs.
|
|
295
295
|
*
|
|
296
296
|
* @default true
|
|
297
297
|
*/
|
|
298
|
-
structuredOutputs:
|
|
298
|
+
structuredOutputs: import_v4.z.boolean().optional(),
|
|
299
299
|
/**
|
|
300
300
|
* Service tier for the request. Set to 'flex' for 50% cheaper processing
|
|
301
301
|
* at the cost of increased latency. Only available for o3 and o4-mini models.
|
|
302
302
|
*
|
|
303
303
|
* @default 'auto'
|
|
304
304
|
*/
|
|
305
|
-
serviceTier:
|
|
305
|
+
serviceTier: import_v4.z.enum(["auto", "flex"]).optional(),
|
|
306
|
+
/**
|
|
307
|
+
* Whether to use strict JSON schema validation.
|
|
308
|
+
*
|
|
309
|
+
* @default true
|
|
310
|
+
*/
|
|
311
|
+
strictJsonSchema: import_v4.z.boolean().optional()
|
|
306
312
|
});
|
|
307
313
|
|
|
308
314
|
// src/openai-error.ts
|
|
309
|
-
var
|
|
315
|
+
var import_v42 = require("zod/v4");
|
|
310
316
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
311
|
-
var openaiErrorDataSchema =
|
|
312
|
-
error:
|
|
313
|
-
message:
|
|
317
|
+
var openaiErrorDataSchema = import_v42.z.object({
|
|
318
|
+
error: import_v42.z.object({
|
|
319
|
+
message: import_v42.z.string(),
|
|
314
320
|
// The additional information below is handled loosely to support
|
|
315
321
|
// OpenAI-compatible providers that have slightly different error
|
|
316
322
|
// responses:
|
|
317
|
-
type:
|
|
318
|
-
param:
|
|
319
|
-
code:
|
|
323
|
+
type: import_v42.z.string().nullish(),
|
|
324
|
+
param: import_v42.z.any().nullish(),
|
|
325
|
+
code: import_v42.z.union([import_v42.z.string(), import_v42.z.number()]).nullish()
|
|
320
326
|
})
|
|
321
327
|
});
|
|
322
328
|
var openaiFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResponseHandler)({
|
|
@@ -329,77 +335,78 @@ var import_provider2 = require("@ai-sdk/provider");
|
|
|
329
335
|
|
|
330
336
|
// src/tool/file-search.ts
|
|
331
337
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
332
|
-
var
|
|
333
|
-
var fileSearchArgsSchema =
|
|
338
|
+
var import_v43 = require("zod/v4");
|
|
339
|
+
var fileSearchArgsSchema = import_v43.z.object({
|
|
334
340
|
/**
|
|
335
341
|
* List of vector store IDs to search through. If not provided, searches all available vector stores.
|
|
336
342
|
*/
|
|
337
|
-
vectorStoreIds:
|
|
343
|
+
vectorStoreIds: import_v43.z.array(import_v43.z.string()).optional(),
|
|
338
344
|
/**
|
|
339
345
|
* Maximum number of search results to return. Defaults to 10.
|
|
340
346
|
*/
|
|
341
|
-
maxResults:
|
|
347
|
+
maxResults: import_v43.z.number().optional(),
|
|
342
348
|
/**
|
|
343
349
|
* Type of search to perform. Defaults to 'auto'.
|
|
344
350
|
*/
|
|
345
|
-
searchType:
|
|
351
|
+
searchType: import_v43.z.enum(["auto", "keyword", "semantic"]).optional()
|
|
346
352
|
});
|
|
347
353
|
var fileSearch = (0, import_provider_utils3.createProviderDefinedToolFactory)({
|
|
348
354
|
id: "openai.file_search",
|
|
349
355
|
name: "file_search",
|
|
350
|
-
inputSchema:
|
|
351
|
-
query:
|
|
356
|
+
inputSchema: import_v43.z.object({
|
|
357
|
+
query: import_v43.z.string()
|
|
352
358
|
})
|
|
353
359
|
});
|
|
354
360
|
|
|
355
361
|
// src/tool/web-search-preview.ts
|
|
356
362
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
357
|
-
var
|
|
358
|
-
var webSearchPreviewArgsSchema =
|
|
363
|
+
var import_v44 = require("zod/v4");
|
|
364
|
+
var webSearchPreviewArgsSchema = import_v44.z.object({
|
|
359
365
|
/**
|
|
360
366
|
* Search context size to use for the web search.
|
|
361
367
|
* - high: Most comprehensive context, highest cost, slower response
|
|
362
368
|
* - medium: Balanced context, cost, and latency (default)
|
|
363
369
|
* - low: Least context, lowest cost, fastest response
|
|
364
370
|
*/
|
|
365
|
-
searchContextSize:
|
|
371
|
+
searchContextSize: import_v44.z.enum(["low", "medium", "high"]).optional(),
|
|
366
372
|
/**
|
|
367
373
|
* User location information to provide geographically relevant search results.
|
|
368
374
|
*/
|
|
369
|
-
userLocation:
|
|
375
|
+
userLocation: import_v44.z.object({
|
|
370
376
|
/**
|
|
371
377
|
* Type of location (always 'approximate')
|
|
372
378
|
*/
|
|
373
|
-
type:
|
|
379
|
+
type: import_v44.z.literal("approximate"),
|
|
374
380
|
/**
|
|
375
381
|
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
376
382
|
*/
|
|
377
|
-
country:
|
|
383
|
+
country: import_v44.z.string().optional(),
|
|
378
384
|
/**
|
|
379
385
|
* City name (free text, e.g., 'Minneapolis')
|
|
380
386
|
*/
|
|
381
|
-
city:
|
|
387
|
+
city: import_v44.z.string().optional(),
|
|
382
388
|
/**
|
|
383
389
|
* Region name (free text, e.g., 'Minnesota')
|
|
384
390
|
*/
|
|
385
|
-
region:
|
|
391
|
+
region: import_v44.z.string().optional(),
|
|
386
392
|
/**
|
|
387
393
|
* IANA timezone (e.g., 'America/Chicago')
|
|
388
394
|
*/
|
|
389
|
-
timezone:
|
|
395
|
+
timezone: import_v44.z.string().optional()
|
|
390
396
|
}).optional()
|
|
391
397
|
});
|
|
392
398
|
var webSearchPreview = (0, import_provider_utils4.createProviderDefinedToolFactory)({
|
|
393
399
|
id: "openai.web_search_preview",
|
|
394
400
|
name: "web_search_preview",
|
|
395
|
-
inputSchema:
|
|
401
|
+
inputSchema: import_v44.z.object({})
|
|
396
402
|
});
|
|
397
403
|
|
|
398
404
|
// src/openai-prepare-tools.ts
|
|
399
405
|
function prepareTools({
|
|
400
406
|
tools,
|
|
401
407
|
toolChoice,
|
|
402
|
-
structuredOutputs
|
|
408
|
+
structuredOutputs,
|
|
409
|
+
strictJsonSchema
|
|
403
410
|
}) {
|
|
404
411
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
405
412
|
const toolWarnings = [];
|
|
@@ -416,7 +423,7 @@ function prepareTools({
|
|
|
416
423
|
name: tool.name,
|
|
417
424
|
description: tool.description,
|
|
418
425
|
parameters: tool.inputSchema,
|
|
419
|
-
strict: structuredOutputs ?
|
|
426
|
+
strict: structuredOutputs ? strictJsonSchema : void 0
|
|
420
427
|
}
|
|
421
428
|
});
|
|
422
429
|
break;
|
|
@@ -508,7 +515,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
508
515
|
toolChoice,
|
|
509
516
|
providerOptions
|
|
510
517
|
}) {
|
|
511
|
-
var _a, _b, _c;
|
|
518
|
+
var _a, _b, _c, _d;
|
|
512
519
|
const warnings = [];
|
|
513
520
|
const openaiOptions = (_a = await (0, import_provider_utils5.parseProviderOptions)({
|
|
514
521
|
provider: "openai",
|
|
@@ -536,6 +543,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
536
543
|
}
|
|
537
544
|
);
|
|
538
545
|
warnings.push(...messageWarnings);
|
|
546
|
+
const strictJsonSchema = (_c = openaiOptions.strictJsonSchema) != null ? _c : false;
|
|
539
547
|
const baseArgs = {
|
|
540
548
|
// model id:
|
|
541
549
|
model: this.modelId,
|
|
@@ -551,18 +559,15 @@ var OpenAIChatLanguageModel = class {
|
|
|
551
559
|
top_p: topP,
|
|
552
560
|
frequency_penalty: frequencyPenalty,
|
|
553
561
|
presence_penalty: presencePenalty,
|
|
554
|
-
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ?
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
}
|
|
564
|
-
} : { type: "json_object" }
|
|
565
|
-
) : void 0,
|
|
562
|
+
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? structuredOutputs && responseFormat.schema != null ? {
|
|
563
|
+
type: "json_schema",
|
|
564
|
+
json_schema: {
|
|
565
|
+
schema: responseFormat.schema,
|
|
566
|
+
strict: strictJsonSchema,
|
|
567
|
+
name: (_d = responseFormat.name) != null ? _d : "response",
|
|
568
|
+
description: responseFormat.description
|
|
569
|
+
}
|
|
570
|
+
} : { type: "json_object" } : void 0,
|
|
566
571
|
stop: stopSequences,
|
|
567
572
|
seed,
|
|
568
573
|
// openai specific settings:
|
|
@@ -661,7 +666,8 @@ var OpenAIChatLanguageModel = class {
|
|
|
661
666
|
} = prepareTools({
|
|
662
667
|
tools,
|
|
663
668
|
toolChoice,
|
|
664
|
-
structuredOutputs
|
|
669
|
+
structuredOutputs,
|
|
670
|
+
strictJsonSchema
|
|
665
671
|
});
|
|
666
672
|
return {
|
|
667
673
|
args: {
|
|
@@ -943,97 +949,97 @@ var OpenAIChatLanguageModel = class {
|
|
|
943
949
|
};
|
|
944
950
|
}
|
|
945
951
|
};
|
|
946
|
-
var openaiTokenUsageSchema =
|
|
947
|
-
prompt_tokens:
|
|
948
|
-
completion_tokens:
|
|
949
|
-
total_tokens:
|
|
950
|
-
prompt_tokens_details:
|
|
951
|
-
cached_tokens:
|
|
952
|
+
var openaiTokenUsageSchema = import_v45.z.object({
|
|
953
|
+
prompt_tokens: import_v45.z.number().nullish(),
|
|
954
|
+
completion_tokens: import_v45.z.number().nullish(),
|
|
955
|
+
total_tokens: import_v45.z.number().nullish(),
|
|
956
|
+
prompt_tokens_details: import_v45.z.object({
|
|
957
|
+
cached_tokens: import_v45.z.number().nullish()
|
|
952
958
|
}).nullish(),
|
|
953
|
-
completion_tokens_details:
|
|
954
|
-
reasoning_tokens:
|
|
955
|
-
accepted_prediction_tokens:
|
|
956
|
-
rejected_prediction_tokens:
|
|
959
|
+
completion_tokens_details: import_v45.z.object({
|
|
960
|
+
reasoning_tokens: import_v45.z.number().nullish(),
|
|
961
|
+
accepted_prediction_tokens: import_v45.z.number().nullish(),
|
|
962
|
+
rejected_prediction_tokens: import_v45.z.number().nullish()
|
|
957
963
|
}).nullish()
|
|
958
964
|
}).nullish();
|
|
959
|
-
var openaiChatResponseSchema =
|
|
960
|
-
id:
|
|
961
|
-
created:
|
|
962
|
-
model:
|
|
963
|
-
choices:
|
|
964
|
-
|
|
965
|
-
message:
|
|
966
|
-
role:
|
|
967
|
-
content:
|
|
968
|
-
tool_calls:
|
|
969
|
-
|
|
970
|
-
id:
|
|
971
|
-
type:
|
|
972
|
-
function:
|
|
973
|
-
name:
|
|
974
|
-
arguments:
|
|
965
|
+
var openaiChatResponseSchema = import_v45.z.object({
|
|
966
|
+
id: import_v45.z.string().nullish(),
|
|
967
|
+
created: import_v45.z.number().nullish(),
|
|
968
|
+
model: import_v45.z.string().nullish(),
|
|
969
|
+
choices: import_v45.z.array(
|
|
970
|
+
import_v45.z.object({
|
|
971
|
+
message: import_v45.z.object({
|
|
972
|
+
role: import_v45.z.literal("assistant").nullish(),
|
|
973
|
+
content: import_v45.z.string().nullish(),
|
|
974
|
+
tool_calls: import_v45.z.array(
|
|
975
|
+
import_v45.z.object({
|
|
976
|
+
id: import_v45.z.string().nullish(),
|
|
977
|
+
type: import_v45.z.literal("function"),
|
|
978
|
+
function: import_v45.z.object({
|
|
979
|
+
name: import_v45.z.string(),
|
|
980
|
+
arguments: import_v45.z.string()
|
|
975
981
|
})
|
|
976
982
|
})
|
|
977
983
|
).nullish()
|
|
978
984
|
}),
|
|
979
|
-
index:
|
|
980
|
-
logprobs:
|
|
981
|
-
content:
|
|
982
|
-
|
|
983
|
-
token:
|
|
984
|
-
logprob:
|
|
985
|
-
top_logprobs:
|
|
986
|
-
|
|
987
|
-
token:
|
|
988
|
-
logprob:
|
|
985
|
+
index: import_v45.z.number(),
|
|
986
|
+
logprobs: import_v45.z.object({
|
|
987
|
+
content: import_v45.z.array(
|
|
988
|
+
import_v45.z.object({
|
|
989
|
+
token: import_v45.z.string(),
|
|
990
|
+
logprob: import_v45.z.number(),
|
|
991
|
+
top_logprobs: import_v45.z.array(
|
|
992
|
+
import_v45.z.object({
|
|
993
|
+
token: import_v45.z.string(),
|
|
994
|
+
logprob: import_v45.z.number()
|
|
989
995
|
})
|
|
990
996
|
)
|
|
991
997
|
})
|
|
992
998
|
).nullish()
|
|
993
999
|
}).nullish(),
|
|
994
|
-
finish_reason:
|
|
1000
|
+
finish_reason: import_v45.z.string().nullish()
|
|
995
1001
|
})
|
|
996
1002
|
),
|
|
997
1003
|
usage: openaiTokenUsageSchema
|
|
998
1004
|
});
|
|
999
|
-
var openaiChatChunkSchema =
|
|
1000
|
-
|
|
1001
|
-
id:
|
|
1002
|
-
created:
|
|
1003
|
-
model:
|
|
1004
|
-
choices:
|
|
1005
|
-
|
|
1006
|
-
delta:
|
|
1007
|
-
role:
|
|
1008
|
-
content:
|
|
1009
|
-
tool_calls:
|
|
1010
|
-
|
|
1011
|
-
index:
|
|
1012
|
-
id:
|
|
1013
|
-
type:
|
|
1014
|
-
function:
|
|
1015
|
-
name:
|
|
1016
|
-
arguments:
|
|
1005
|
+
var openaiChatChunkSchema = import_v45.z.union([
|
|
1006
|
+
import_v45.z.object({
|
|
1007
|
+
id: import_v45.z.string().nullish(),
|
|
1008
|
+
created: import_v45.z.number().nullish(),
|
|
1009
|
+
model: import_v45.z.string().nullish(),
|
|
1010
|
+
choices: import_v45.z.array(
|
|
1011
|
+
import_v45.z.object({
|
|
1012
|
+
delta: import_v45.z.object({
|
|
1013
|
+
role: import_v45.z.enum(["assistant"]).nullish(),
|
|
1014
|
+
content: import_v45.z.string().nullish(),
|
|
1015
|
+
tool_calls: import_v45.z.array(
|
|
1016
|
+
import_v45.z.object({
|
|
1017
|
+
index: import_v45.z.number(),
|
|
1018
|
+
id: import_v45.z.string().nullish(),
|
|
1019
|
+
type: import_v45.z.literal("function").nullish(),
|
|
1020
|
+
function: import_v45.z.object({
|
|
1021
|
+
name: import_v45.z.string().nullish(),
|
|
1022
|
+
arguments: import_v45.z.string().nullish()
|
|
1017
1023
|
})
|
|
1018
1024
|
})
|
|
1019
1025
|
).nullish()
|
|
1020
1026
|
}).nullish(),
|
|
1021
|
-
logprobs:
|
|
1022
|
-
content:
|
|
1023
|
-
|
|
1024
|
-
token:
|
|
1025
|
-
logprob:
|
|
1026
|
-
top_logprobs:
|
|
1027
|
-
|
|
1028
|
-
token:
|
|
1029
|
-
logprob:
|
|
1027
|
+
logprobs: import_v45.z.object({
|
|
1028
|
+
content: import_v45.z.array(
|
|
1029
|
+
import_v45.z.object({
|
|
1030
|
+
token: import_v45.z.string(),
|
|
1031
|
+
logprob: import_v45.z.number(),
|
|
1032
|
+
top_logprobs: import_v45.z.array(
|
|
1033
|
+
import_v45.z.object({
|
|
1034
|
+
token: import_v45.z.string(),
|
|
1035
|
+
logprob: import_v45.z.number()
|
|
1030
1036
|
})
|
|
1031
1037
|
)
|
|
1032
1038
|
})
|
|
1033
1039
|
).nullish()
|
|
1034
1040
|
}).nullish(),
|
|
1035
|
-
finish_reason:
|
|
1036
|
-
index:
|
|
1041
|
+
finish_reason: import_v45.z.string().nullish(),
|
|
1042
|
+
index: import_v45.z.number()
|
|
1037
1043
|
})
|
|
1038
1044
|
),
|
|
1039
1045
|
usage: openaiTokenUsageSchema
|
|
@@ -1088,7 +1094,7 @@ var reasoningModels = {
|
|
|
1088
1094
|
|
|
1089
1095
|
// src/openai-completion-language-model.ts
|
|
1090
1096
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1091
|
-
var
|
|
1097
|
+
var import_v47 = require("zod/v4");
|
|
1092
1098
|
|
|
1093
1099
|
// src/convert-to-openai-completion-prompt.ts
|
|
1094
1100
|
var import_provider4 = require("@ai-sdk/provider");
|
|
@@ -1166,12 +1172,12 @@ ${user}:`]
|
|
|
1166
1172
|
}
|
|
1167
1173
|
|
|
1168
1174
|
// src/openai-completion-options.ts
|
|
1169
|
-
var
|
|
1170
|
-
var openaiCompletionProviderOptions =
|
|
1175
|
+
var import_v46 = require("zod/v4");
|
|
1176
|
+
var openaiCompletionProviderOptions = import_v46.z.object({
|
|
1171
1177
|
/**
|
|
1172
1178
|
Echo back the prompt in addition to the completion.
|
|
1173
1179
|
*/
|
|
1174
|
-
echo:
|
|
1180
|
+
echo: import_v46.z.boolean().optional(),
|
|
1175
1181
|
/**
|
|
1176
1182
|
Modify the likelihood of specified tokens appearing in the completion.
|
|
1177
1183
|
|
|
@@ -1186,16 +1192,16 @@ var openaiCompletionProviderOptions = import_zod6.z.object({
|
|
|
1186
1192
|
As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
|
|
1187
1193
|
token from being generated.
|
|
1188
1194
|
*/
|
|
1189
|
-
logitBias:
|
|
1195
|
+
logitBias: import_v46.z.record(import_v46.z.string(), import_v46.z.number()).optional(),
|
|
1190
1196
|
/**
|
|
1191
1197
|
The suffix that comes after a completion of inserted text.
|
|
1192
1198
|
*/
|
|
1193
|
-
suffix:
|
|
1199
|
+
suffix: import_v46.z.string().optional(),
|
|
1194
1200
|
/**
|
|
1195
1201
|
A unique identifier representing your end-user, which can help OpenAI to
|
|
1196
1202
|
monitor and detect abuse. Learn more.
|
|
1197
1203
|
*/
|
|
1198
|
-
user:
|
|
1204
|
+
user: import_v46.z.string().optional(),
|
|
1199
1205
|
/**
|
|
1200
1206
|
Return the log probabilities of the tokens. Including logprobs will increase
|
|
1201
1207
|
the response size and can slow down response times. However, it can
|
|
@@ -1205,7 +1211,7 @@ var openaiCompletionProviderOptions = import_zod6.z.object({
|
|
|
1205
1211
|
Setting to a number will return the log probabilities of the top n
|
|
1206
1212
|
tokens that were generated.
|
|
1207
1213
|
*/
|
|
1208
|
-
logprobs:
|
|
1214
|
+
logprobs: import_v46.z.union([import_v46.z.boolean(), import_v46.z.number()]).optional()
|
|
1209
1215
|
});
|
|
1210
1216
|
|
|
1211
1217
|
// src/openai-completion-language-model.ts
|
|
@@ -1437,42 +1443,42 @@ var OpenAICompletionLanguageModel = class {
|
|
|
1437
1443
|
};
|
|
1438
1444
|
}
|
|
1439
1445
|
};
|
|
1440
|
-
var usageSchema =
|
|
1441
|
-
prompt_tokens:
|
|
1442
|
-
completion_tokens:
|
|
1443
|
-
total_tokens:
|
|
1446
|
+
var usageSchema = import_v47.z.object({
|
|
1447
|
+
prompt_tokens: import_v47.z.number(),
|
|
1448
|
+
completion_tokens: import_v47.z.number(),
|
|
1449
|
+
total_tokens: import_v47.z.number()
|
|
1444
1450
|
});
|
|
1445
|
-
var openaiCompletionResponseSchema =
|
|
1446
|
-
id:
|
|
1447
|
-
created:
|
|
1448
|
-
model:
|
|
1449
|
-
choices:
|
|
1450
|
-
|
|
1451
|
-
text:
|
|
1452
|
-
finish_reason:
|
|
1453
|
-
logprobs:
|
|
1454
|
-
tokens:
|
|
1455
|
-
token_logprobs:
|
|
1456
|
-
top_logprobs:
|
|
1451
|
+
var openaiCompletionResponseSchema = import_v47.z.object({
|
|
1452
|
+
id: import_v47.z.string().nullish(),
|
|
1453
|
+
created: import_v47.z.number().nullish(),
|
|
1454
|
+
model: import_v47.z.string().nullish(),
|
|
1455
|
+
choices: import_v47.z.array(
|
|
1456
|
+
import_v47.z.object({
|
|
1457
|
+
text: import_v47.z.string(),
|
|
1458
|
+
finish_reason: import_v47.z.string(),
|
|
1459
|
+
logprobs: import_v47.z.object({
|
|
1460
|
+
tokens: import_v47.z.array(import_v47.z.string()),
|
|
1461
|
+
token_logprobs: import_v47.z.array(import_v47.z.number()),
|
|
1462
|
+
top_logprobs: import_v47.z.array(import_v47.z.record(import_v47.z.string(), import_v47.z.number())).nullish()
|
|
1457
1463
|
}).nullish()
|
|
1458
1464
|
})
|
|
1459
1465
|
),
|
|
1460
1466
|
usage: usageSchema.nullish()
|
|
1461
1467
|
});
|
|
1462
|
-
var openaiCompletionChunkSchema =
|
|
1463
|
-
|
|
1464
|
-
id:
|
|
1465
|
-
created:
|
|
1466
|
-
model:
|
|
1467
|
-
choices:
|
|
1468
|
-
|
|
1469
|
-
text:
|
|
1470
|
-
finish_reason:
|
|
1471
|
-
index:
|
|
1472
|
-
logprobs:
|
|
1473
|
-
tokens:
|
|
1474
|
-
token_logprobs:
|
|
1475
|
-
top_logprobs:
|
|
1468
|
+
var openaiCompletionChunkSchema = import_v47.z.union([
|
|
1469
|
+
import_v47.z.object({
|
|
1470
|
+
id: import_v47.z.string().nullish(),
|
|
1471
|
+
created: import_v47.z.number().nullish(),
|
|
1472
|
+
model: import_v47.z.string().nullish(),
|
|
1473
|
+
choices: import_v47.z.array(
|
|
1474
|
+
import_v47.z.object({
|
|
1475
|
+
text: import_v47.z.string(),
|
|
1476
|
+
finish_reason: import_v47.z.string().nullish(),
|
|
1477
|
+
index: import_v47.z.number(),
|
|
1478
|
+
logprobs: import_v47.z.object({
|
|
1479
|
+
tokens: import_v47.z.array(import_v47.z.string()),
|
|
1480
|
+
token_logprobs: import_v47.z.array(import_v47.z.number()),
|
|
1481
|
+
top_logprobs: import_v47.z.array(import_v47.z.record(import_v47.z.string(), import_v47.z.number())).nullish()
|
|
1476
1482
|
}).nullish()
|
|
1477
1483
|
})
|
|
1478
1484
|
),
|
|
@@ -1484,21 +1490,21 @@ var openaiCompletionChunkSchema = import_zod7.z.union([
|
|
|
1484
1490
|
// src/openai-embedding-model.ts
|
|
1485
1491
|
var import_provider5 = require("@ai-sdk/provider");
|
|
1486
1492
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1487
|
-
var
|
|
1493
|
+
var import_v49 = require("zod/v4");
|
|
1488
1494
|
|
|
1489
1495
|
// src/openai-embedding-options.ts
|
|
1490
|
-
var
|
|
1491
|
-
var openaiEmbeddingProviderOptions =
|
|
1496
|
+
var import_v48 = require("zod/v4");
|
|
1497
|
+
var openaiEmbeddingProviderOptions = import_v48.z.object({
|
|
1492
1498
|
/**
|
|
1493
1499
|
The number of dimensions the resulting output embeddings should have.
|
|
1494
1500
|
Only supported in text-embedding-3 and later models.
|
|
1495
1501
|
*/
|
|
1496
|
-
dimensions:
|
|
1502
|
+
dimensions: import_v48.z.number().optional(),
|
|
1497
1503
|
/**
|
|
1498
1504
|
A unique identifier representing your end-user, which can help OpenAI to
|
|
1499
1505
|
monitor and detect abuse. Learn more.
|
|
1500
1506
|
*/
|
|
1501
|
-
user:
|
|
1507
|
+
user: import_v48.z.string().optional()
|
|
1502
1508
|
});
|
|
1503
1509
|
|
|
1504
1510
|
// src/openai-embedding-model.ts
|
|
@@ -1564,14 +1570,14 @@ var OpenAIEmbeddingModel = class {
|
|
|
1564
1570
|
};
|
|
1565
1571
|
}
|
|
1566
1572
|
};
|
|
1567
|
-
var openaiTextEmbeddingResponseSchema =
|
|
1568
|
-
data:
|
|
1569
|
-
usage:
|
|
1573
|
+
var openaiTextEmbeddingResponseSchema = import_v49.z.object({
|
|
1574
|
+
data: import_v49.z.array(import_v49.z.object({ embedding: import_v49.z.array(import_v49.z.number()) })),
|
|
1575
|
+
usage: import_v49.z.object({ prompt_tokens: import_v49.z.number() }).nullish()
|
|
1570
1576
|
});
|
|
1571
1577
|
|
|
1572
1578
|
// src/openai-image-model.ts
|
|
1573
1579
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1574
|
-
var
|
|
1580
|
+
var import_v410 = require("zod/v4");
|
|
1575
1581
|
|
|
1576
1582
|
// src/openai-image-settings.ts
|
|
1577
1583
|
var modelMaxImagesPerCall = {
|
|
@@ -1659,9 +1665,9 @@ var OpenAIImageModel = class {
|
|
|
1659
1665
|
};
|
|
1660
1666
|
}
|
|
1661
1667
|
};
|
|
1662
|
-
var openaiImageResponseSchema =
|
|
1663
|
-
data:
|
|
1664
|
-
|
|
1668
|
+
var openaiImageResponseSchema = import_v410.z.object({
|
|
1669
|
+
data: import_v410.z.array(
|
|
1670
|
+
import_v410.z.object({ b64_json: import_v410.z.string(), revised_prompt: import_v410.z.string().optional() })
|
|
1665
1671
|
)
|
|
1666
1672
|
});
|
|
1667
1673
|
|
|
@@ -1673,33 +1679,33 @@ var openaiTools = {
|
|
|
1673
1679
|
|
|
1674
1680
|
// src/openai-transcription-model.ts
|
|
1675
1681
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1676
|
-
var
|
|
1682
|
+
var import_v412 = require("zod/v4");
|
|
1677
1683
|
|
|
1678
1684
|
// src/openai-transcription-options.ts
|
|
1679
|
-
var
|
|
1680
|
-
var openAITranscriptionProviderOptions =
|
|
1685
|
+
var import_v411 = require("zod/v4");
|
|
1686
|
+
var openAITranscriptionProviderOptions = import_v411.z.object({
|
|
1681
1687
|
/**
|
|
1682
1688
|
* Additional information to include in the transcription response.
|
|
1683
1689
|
*/
|
|
1684
|
-
include:
|
|
1690
|
+
include: import_v411.z.array(import_v411.z.string()).optional(),
|
|
1685
1691
|
/**
|
|
1686
1692
|
* The language of the input audio in ISO-639-1 format.
|
|
1687
1693
|
*/
|
|
1688
|
-
language:
|
|
1694
|
+
language: import_v411.z.string().optional(),
|
|
1689
1695
|
/**
|
|
1690
1696
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
1691
1697
|
*/
|
|
1692
|
-
prompt:
|
|
1698
|
+
prompt: import_v411.z.string().optional(),
|
|
1693
1699
|
/**
|
|
1694
1700
|
* The sampling temperature, between 0 and 1.
|
|
1695
1701
|
* @default 0
|
|
1696
1702
|
*/
|
|
1697
|
-
temperature:
|
|
1703
|
+
temperature: import_v411.z.number().min(0).max(1).default(0).optional(),
|
|
1698
1704
|
/**
|
|
1699
1705
|
* The timestamp granularities to populate for this transcription.
|
|
1700
1706
|
* @default ['segment']
|
|
1701
1707
|
*/
|
|
1702
|
-
timestampGranularities:
|
|
1708
|
+
timestampGranularities: import_v411.z.array(import_v411.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
1703
1709
|
});
|
|
1704
1710
|
|
|
1705
1711
|
// src/openai-transcription-model.ts
|
|
@@ -1847,22 +1853,22 @@ var OpenAITranscriptionModel = class {
|
|
|
1847
1853
|
};
|
|
1848
1854
|
}
|
|
1849
1855
|
};
|
|
1850
|
-
var openaiTranscriptionResponseSchema =
|
|
1851
|
-
text:
|
|
1852
|
-
language:
|
|
1853
|
-
duration:
|
|
1854
|
-
words:
|
|
1855
|
-
|
|
1856
|
-
word:
|
|
1857
|
-
start:
|
|
1858
|
-
end:
|
|
1856
|
+
var openaiTranscriptionResponseSchema = import_v412.z.object({
|
|
1857
|
+
text: import_v412.z.string(),
|
|
1858
|
+
language: import_v412.z.string().nullish(),
|
|
1859
|
+
duration: import_v412.z.number().nullish(),
|
|
1860
|
+
words: import_v412.z.array(
|
|
1861
|
+
import_v412.z.object({
|
|
1862
|
+
word: import_v412.z.string(),
|
|
1863
|
+
start: import_v412.z.number(),
|
|
1864
|
+
end: import_v412.z.number()
|
|
1859
1865
|
})
|
|
1860
1866
|
).nullish()
|
|
1861
1867
|
});
|
|
1862
1868
|
|
|
1863
1869
|
// src/responses/openai-responses-language-model.ts
|
|
1864
1870
|
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1865
|
-
var
|
|
1871
|
+
var import_v413 = require("zod/v4");
|
|
1866
1872
|
|
|
1867
1873
|
// src/responses/convert-to-openai-responses-messages.ts
|
|
1868
1874
|
var import_provider6 = require("@ai-sdk/provider");
|
|
@@ -2028,7 +2034,7 @@ var import_provider7 = require("@ai-sdk/provider");
|
|
|
2028
2034
|
function prepareResponsesTools({
|
|
2029
2035
|
tools,
|
|
2030
2036
|
toolChoice,
|
|
2031
|
-
|
|
2037
|
+
strictJsonSchema
|
|
2032
2038
|
}) {
|
|
2033
2039
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
2034
2040
|
const toolWarnings = [];
|
|
@@ -2044,7 +2050,7 @@ function prepareResponsesTools({
|
|
|
2044
2050
|
name: tool.name,
|
|
2045
2051
|
description: tool.description,
|
|
2046
2052
|
parameters: tool.inputSchema,
|
|
2047
|
-
strict:
|
|
2053
|
+
strict: strictJsonSchema
|
|
2048
2054
|
});
|
|
2049
2055
|
break;
|
|
2050
2056
|
case "provider-defined":
|
|
@@ -2152,7 +2158,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2152
2158
|
providerOptions,
|
|
2153
2159
|
schema: openaiResponsesProviderOptionsSchema
|
|
2154
2160
|
});
|
|
2155
|
-
const
|
|
2161
|
+
const strictJsonSchema = (_a = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _a : false;
|
|
2156
2162
|
const baseArgs = {
|
|
2157
2163
|
model: this.modelId,
|
|
2158
2164
|
input: messages,
|
|
@@ -2163,7 +2169,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2163
2169
|
text: {
|
|
2164
2170
|
format: responseFormat.schema != null ? {
|
|
2165
2171
|
type: "json_schema",
|
|
2166
|
-
strict:
|
|
2172
|
+
strict: strictJsonSchema,
|
|
2167
2173
|
name: (_b = responseFormat.name) != null ? _b : "response",
|
|
2168
2174
|
description: responseFormat.description,
|
|
2169
2175
|
schema: responseFormat.schema
|
|
@@ -2226,7 +2232,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2226
2232
|
} = prepareResponsesTools({
|
|
2227
2233
|
tools,
|
|
2228
2234
|
toolChoice,
|
|
2229
|
-
|
|
2235
|
+
strictJsonSchema
|
|
2230
2236
|
});
|
|
2231
2237
|
return {
|
|
2232
2238
|
args: {
|
|
@@ -2253,59 +2259,59 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2253
2259
|
body,
|
|
2254
2260
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2255
2261
|
successfulResponseHandler: (0, import_provider_utils10.createJsonResponseHandler)(
|
|
2256
|
-
|
|
2257
|
-
id:
|
|
2258
|
-
created_at:
|
|
2259
|
-
model:
|
|
2260
|
-
output:
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
type:
|
|
2264
|
-
role:
|
|
2265
|
-
content:
|
|
2266
|
-
|
|
2267
|
-
type:
|
|
2268
|
-
text:
|
|
2269
|
-
annotations:
|
|
2270
|
-
|
|
2271
|
-
type:
|
|
2272
|
-
start_index:
|
|
2273
|
-
end_index:
|
|
2274
|
-
url:
|
|
2275
|
-
title:
|
|
2262
|
+
import_v413.z.object({
|
|
2263
|
+
id: import_v413.z.string(),
|
|
2264
|
+
created_at: import_v413.z.number(),
|
|
2265
|
+
model: import_v413.z.string(),
|
|
2266
|
+
output: import_v413.z.array(
|
|
2267
|
+
import_v413.z.discriminatedUnion("type", [
|
|
2268
|
+
import_v413.z.object({
|
|
2269
|
+
type: import_v413.z.literal("message"),
|
|
2270
|
+
role: import_v413.z.literal("assistant"),
|
|
2271
|
+
content: import_v413.z.array(
|
|
2272
|
+
import_v413.z.object({
|
|
2273
|
+
type: import_v413.z.literal("output_text"),
|
|
2274
|
+
text: import_v413.z.string(),
|
|
2275
|
+
annotations: import_v413.z.array(
|
|
2276
|
+
import_v413.z.object({
|
|
2277
|
+
type: import_v413.z.literal("url_citation"),
|
|
2278
|
+
start_index: import_v413.z.number(),
|
|
2279
|
+
end_index: import_v413.z.number(),
|
|
2280
|
+
url: import_v413.z.string(),
|
|
2281
|
+
title: import_v413.z.string()
|
|
2276
2282
|
})
|
|
2277
2283
|
)
|
|
2278
2284
|
})
|
|
2279
2285
|
)
|
|
2280
2286
|
}),
|
|
2281
|
-
|
|
2282
|
-
type:
|
|
2283
|
-
call_id:
|
|
2284
|
-
name:
|
|
2285
|
-
arguments:
|
|
2287
|
+
import_v413.z.object({
|
|
2288
|
+
type: import_v413.z.literal("function_call"),
|
|
2289
|
+
call_id: import_v413.z.string(),
|
|
2290
|
+
name: import_v413.z.string(),
|
|
2291
|
+
arguments: import_v413.z.string()
|
|
2286
2292
|
}),
|
|
2287
|
-
|
|
2288
|
-
type:
|
|
2289
|
-
id:
|
|
2290
|
-
status:
|
|
2293
|
+
import_v413.z.object({
|
|
2294
|
+
type: import_v413.z.literal("web_search_call"),
|
|
2295
|
+
id: import_v413.z.string(),
|
|
2296
|
+
status: import_v413.z.string().optional()
|
|
2291
2297
|
}),
|
|
2292
|
-
|
|
2293
|
-
type:
|
|
2294
|
-
id:
|
|
2295
|
-
status:
|
|
2298
|
+
import_v413.z.object({
|
|
2299
|
+
type: import_v413.z.literal("computer_call"),
|
|
2300
|
+
id: import_v413.z.string(),
|
|
2301
|
+
status: import_v413.z.string().optional()
|
|
2296
2302
|
}),
|
|
2297
|
-
|
|
2298
|
-
type:
|
|
2299
|
-
summary:
|
|
2300
|
-
|
|
2301
|
-
type:
|
|
2302
|
-
text:
|
|
2303
|
+
import_v413.z.object({
|
|
2304
|
+
type: import_v413.z.literal("reasoning"),
|
|
2305
|
+
summary: import_v413.z.array(
|
|
2306
|
+
import_v413.z.object({
|
|
2307
|
+
type: import_v413.z.literal("summary_text"),
|
|
2308
|
+
text: import_v413.z.string()
|
|
2303
2309
|
})
|
|
2304
2310
|
)
|
|
2305
2311
|
})
|
|
2306
2312
|
])
|
|
2307
2313
|
),
|
|
2308
|
-
incomplete_details:
|
|
2314
|
+
incomplete_details: import_v413.z.object({ reason: import_v413.z.string() }).nullable(),
|
|
2309
2315
|
usage: usageSchema2
|
|
2310
2316
|
})
|
|
2311
2317
|
),
|
|
@@ -2646,124 +2652,124 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2646
2652
|
};
|
|
2647
2653
|
}
|
|
2648
2654
|
};
|
|
2649
|
-
var usageSchema2 =
|
|
2650
|
-
input_tokens:
|
|
2651
|
-
input_tokens_details:
|
|
2652
|
-
output_tokens:
|
|
2653
|
-
output_tokens_details:
|
|
2655
|
+
var usageSchema2 = import_v413.z.object({
|
|
2656
|
+
input_tokens: import_v413.z.number(),
|
|
2657
|
+
input_tokens_details: import_v413.z.object({ cached_tokens: import_v413.z.number().nullish() }).nullish(),
|
|
2658
|
+
output_tokens: import_v413.z.number(),
|
|
2659
|
+
output_tokens_details: import_v413.z.object({ reasoning_tokens: import_v413.z.number().nullish() }).nullish()
|
|
2654
2660
|
});
|
|
2655
|
-
var textDeltaChunkSchema =
|
|
2656
|
-
type:
|
|
2657
|
-
item_id:
|
|
2658
|
-
delta:
|
|
2661
|
+
var textDeltaChunkSchema = import_v413.z.object({
|
|
2662
|
+
type: import_v413.z.literal("response.output_text.delta"),
|
|
2663
|
+
item_id: import_v413.z.string(),
|
|
2664
|
+
delta: import_v413.z.string()
|
|
2659
2665
|
});
|
|
2660
|
-
var responseFinishedChunkSchema =
|
|
2661
|
-
type:
|
|
2662
|
-
response:
|
|
2663
|
-
incomplete_details:
|
|
2666
|
+
var responseFinishedChunkSchema = import_v413.z.object({
|
|
2667
|
+
type: import_v413.z.enum(["response.completed", "response.incomplete"]),
|
|
2668
|
+
response: import_v413.z.object({
|
|
2669
|
+
incomplete_details: import_v413.z.object({ reason: import_v413.z.string() }).nullish(),
|
|
2664
2670
|
usage: usageSchema2
|
|
2665
2671
|
})
|
|
2666
2672
|
});
|
|
2667
|
-
var responseCreatedChunkSchema =
|
|
2668
|
-
type:
|
|
2669
|
-
response:
|
|
2670
|
-
id:
|
|
2671
|
-
created_at:
|
|
2672
|
-
model:
|
|
2673
|
+
var responseCreatedChunkSchema = import_v413.z.object({
|
|
2674
|
+
type: import_v413.z.literal("response.created"),
|
|
2675
|
+
response: import_v413.z.object({
|
|
2676
|
+
id: import_v413.z.string(),
|
|
2677
|
+
created_at: import_v413.z.number(),
|
|
2678
|
+
model: import_v413.z.string()
|
|
2673
2679
|
})
|
|
2674
2680
|
});
|
|
2675
|
-
var responseOutputItemAddedSchema =
|
|
2676
|
-
type:
|
|
2677
|
-
output_index:
|
|
2678
|
-
item:
|
|
2679
|
-
|
|
2680
|
-
type:
|
|
2681
|
-
id:
|
|
2681
|
+
var responseOutputItemAddedSchema = import_v413.z.object({
|
|
2682
|
+
type: import_v413.z.literal("response.output_item.added"),
|
|
2683
|
+
output_index: import_v413.z.number(),
|
|
2684
|
+
item: import_v413.z.discriminatedUnion("type", [
|
|
2685
|
+
import_v413.z.object({
|
|
2686
|
+
type: import_v413.z.literal("message"),
|
|
2687
|
+
id: import_v413.z.string()
|
|
2682
2688
|
}),
|
|
2683
|
-
|
|
2684
|
-
type:
|
|
2685
|
-
id:
|
|
2689
|
+
import_v413.z.object({
|
|
2690
|
+
type: import_v413.z.literal("reasoning"),
|
|
2691
|
+
id: import_v413.z.string()
|
|
2686
2692
|
}),
|
|
2687
|
-
|
|
2688
|
-
type:
|
|
2689
|
-
id:
|
|
2690
|
-
call_id:
|
|
2691
|
-
name:
|
|
2692
|
-
arguments:
|
|
2693
|
+
import_v413.z.object({
|
|
2694
|
+
type: import_v413.z.literal("function_call"),
|
|
2695
|
+
id: import_v413.z.string(),
|
|
2696
|
+
call_id: import_v413.z.string(),
|
|
2697
|
+
name: import_v413.z.string(),
|
|
2698
|
+
arguments: import_v413.z.string()
|
|
2693
2699
|
}),
|
|
2694
|
-
|
|
2695
|
-
type:
|
|
2696
|
-
id:
|
|
2697
|
-
status:
|
|
2700
|
+
import_v413.z.object({
|
|
2701
|
+
type: import_v413.z.literal("web_search_call"),
|
|
2702
|
+
id: import_v413.z.string(),
|
|
2703
|
+
status: import_v413.z.string()
|
|
2698
2704
|
}),
|
|
2699
|
-
|
|
2700
|
-
type:
|
|
2701
|
-
id:
|
|
2702
|
-
status:
|
|
2705
|
+
import_v413.z.object({
|
|
2706
|
+
type: import_v413.z.literal("computer_call"),
|
|
2707
|
+
id: import_v413.z.string(),
|
|
2708
|
+
status: import_v413.z.string()
|
|
2703
2709
|
})
|
|
2704
2710
|
])
|
|
2705
2711
|
});
|
|
2706
|
-
var responseOutputItemDoneSchema =
|
|
2707
|
-
type:
|
|
2708
|
-
output_index:
|
|
2709
|
-
item:
|
|
2710
|
-
|
|
2711
|
-
type:
|
|
2712
|
-
id:
|
|
2712
|
+
var responseOutputItemDoneSchema = import_v413.z.object({
|
|
2713
|
+
type: import_v413.z.literal("response.output_item.done"),
|
|
2714
|
+
output_index: import_v413.z.number(),
|
|
2715
|
+
item: import_v413.z.discriminatedUnion("type", [
|
|
2716
|
+
import_v413.z.object({
|
|
2717
|
+
type: import_v413.z.literal("message"),
|
|
2718
|
+
id: import_v413.z.string()
|
|
2713
2719
|
}),
|
|
2714
|
-
|
|
2715
|
-
type:
|
|
2716
|
-
id:
|
|
2720
|
+
import_v413.z.object({
|
|
2721
|
+
type: import_v413.z.literal("reasoning"),
|
|
2722
|
+
id: import_v413.z.string()
|
|
2717
2723
|
}),
|
|
2718
|
-
|
|
2719
|
-
type:
|
|
2720
|
-
id:
|
|
2721
|
-
call_id:
|
|
2722
|
-
name:
|
|
2723
|
-
arguments:
|
|
2724
|
-
status:
|
|
2724
|
+
import_v413.z.object({
|
|
2725
|
+
type: import_v413.z.literal("function_call"),
|
|
2726
|
+
id: import_v413.z.string(),
|
|
2727
|
+
call_id: import_v413.z.string(),
|
|
2728
|
+
name: import_v413.z.string(),
|
|
2729
|
+
arguments: import_v413.z.string(),
|
|
2730
|
+
status: import_v413.z.literal("completed")
|
|
2725
2731
|
}),
|
|
2726
|
-
|
|
2727
|
-
type:
|
|
2728
|
-
id:
|
|
2729
|
-
status:
|
|
2732
|
+
import_v413.z.object({
|
|
2733
|
+
type: import_v413.z.literal("web_search_call"),
|
|
2734
|
+
id: import_v413.z.string(),
|
|
2735
|
+
status: import_v413.z.literal("completed")
|
|
2730
2736
|
}),
|
|
2731
|
-
|
|
2732
|
-
type:
|
|
2733
|
-
id:
|
|
2734
|
-
status:
|
|
2737
|
+
import_v413.z.object({
|
|
2738
|
+
type: import_v413.z.literal("computer_call"),
|
|
2739
|
+
id: import_v413.z.string(),
|
|
2740
|
+
status: import_v413.z.literal("completed")
|
|
2735
2741
|
})
|
|
2736
2742
|
])
|
|
2737
2743
|
});
|
|
2738
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
2739
|
-
type:
|
|
2740
|
-
item_id:
|
|
2741
|
-
output_index:
|
|
2742
|
-
delta:
|
|
2744
|
+
var responseFunctionCallArgumentsDeltaSchema = import_v413.z.object({
|
|
2745
|
+
type: import_v413.z.literal("response.function_call_arguments.delta"),
|
|
2746
|
+
item_id: import_v413.z.string(),
|
|
2747
|
+
output_index: import_v413.z.number(),
|
|
2748
|
+
delta: import_v413.z.string()
|
|
2743
2749
|
});
|
|
2744
|
-
var responseAnnotationAddedSchema =
|
|
2745
|
-
type:
|
|
2746
|
-
annotation:
|
|
2747
|
-
type:
|
|
2748
|
-
url:
|
|
2749
|
-
title:
|
|
2750
|
+
var responseAnnotationAddedSchema = import_v413.z.object({
|
|
2751
|
+
type: import_v413.z.literal("response.output_text.annotation.added"),
|
|
2752
|
+
annotation: import_v413.z.object({
|
|
2753
|
+
type: import_v413.z.literal("url_citation"),
|
|
2754
|
+
url: import_v413.z.string(),
|
|
2755
|
+
title: import_v413.z.string()
|
|
2750
2756
|
})
|
|
2751
2757
|
});
|
|
2752
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
2753
|
-
type:
|
|
2754
|
-
item_id:
|
|
2755
|
-
output_index:
|
|
2756
|
-
summary_index:
|
|
2757
|
-
delta:
|
|
2758
|
+
var responseReasoningSummaryTextDeltaSchema = import_v413.z.object({
|
|
2759
|
+
type: import_v413.z.literal("response.reasoning_summary_text.delta"),
|
|
2760
|
+
item_id: import_v413.z.string(),
|
|
2761
|
+
output_index: import_v413.z.number(),
|
|
2762
|
+
summary_index: import_v413.z.number(),
|
|
2763
|
+
delta: import_v413.z.string()
|
|
2758
2764
|
});
|
|
2759
|
-
var responseReasoningSummaryPartDoneSchema =
|
|
2760
|
-
type:
|
|
2761
|
-
item_id:
|
|
2762
|
-
output_index:
|
|
2763
|
-
summary_index:
|
|
2764
|
-
part:
|
|
2765
|
+
var responseReasoningSummaryPartDoneSchema = import_v413.z.object({
|
|
2766
|
+
type: import_v413.z.literal("response.reasoning_summary_part.done"),
|
|
2767
|
+
item_id: import_v413.z.string(),
|
|
2768
|
+
output_index: import_v413.z.number(),
|
|
2769
|
+
summary_index: import_v413.z.number(),
|
|
2770
|
+
part: import_v413.z.unknown().nullish()
|
|
2765
2771
|
});
|
|
2766
|
-
var openaiResponsesChunkSchema =
|
|
2772
|
+
var openaiResponsesChunkSchema = import_v413.z.union([
|
|
2767
2773
|
textDeltaChunkSchema,
|
|
2768
2774
|
responseFinishedChunkSchema,
|
|
2769
2775
|
responseCreatedChunkSchema,
|
|
@@ -2773,7 +2779,7 @@ var openaiResponsesChunkSchema = import_zod13.z.union([
|
|
|
2773
2779
|
responseAnnotationAddedSchema,
|
|
2774
2780
|
responseReasoningSummaryTextDeltaSchema,
|
|
2775
2781
|
responseReasoningSummaryPartDoneSchema,
|
|
2776
|
-
|
|
2782
|
+
import_v413.z.object({ type: import_v413.z.string() }).passthrough()
|
|
2777
2783
|
// fallback for unknown chunks
|
|
2778
2784
|
]);
|
|
2779
2785
|
function isTextDeltaChunk(chunk) {
|
|
@@ -2824,25 +2830,25 @@ function getResponsesModelConfig(modelId) {
|
|
|
2824
2830
|
function supportsFlexProcessing2(modelId) {
|
|
2825
2831
|
return modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
2826
2832
|
}
|
|
2827
|
-
var openaiResponsesProviderOptionsSchema =
|
|
2828
|
-
metadata:
|
|
2829
|
-
parallelToolCalls:
|
|
2830
|
-
previousResponseId:
|
|
2831
|
-
store:
|
|
2832
|
-
user:
|
|
2833
|
-
reasoningEffort:
|
|
2834
|
-
|
|
2835
|
-
instructions:
|
|
2836
|
-
reasoningSummary:
|
|
2837
|
-
serviceTier:
|
|
2833
|
+
var openaiResponsesProviderOptionsSchema = import_v413.z.object({
|
|
2834
|
+
metadata: import_v413.z.any().nullish(),
|
|
2835
|
+
parallelToolCalls: import_v413.z.boolean().nullish(),
|
|
2836
|
+
previousResponseId: import_v413.z.string().nullish(),
|
|
2837
|
+
store: import_v413.z.boolean().nullish(),
|
|
2838
|
+
user: import_v413.z.string().nullish(),
|
|
2839
|
+
reasoningEffort: import_v413.z.string().nullish(),
|
|
2840
|
+
strictJsonSchema: import_v413.z.boolean().nullish(),
|
|
2841
|
+
instructions: import_v413.z.string().nullish(),
|
|
2842
|
+
reasoningSummary: import_v413.z.string().nullish(),
|
|
2843
|
+
serviceTier: import_v413.z.enum(["auto", "flex"]).nullish()
|
|
2838
2844
|
});
|
|
2839
2845
|
|
|
2840
2846
|
// src/openai-speech-model.ts
|
|
2841
2847
|
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
2842
|
-
var
|
|
2843
|
-
var OpenAIProviderOptionsSchema =
|
|
2844
|
-
instructions:
|
|
2845
|
-
speed:
|
|
2848
|
+
var import_v414 = require("zod/v4");
|
|
2849
|
+
var OpenAIProviderOptionsSchema = import_v414.z.object({
|
|
2850
|
+
instructions: import_v414.z.string().nullish(),
|
|
2851
|
+
speed: import_v414.z.number().min(0.25).max(4).default(1).nullish()
|
|
2846
2852
|
});
|
|
2847
2853
|
var OpenAISpeechModel = class {
|
|
2848
2854
|
constructor(modelId, config) {
|