@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/internal/index.js
CHANGED
|
@@ -39,7 +39,7 @@ module.exports = __toCommonJS(internal_exports);
|
|
|
39
39
|
// src/openai-chat-language-model.ts
|
|
40
40
|
var import_provider3 = require("@ai-sdk/provider");
|
|
41
41
|
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
42
|
-
var
|
|
42
|
+
var import_v45 = require("zod/v4");
|
|
43
43
|
|
|
44
44
|
// src/convert-to-openai-chat-messages.ts
|
|
45
45
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -250,15 +250,15 @@ function mapOpenAIFinishReason(finishReason) {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
// src/openai-chat-options.ts
|
|
253
|
-
var
|
|
254
|
-
var openaiProviderOptions =
|
|
253
|
+
var import_v4 = require("zod/v4");
|
|
254
|
+
var openaiProviderOptions = import_v4.z.object({
|
|
255
255
|
/**
|
|
256
256
|
* Modify the likelihood of specified tokens appearing in the completion.
|
|
257
257
|
*
|
|
258
258
|
* Accepts a JSON object that maps tokens (specified by their token ID in
|
|
259
259
|
* the GPT tokenizer) to an associated bias value from -100 to 100.
|
|
260
260
|
*/
|
|
261
|
-
logitBias:
|
|
261
|
+
logitBias: import_v4.z.record(import_v4.z.coerce.number(), import_v4.z.number()).optional(),
|
|
262
262
|
/**
|
|
263
263
|
* Return the log probabilities of the tokens.
|
|
264
264
|
*
|
|
@@ -268,63 +268,69 @@ var openaiProviderOptions = import_zod.z.object({
|
|
|
268
268
|
* Setting to a number will return the log probabilities of the top n
|
|
269
269
|
* tokens that were generated.
|
|
270
270
|
*/
|
|
271
|
-
logprobs:
|
|
271
|
+
logprobs: import_v4.z.union([import_v4.z.boolean(), import_v4.z.number()]).optional(),
|
|
272
272
|
/**
|
|
273
273
|
* Whether to enable parallel function calling during tool use. Default to true.
|
|
274
274
|
*/
|
|
275
|
-
parallelToolCalls:
|
|
275
|
+
parallelToolCalls: import_v4.z.boolean().optional(),
|
|
276
276
|
/**
|
|
277
277
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
278
278
|
* monitor and detect abuse.
|
|
279
279
|
*/
|
|
280
|
-
user:
|
|
280
|
+
user: import_v4.z.string().optional(),
|
|
281
281
|
/**
|
|
282
282
|
* Reasoning effort for reasoning models. Defaults to `medium`.
|
|
283
283
|
*/
|
|
284
|
-
reasoningEffort:
|
|
284
|
+
reasoningEffort: import_v4.z.enum(["low", "medium", "high"]).optional(),
|
|
285
285
|
/**
|
|
286
286
|
* Maximum number of completion tokens to generate. Useful for reasoning models.
|
|
287
287
|
*/
|
|
288
|
-
maxCompletionTokens:
|
|
288
|
+
maxCompletionTokens: import_v4.z.number().optional(),
|
|
289
289
|
/**
|
|
290
290
|
* Whether to enable persistence in responses API.
|
|
291
291
|
*/
|
|
292
|
-
store:
|
|
292
|
+
store: import_v4.z.boolean().optional(),
|
|
293
293
|
/**
|
|
294
294
|
* Metadata to associate with the request.
|
|
295
295
|
*/
|
|
296
|
-
metadata:
|
|
296
|
+
metadata: import_v4.z.record(import_v4.z.string().max(64), import_v4.z.string().max(512)).optional(),
|
|
297
297
|
/**
|
|
298
298
|
* Parameters for prediction mode.
|
|
299
299
|
*/
|
|
300
|
-
prediction:
|
|
300
|
+
prediction: import_v4.z.record(import_v4.z.string(), import_v4.z.any()).optional(),
|
|
301
301
|
/**
|
|
302
302
|
* Whether to use structured outputs.
|
|
303
303
|
*
|
|
304
304
|
* @default true
|
|
305
305
|
*/
|
|
306
|
-
structuredOutputs:
|
|
306
|
+
structuredOutputs: import_v4.z.boolean().optional(),
|
|
307
307
|
/**
|
|
308
308
|
* Service tier for the request. Set to 'flex' for 50% cheaper processing
|
|
309
309
|
* at the cost of increased latency. Only available for o3 and o4-mini models.
|
|
310
310
|
*
|
|
311
311
|
* @default 'auto'
|
|
312
312
|
*/
|
|
313
|
-
serviceTier:
|
|
313
|
+
serviceTier: import_v4.z.enum(["auto", "flex"]).optional(),
|
|
314
|
+
/**
|
|
315
|
+
* Whether to use strict JSON schema validation.
|
|
316
|
+
*
|
|
317
|
+
* @default true
|
|
318
|
+
*/
|
|
319
|
+
strictJsonSchema: import_v4.z.boolean().optional()
|
|
314
320
|
});
|
|
315
321
|
|
|
316
322
|
// src/openai-error.ts
|
|
317
|
-
var
|
|
323
|
+
var import_v42 = require("zod/v4");
|
|
318
324
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
319
|
-
var openaiErrorDataSchema =
|
|
320
|
-
error:
|
|
321
|
-
message:
|
|
325
|
+
var openaiErrorDataSchema = import_v42.z.object({
|
|
326
|
+
error: import_v42.z.object({
|
|
327
|
+
message: import_v42.z.string(),
|
|
322
328
|
// The additional information below is handled loosely to support
|
|
323
329
|
// OpenAI-compatible providers that have slightly different error
|
|
324
330
|
// responses:
|
|
325
|
-
type:
|
|
326
|
-
param:
|
|
327
|
-
code:
|
|
331
|
+
type: import_v42.z.string().nullish(),
|
|
332
|
+
param: import_v42.z.any().nullish(),
|
|
333
|
+
code: import_v42.z.union([import_v42.z.string(), import_v42.z.number()]).nullish()
|
|
328
334
|
})
|
|
329
335
|
});
|
|
330
336
|
var openaiFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResponseHandler)({
|
|
@@ -337,77 +343,78 @@ var import_provider2 = require("@ai-sdk/provider");
|
|
|
337
343
|
|
|
338
344
|
// src/tool/file-search.ts
|
|
339
345
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
340
|
-
var
|
|
341
|
-
var fileSearchArgsSchema =
|
|
346
|
+
var import_v43 = require("zod/v4");
|
|
347
|
+
var fileSearchArgsSchema = import_v43.z.object({
|
|
342
348
|
/**
|
|
343
349
|
* List of vector store IDs to search through. If not provided, searches all available vector stores.
|
|
344
350
|
*/
|
|
345
|
-
vectorStoreIds:
|
|
351
|
+
vectorStoreIds: import_v43.z.array(import_v43.z.string()).optional(),
|
|
346
352
|
/**
|
|
347
353
|
* Maximum number of search results to return. Defaults to 10.
|
|
348
354
|
*/
|
|
349
|
-
maxResults:
|
|
355
|
+
maxResults: import_v43.z.number().optional(),
|
|
350
356
|
/**
|
|
351
357
|
* Type of search to perform. Defaults to 'auto'.
|
|
352
358
|
*/
|
|
353
|
-
searchType:
|
|
359
|
+
searchType: import_v43.z.enum(["auto", "keyword", "semantic"]).optional()
|
|
354
360
|
});
|
|
355
361
|
var fileSearch = (0, import_provider_utils3.createProviderDefinedToolFactory)({
|
|
356
362
|
id: "openai.file_search",
|
|
357
363
|
name: "file_search",
|
|
358
|
-
inputSchema:
|
|
359
|
-
query:
|
|
364
|
+
inputSchema: import_v43.z.object({
|
|
365
|
+
query: import_v43.z.string()
|
|
360
366
|
})
|
|
361
367
|
});
|
|
362
368
|
|
|
363
369
|
// src/tool/web-search-preview.ts
|
|
364
370
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
365
|
-
var
|
|
366
|
-
var webSearchPreviewArgsSchema =
|
|
371
|
+
var import_v44 = require("zod/v4");
|
|
372
|
+
var webSearchPreviewArgsSchema = import_v44.z.object({
|
|
367
373
|
/**
|
|
368
374
|
* Search context size to use for the web search.
|
|
369
375
|
* - high: Most comprehensive context, highest cost, slower response
|
|
370
376
|
* - medium: Balanced context, cost, and latency (default)
|
|
371
377
|
* - low: Least context, lowest cost, fastest response
|
|
372
378
|
*/
|
|
373
|
-
searchContextSize:
|
|
379
|
+
searchContextSize: import_v44.z.enum(["low", "medium", "high"]).optional(),
|
|
374
380
|
/**
|
|
375
381
|
* User location information to provide geographically relevant search results.
|
|
376
382
|
*/
|
|
377
|
-
userLocation:
|
|
383
|
+
userLocation: import_v44.z.object({
|
|
378
384
|
/**
|
|
379
385
|
* Type of location (always 'approximate')
|
|
380
386
|
*/
|
|
381
|
-
type:
|
|
387
|
+
type: import_v44.z.literal("approximate"),
|
|
382
388
|
/**
|
|
383
389
|
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
384
390
|
*/
|
|
385
|
-
country:
|
|
391
|
+
country: import_v44.z.string().optional(),
|
|
386
392
|
/**
|
|
387
393
|
* City name (free text, e.g., 'Minneapolis')
|
|
388
394
|
*/
|
|
389
|
-
city:
|
|
395
|
+
city: import_v44.z.string().optional(),
|
|
390
396
|
/**
|
|
391
397
|
* Region name (free text, e.g., 'Minnesota')
|
|
392
398
|
*/
|
|
393
|
-
region:
|
|
399
|
+
region: import_v44.z.string().optional(),
|
|
394
400
|
/**
|
|
395
401
|
* IANA timezone (e.g., 'America/Chicago')
|
|
396
402
|
*/
|
|
397
|
-
timezone:
|
|
403
|
+
timezone: import_v44.z.string().optional()
|
|
398
404
|
}).optional()
|
|
399
405
|
});
|
|
400
406
|
var webSearchPreview = (0, import_provider_utils4.createProviderDefinedToolFactory)({
|
|
401
407
|
id: "openai.web_search_preview",
|
|
402
408
|
name: "web_search_preview",
|
|
403
|
-
inputSchema:
|
|
409
|
+
inputSchema: import_v44.z.object({})
|
|
404
410
|
});
|
|
405
411
|
|
|
406
412
|
// src/openai-prepare-tools.ts
|
|
407
413
|
function prepareTools({
|
|
408
414
|
tools,
|
|
409
415
|
toolChoice,
|
|
410
|
-
structuredOutputs
|
|
416
|
+
structuredOutputs,
|
|
417
|
+
strictJsonSchema
|
|
411
418
|
}) {
|
|
412
419
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
413
420
|
const toolWarnings = [];
|
|
@@ -424,7 +431,7 @@ function prepareTools({
|
|
|
424
431
|
name: tool.name,
|
|
425
432
|
description: tool.description,
|
|
426
433
|
parameters: tool.inputSchema,
|
|
427
|
-
strict: structuredOutputs ?
|
|
434
|
+
strict: structuredOutputs ? strictJsonSchema : void 0
|
|
428
435
|
}
|
|
429
436
|
});
|
|
430
437
|
break;
|
|
@@ -516,7 +523,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
516
523
|
toolChoice,
|
|
517
524
|
providerOptions
|
|
518
525
|
}) {
|
|
519
|
-
var _a, _b, _c;
|
|
526
|
+
var _a, _b, _c, _d;
|
|
520
527
|
const warnings = [];
|
|
521
528
|
const openaiOptions = (_a = await (0, import_provider_utils5.parseProviderOptions)({
|
|
522
529
|
provider: "openai",
|
|
@@ -544,6 +551,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
544
551
|
}
|
|
545
552
|
);
|
|
546
553
|
warnings.push(...messageWarnings);
|
|
554
|
+
const strictJsonSchema = (_c = openaiOptions.strictJsonSchema) != null ? _c : false;
|
|
547
555
|
const baseArgs = {
|
|
548
556
|
// model id:
|
|
549
557
|
model: this.modelId,
|
|
@@ -559,18 +567,15 @@ var OpenAIChatLanguageModel = class {
|
|
|
559
567
|
top_p: topP,
|
|
560
568
|
frequency_penalty: frequencyPenalty,
|
|
561
569
|
presence_penalty: presencePenalty,
|
|
562
|
-
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ?
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}
|
|
572
|
-
} : { type: "json_object" }
|
|
573
|
-
) : void 0,
|
|
570
|
+
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? structuredOutputs && responseFormat.schema != null ? {
|
|
571
|
+
type: "json_schema",
|
|
572
|
+
json_schema: {
|
|
573
|
+
schema: responseFormat.schema,
|
|
574
|
+
strict: strictJsonSchema,
|
|
575
|
+
name: (_d = responseFormat.name) != null ? _d : "response",
|
|
576
|
+
description: responseFormat.description
|
|
577
|
+
}
|
|
578
|
+
} : { type: "json_object" } : void 0,
|
|
574
579
|
stop: stopSequences,
|
|
575
580
|
seed,
|
|
576
581
|
// openai specific settings:
|
|
@@ -669,7 +674,8 @@ var OpenAIChatLanguageModel = class {
|
|
|
669
674
|
} = prepareTools({
|
|
670
675
|
tools,
|
|
671
676
|
toolChoice,
|
|
672
|
-
structuredOutputs
|
|
677
|
+
structuredOutputs,
|
|
678
|
+
strictJsonSchema
|
|
673
679
|
});
|
|
674
680
|
return {
|
|
675
681
|
args: {
|
|
@@ -951,97 +957,97 @@ var OpenAIChatLanguageModel = class {
|
|
|
951
957
|
};
|
|
952
958
|
}
|
|
953
959
|
};
|
|
954
|
-
var openaiTokenUsageSchema =
|
|
955
|
-
prompt_tokens:
|
|
956
|
-
completion_tokens:
|
|
957
|
-
total_tokens:
|
|
958
|
-
prompt_tokens_details:
|
|
959
|
-
cached_tokens:
|
|
960
|
+
var openaiTokenUsageSchema = import_v45.z.object({
|
|
961
|
+
prompt_tokens: import_v45.z.number().nullish(),
|
|
962
|
+
completion_tokens: import_v45.z.number().nullish(),
|
|
963
|
+
total_tokens: import_v45.z.number().nullish(),
|
|
964
|
+
prompt_tokens_details: import_v45.z.object({
|
|
965
|
+
cached_tokens: import_v45.z.number().nullish()
|
|
960
966
|
}).nullish(),
|
|
961
|
-
completion_tokens_details:
|
|
962
|
-
reasoning_tokens:
|
|
963
|
-
accepted_prediction_tokens:
|
|
964
|
-
rejected_prediction_tokens:
|
|
967
|
+
completion_tokens_details: import_v45.z.object({
|
|
968
|
+
reasoning_tokens: import_v45.z.number().nullish(),
|
|
969
|
+
accepted_prediction_tokens: import_v45.z.number().nullish(),
|
|
970
|
+
rejected_prediction_tokens: import_v45.z.number().nullish()
|
|
965
971
|
}).nullish()
|
|
966
972
|
}).nullish();
|
|
967
|
-
var openaiChatResponseSchema =
|
|
968
|
-
id:
|
|
969
|
-
created:
|
|
970
|
-
model:
|
|
971
|
-
choices:
|
|
972
|
-
|
|
973
|
-
message:
|
|
974
|
-
role:
|
|
975
|
-
content:
|
|
976
|
-
tool_calls:
|
|
977
|
-
|
|
978
|
-
id:
|
|
979
|
-
type:
|
|
980
|
-
function:
|
|
981
|
-
name:
|
|
982
|
-
arguments:
|
|
973
|
+
var openaiChatResponseSchema = import_v45.z.object({
|
|
974
|
+
id: import_v45.z.string().nullish(),
|
|
975
|
+
created: import_v45.z.number().nullish(),
|
|
976
|
+
model: import_v45.z.string().nullish(),
|
|
977
|
+
choices: import_v45.z.array(
|
|
978
|
+
import_v45.z.object({
|
|
979
|
+
message: import_v45.z.object({
|
|
980
|
+
role: import_v45.z.literal("assistant").nullish(),
|
|
981
|
+
content: import_v45.z.string().nullish(),
|
|
982
|
+
tool_calls: import_v45.z.array(
|
|
983
|
+
import_v45.z.object({
|
|
984
|
+
id: import_v45.z.string().nullish(),
|
|
985
|
+
type: import_v45.z.literal("function"),
|
|
986
|
+
function: import_v45.z.object({
|
|
987
|
+
name: import_v45.z.string(),
|
|
988
|
+
arguments: import_v45.z.string()
|
|
983
989
|
})
|
|
984
990
|
})
|
|
985
991
|
).nullish()
|
|
986
992
|
}),
|
|
987
|
-
index:
|
|
988
|
-
logprobs:
|
|
989
|
-
content:
|
|
990
|
-
|
|
991
|
-
token:
|
|
992
|
-
logprob:
|
|
993
|
-
top_logprobs:
|
|
994
|
-
|
|
995
|
-
token:
|
|
996
|
-
logprob:
|
|
993
|
+
index: import_v45.z.number(),
|
|
994
|
+
logprobs: import_v45.z.object({
|
|
995
|
+
content: import_v45.z.array(
|
|
996
|
+
import_v45.z.object({
|
|
997
|
+
token: import_v45.z.string(),
|
|
998
|
+
logprob: import_v45.z.number(),
|
|
999
|
+
top_logprobs: import_v45.z.array(
|
|
1000
|
+
import_v45.z.object({
|
|
1001
|
+
token: import_v45.z.string(),
|
|
1002
|
+
logprob: import_v45.z.number()
|
|
997
1003
|
})
|
|
998
1004
|
)
|
|
999
1005
|
})
|
|
1000
1006
|
).nullish()
|
|
1001
1007
|
}).nullish(),
|
|
1002
|
-
finish_reason:
|
|
1008
|
+
finish_reason: import_v45.z.string().nullish()
|
|
1003
1009
|
})
|
|
1004
1010
|
),
|
|
1005
1011
|
usage: openaiTokenUsageSchema
|
|
1006
1012
|
});
|
|
1007
|
-
var openaiChatChunkSchema =
|
|
1008
|
-
|
|
1009
|
-
id:
|
|
1010
|
-
created:
|
|
1011
|
-
model:
|
|
1012
|
-
choices:
|
|
1013
|
-
|
|
1014
|
-
delta:
|
|
1015
|
-
role:
|
|
1016
|
-
content:
|
|
1017
|
-
tool_calls:
|
|
1018
|
-
|
|
1019
|
-
index:
|
|
1020
|
-
id:
|
|
1021
|
-
type:
|
|
1022
|
-
function:
|
|
1023
|
-
name:
|
|
1024
|
-
arguments:
|
|
1013
|
+
var openaiChatChunkSchema = import_v45.z.union([
|
|
1014
|
+
import_v45.z.object({
|
|
1015
|
+
id: import_v45.z.string().nullish(),
|
|
1016
|
+
created: import_v45.z.number().nullish(),
|
|
1017
|
+
model: import_v45.z.string().nullish(),
|
|
1018
|
+
choices: import_v45.z.array(
|
|
1019
|
+
import_v45.z.object({
|
|
1020
|
+
delta: import_v45.z.object({
|
|
1021
|
+
role: import_v45.z.enum(["assistant"]).nullish(),
|
|
1022
|
+
content: import_v45.z.string().nullish(),
|
|
1023
|
+
tool_calls: import_v45.z.array(
|
|
1024
|
+
import_v45.z.object({
|
|
1025
|
+
index: import_v45.z.number(),
|
|
1026
|
+
id: import_v45.z.string().nullish(),
|
|
1027
|
+
type: import_v45.z.literal("function").nullish(),
|
|
1028
|
+
function: import_v45.z.object({
|
|
1029
|
+
name: import_v45.z.string().nullish(),
|
|
1030
|
+
arguments: import_v45.z.string().nullish()
|
|
1025
1031
|
})
|
|
1026
1032
|
})
|
|
1027
1033
|
).nullish()
|
|
1028
1034
|
}).nullish(),
|
|
1029
|
-
logprobs:
|
|
1030
|
-
content:
|
|
1031
|
-
|
|
1032
|
-
token:
|
|
1033
|
-
logprob:
|
|
1034
|
-
top_logprobs:
|
|
1035
|
-
|
|
1036
|
-
token:
|
|
1037
|
-
logprob:
|
|
1035
|
+
logprobs: import_v45.z.object({
|
|
1036
|
+
content: import_v45.z.array(
|
|
1037
|
+
import_v45.z.object({
|
|
1038
|
+
token: import_v45.z.string(),
|
|
1039
|
+
logprob: import_v45.z.number(),
|
|
1040
|
+
top_logprobs: import_v45.z.array(
|
|
1041
|
+
import_v45.z.object({
|
|
1042
|
+
token: import_v45.z.string(),
|
|
1043
|
+
logprob: import_v45.z.number()
|
|
1038
1044
|
})
|
|
1039
1045
|
)
|
|
1040
1046
|
})
|
|
1041
1047
|
).nullish()
|
|
1042
1048
|
}).nullish(),
|
|
1043
|
-
finish_reason:
|
|
1044
|
-
index:
|
|
1049
|
+
finish_reason: import_v45.z.string().nullish(),
|
|
1050
|
+
index: import_v45.z.number()
|
|
1045
1051
|
})
|
|
1046
1052
|
),
|
|
1047
1053
|
usage: openaiTokenUsageSchema
|
|
@@ -1096,7 +1102,7 @@ var reasoningModels = {
|
|
|
1096
1102
|
|
|
1097
1103
|
// src/openai-completion-language-model.ts
|
|
1098
1104
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
1099
|
-
var
|
|
1105
|
+
var import_v47 = require("zod/v4");
|
|
1100
1106
|
|
|
1101
1107
|
// src/convert-to-openai-completion-prompt.ts
|
|
1102
1108
|
var import_provider4 = require("@ai-sdk/provider");
|
|
@@ -1174,12 +1180,12 @@ ${user}:`]
|
|
|
1174
1180
|
}
|
|
1175
1181
|
|
|
1176
1182
|
// src/openai-completion-options.ts
|
|
1177
|
-
var
|
|
1178
|
-
var openaiCompletionProviderOptions =
|
|
1183
|
+
var import_v46 = require("zod/v4");
|
|
1184
|
+
var openaiCompletionProviderOptions = import_v46.z.object({
|
|
1179
1185
|
/**
|
|
1180
1186
|
Echo back the prompt in addition to the completion.
|
|
1181
1187
|
*/
|
|
1182
|
-
echo:
|
|
1188
|
+
echo: import_v46.z.boolean().optional(),
|
|
1183
1189
|
/**
|
|
1184
1190
|
Modify the likelihood of specified tokens appearing in the completion.
|
|
1185
1191
|
|
|
@@ -1194,16 +1200,16 @@ var openaiCompletionProviderOptions = import_zod6.z.object({
|
|
|
1194
1200
|
As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
|
|
1195
1201
|
token from being generated.
|
|
1196
1202
|
*/
|
|
1197
|
-
logitBias:
|
|
1203
|
+
logitBias: import_v46.z.record(import_v46.z.string(), import_v46.z.number()).optional(),
|
|
1198
1204
|
/**
|
|
1199
1205
|
The suffix that comes after a completion of inserted text.
|
|
1200
1206
|
*/
|
|
1201
|
-
suffix:
|
|
1207
|
+
suffix: import_v46.z.string().optional(),
|
|
1202
1208
|
/**
|
|
1203
1209
|
A unique identifier representing your end-user, which can help OpenAI to
|
|
1204
1210
|
monitor and detect abuse. Learn more.
|
|
1205
1211
|
*/
|
|
1206
|
-
user:
|
|
1212
|
+
user: import_v46.z.string().optional(),
|
|
1207
1213
|
/**
|
|
1208
1214
|
Return the log probabilities of the tokens. Including logprobs will increase
|
|
1209
1215
|
the response size and can slow down response times. However, it can
|
|
@@ -1213,7 +1219,7 @@ var openaiCompletionProviderOptions = import_zod6.z.object({
|
|
|
1213
1219
|
Setting to a number will return the log probabilities of the top n
|
|
1214
1220
|
tokens that were generated.
|
|
1215
1221
|
*/
|
|
1216
|
-
logprobs:
|
|
1222
|
+
logprobs: import_v46.z.union([import_v46.z.boolean(), import_v46.z.number()]).optional()
|
|
1217
1223
|
});
|
|
1218
1224
|
|
|
1219
1225
|
// src/openai-completion-language-model.ts
|
|
@@ -1445,42 +1451,42 @@ var OpenAICompletionLanguageModel = class {
|
|
|
1445
1451
|
};
|
|
1446
1452
|
}
|
|
1447
1453
|
};
|
|
1448
|
-
var usageSchema =
|
|
1449
|
-
prompt_tokens:
|
|
1450
|
-
completion_tokens:
|
|
1451
|
-
total_tokens:
|
|
1454
|
+
var usageSchema = import_v47.z.object({
|
|
1455
|
+
prompt_tokens: import_v47.z.number(),
|
|
1456
|
+
completion_tokens: import_v47.z.number(),
|
|
1457
|
+
total_tokens: import_v47.z.number()
|
|
1452
1458
|
});
|
|
1453
|
-
var openaiCompletionResponseSchema =
|
|
1454
|
-
id:
|
|
1455
|
-
created:
|
|
1456
|
-
model:
|
|
1457
|
-
choices:
|
|
1458
|
-
|
|
1459
|
-
text:
|
|
1460
|
-
finish_reason:
|
|
1461
|
-
logprobs:
|
|
1462
|
-
tokens:
|
|
1463
|
-
token_logprobs:
|
|
1464
|
-
top_logprobs:
|
|
1459
|
+
var openaiCompletionResponseSchema = import_v47.z.object({
|
|
1460
|
+
id: import_v47.z.string().nullish(),
|
|
1461
|
+
created: import_v47.z.number().nullish(),
|
|
1462
|
+
model: import_v47.z.string().nullish(),
|
|
1463
|
+
choices: import_v47.z.array(
|
|
1464
|
+
import_v47.z.object({
|
|
1465
|
+
text: import_v47.z.string(),
|
|
1466
|
+
finish_reason: import_v47.z.string(),
|
|
1467
|
+
logprobs: import_v47.z.object({
|
|
1468
|
+
tokens: import_v47.z.array(import_v47.z.string()),
|
|
1469
|
+
token_logprobs: import_v47.z.array(import_v47.z.number()),
|
|
1470
|
+
top_logprobs: import_v47.z.array(import_v47.z.record(import_v47.z.string(), import_v47.z.number())).nullish()
|
|
1465
1471
|
}).nullish()
|
|
1466
1472
|
})
|
|
1467
1473
|
),
|
|
1468
1474
|
usage: usageSchema.nullish()
|
|
1469
1475
|
});
|
|
1470
|
-
var openaiCompletionChunkSchema =
|
|
1471
|
-
|
|
1472
|
-
id:
|
|
1473
|
-
created:
|
|
1474
|
-
model:
|
|
1475
|
-
choices:
|
|
1476
|
-
|
|
1477
|
-
text:
|
|
1478
|
-
finish_reason:
|
|
1479
|
-
index:
|
|
1480
|
-
logprobs:
|
|
1481
|
-
tokens:
|
|
1482
|
-
token_logprobs:
|
|
1483
|
-
top_logprobs:
|
|
1476
|
+
var openaiCompletionChunkSchema = import_v47.z.union([
|
|
1477
|
+
import_v47.z.object({
|
|
1478
|
+
id: import_v47.z.string().nullish(),
|
|
1479
|
+
created: import_v47.z.number().nullish(),
|
|
1480
|
+
model: import_v47.z.string().nullish(),
|
|
1481
|
+
choices: import_v47.z.array(
|
|
1482
|
+
import_v47.z.object({
|
|
1483
|
+
text: import_v47.z.string(),
|
|
1484
|
+
finish_reason: import_v47.z.string().nullish(),
|
|
1485
|
+
index: import_v47.z.number(),
|
|
1486
|
+
logprobs: import_v47.z.object({
|
|
1487
|
+
tokens: import_v47.z.array(import_v47.z.string()),
|
|
1488
|
+
token_logprobs: import_v47.z.array(import_v47.z.number()),
|
|
1489
|
+
top_logprobs: import_v47.z.array(import_v47.z.record(import_v47.z.string(), import_v47.z.number())).nullish()
|
|
1484
1490
|
}).nullish()
|
|
1485
1491
|
})
|
|
1486
1492
|
),
|
|
@@ -1492,21 +1498,21 @@ var openaiCompletionChunkSchema = import_zod7.z.union([
|
|
|
1492
1498
|
// src/openai-embedding-model.ts
|
|
1493
1499
|
var import_provider5 = require("@ai-sdk/provider");
|
|
1494
1500
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
1495
|
-
var
|
|
1501
|
+
var import_v49 = require("zod/v4");
|
|
1496
1502
|
|
|
1497
1503
|
// src/openai-embedding-options.ts
|
|
1498
|
-
var
|
|
1499
|
-
var openaiEmbeddingProviderOptions =
|
|
1504
|
+
var import_v48 = require("zod/v4");
|
|
1505
|
+
var openaiEmbeddingProviderOptions = import_v48.z.object({
|
|
1500
1506
|
/**
|
|
1501
1507
|
The number of dimensions the resulting output embeddings should have.
|
|
1502
1508
|
Only supported in text-embedding-3 and later models.
|
|
1503
1509
|
*/
|
|
1504
|
-
dimensions:
|
|
1510
|
+
dimensions: import_v48.z.number().optional(),
|
|
1505
1511
|
/**
|
|
1506
1512
|
A unique identifier representing your end-user, which can help OpenAI to
|
|
1507
1513
|
monitor and detect abuse. Learn more.
|
|
1508
1514
|
*/
|
|
1509
|
-
user:
|
|
1515
|
+
user: import_v48.z.string().optional()
|
|
1510
1516
|
});
|
|
1511
1517
|
|
|
1512
1518
|
// src/openai-embedding-model.ts
|
|
@@ -1572,14 +1578,14 @@ var OpenAIEmbeddingModel = class {
|
|
|
1572
1578
|
};
|
|
1573
1579
|
}
|
|
1574
1580
|
};
|
|
1575
|
-
var openaiTextEmbeddingResponseSchema =
|
|
1576
|
-
data:
|
|
1577
|
-
usage:
|
|
1581
|
+
var openaiTextEmbeddingResponseSchema = import_v49.z.object({
|
|
1582
|
+
data: import_v49.z.array(import_v49.z.object({ embedding: import_v49.z.array(import_v49.z.number()) })),
|
|
1583
|
+
usage: import_v49.z.object({ prompt_tokens: import_v49.z.number() }).nullish()
|
|
1578
1584
|
});
|
|
1579
1585
|
|
|
1580
1586
|
// src/openai-image-model.ts
|
|
1581
1587
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1582
|
-
var
|
|
1588
|
+
var import_v410 = require("zod/v4");
|
|
1583
1589
|
|
|
1584
1590
|
// src/openai-image-settings.ts
|
|
1585
1591
|
var modelMaxImagesPerCall = {
|
|
@@ -1667,41 +1673,41 @@ var OpenAIImageModel = class {
|
|
|
1667
1673
|
};
|
|
1668
1674
|
}
|
|
1669
1675
|
};
|
|
1670
|
-
var openaiImageResponseSchema =
|
|
1671
|
-
data:
|
|
1672
|
-
|
|
1676
|
+
var openaiImageResponseSchema = import_v410.z.object({
|
|
1677
|
+
data: import_v410.z.array(
|
|
1678
|
+
import_v410.z.object({ b64_json: import_v410.z.string(), revised_prompt: import_v410.z.string().optional() })
|
|
1673
1679
|
)
|
|
1674
1680
|
});
|
|
1675
1681
|
|
|
1676
1682
|
// src/openai-transcription-model.ts
|
|
1677
1683
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
1678
|
-
var
|
|
1684
|
+
var import_v412 = require("zod/v4");
|
|
1679
1685
|
|
|
1680
1686
|
// src/openai-transcription-options.ts
|
|
1681
|
-
var
|
|
1682
|
-
var openAITranscriptionProviderOptions =
|
|
1687
|
+
var import_v411 = require("zod/v4");
|
|
1688
|
+
var openAITranscriptionProviderOptions = import_v411.z.object({
|
|
1683
1689
|
/**
|
|
1684
1690
|
* Additional information to include in the transcription response.
|
|
1685
1691
|
*/
|
|
1686
|
-
include:
|
|
1692
|
+
include: import_v411.z.array(import_v411.z.string()).optional(),
|
|
1687
1693
|
/**
|
|
1688
1694
|
* The language of the input audio in ISO-639-1 format.
|
|
1689
1695
|
*/
|
|
1690
|
-
language:
|
|
1696
|
+
language: import_v411.z.string().optional(),
|
|
1691
1697
|
/**
|
|
1692
1698
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
1693
1699
|
*/
|
|
1694
|
-
prompt:
|
|
1700
|
+
prompt: import_v411.z.string().optional(),
|
|
1695
1701
|
/**
|
|
1696
1702
|
* The sampling temperature, between 0 and 1.
|
|
1697
1703
|
* @default 0
|
|
1698
1704
|
*/
|
|
1699
|
-
temperature:
|
|
1705
|
+
temperature: import_v411.z.number().min(0).max(1).default(0).optional(),
|
|
1700
1706
|
/**
|
|
1701
1707
|
* The timestamp granularities to populate for this transcription.
|
|
1702
1708
|
* @default ['segment']
|
|
1703
1709
|
*/
|
|
1704
|
-
timestampGranularities:
|
|
1710
|
+
timestampGranularities: import_v411.z.array(import_v411.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
1705
1711
|
});
|
|
1706
1712
|
|
|
1707
1713
|
// src/openai-transcription-model.ts
|
|
@@ -1849,25 +1855,25 @@ var OpenAITranscriptionModel = class {
|
|
|
1849
1855
|
};
|
|
1850
1856
|
}
|
|
1851
1857
|
};
|
|
1852
|
-
var openaiTranscriptionResponseSchema =
|
|
1853
|
-
text:
|
|
1854
|
-
language:
|
|
1855
|
-
duration:
|
|
1856
|
-
words:
|
|
1857
|
-
|
|
1858
|
-
word:
|
|
1859
|
-
start:
|
|
1860
|
-
end:
|
|
1858
|
+
var openaiTranscriptionResponseSchema = import_v412.z.object({
|
|
1859
|
+
text: import_v412.z.string(),
|
|
1860
|
+
language: import_v412.z.string().nullish(),
|
|
1861
|
+
duration: import_v412.z.number().nullish(),
|
|
1862
|
+
words: import_v412.z.array(
|
|
1863
|
+
import_v412.z.object({
|
|
1864
|
+
word: import_v412.z.string(),
|
|
1865
|
+
start: import_v412.z.number(),
|
|
1866
|
+
end: import_v412.z.number()
|
|
1861
1867
|
})
|
|
1862
1868
|
).nullish()
|
|
1863
1869
|
});
|
|
1864
1870
|
|
|
1865
1871
|
// src/openai-speech-model.ts
|
|
1866
1872
|
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1867
|
-
var
|
|
1868
|
-
var OpenAIProviderOptionsSchema =
|
|
1869
|
-
instructions:
|
|
1870
|
-
speed:
|
|
1873
|
+
var import_v413 = require("zod/v4");
|
|
1874
|
+
var OpenAIProviderOptionsSchema = import_v413.z.object({
|
|
1875
|
+
instructions: import_v413.z.string().nullish(),
|
|
1876
|
+
speed: import_v413.z.number().min(0.25).max(4).default(1).nullish()
|
|
1871
1877
|
});
|
|
1872
1878
|
var OpenAISpeechModel = class {
|
|
1873
1879
|
constructor(modelId, config) {
|
|
@@ -1971,7 +1977,7 @@ var OpenAISpeechModel = class {
|
|
|
1971
1977
|
|
|
1972
1978
|
// src/responses/openai-responses-language-model.ts
|
|
1973
1979
|
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1974
|
-
var
|
|
1980
|
+
var import_v414 = require("zod/v4");
|
|
1975
1981
|
|
|
1976
1982
|
// src/responses/convert-to-openai-responses-messages.ts
|
|
1977
1983
|
var import_provider6 = require("@ai-sdk/provider");
|
|
@@ -2137,7 +2143,7 @@ var import_provider7 = require("@ai-sdk/provider");
|
|
|
2137
2143
|
function prepareResponsesTools({
|
|
2138
2144
|
tools,
|
|
2139
2145
|
toolChoice,
|
|
2140
|
-
|
|
2146
|
+
strictJsonSchema
|
|
2141
2147
|
}) {
|
|
2142
2148
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
2143
2149
|
const toolWarnings = [];
|
|
@@ -2153,7 +2159,7 @@ function prepareResponsesTools({
|
|
|
2153
2159
|
name: tool.name,
|
|
2154
2160
|
description: tool.description,
|
|
2155
2161
|
parameters: tool.inputSchema,
|
|
2156
|
-
strict:
|
|
2162
|
+
strict: strictJsonSchema
|
|
2157
2163
|
});
|
|
2158
2164
|
break;
|
|
2159
2165
|
case "provider-defined":
|
|
@@ -2261,7 +2267,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2261
2267
|
providerOptions,
|
|
2262
2268
|
schema: openaiResponsesProviderOptionsSchema
|
|
2263
2269
|
});
|
|
2264
|
-
const
|
|
2270
|
+
const strictJsonSchema = (_a = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _a : false;
|
|
2265
2271
|
const baseArgs = {
|
|
2266
2272
|
model: this.modelId,
|
|
2267
2273
|
input: messages,
|
|
@@ -2272,7 +2278,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2272
2278
|
text: {
|
|
2273
2279
|
format: responseFormat.schema != null ? {
|
|
2274
2280
|
type: "json_schema",
|
|
2275
|
-
strict:
|
|
2281
|
+
strict: strictJsonSchema,
|
|
2276
2282
|
name: (_b = responseFormat.name) != null ? _b : "response",
|
|
2277
2283
|
description: responseFormat.description,
|
|
2278
2284
|
schema: responseFormat.schema
|
|
@@ -2335,7 +2341,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2335
2341
|
} = prepareResponsesTools({
|
|
2336
2342
|
tools,
|
|
2337
2343
|
toolChoice,
|
|
2338
|
-
|
|
2344
|
+
strictJsonSchema
|
|
2339
2345
|
});
|
|
2340
2346
|
return {
|
|
2341
2347
|
args: {
|
|
@@ -2362,59 +2368,59 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2362
2368
|
body,
|
|
2363
2369
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2364
2370
|
successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
|
|
2365
|
-
|
|
2366
|
-
id:
|
|
2367
|
-
created_at:
|
|
2368
|
-
model:
|
|
2369
|
-
output:
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
type:
|
|
2373
|
-
role:
|
|
2374
|
-
content:
|
|
2375
|
-
|
|
2376
|
-
type:
|
|
2377
|
-
text:
|
|
2378
|
-
annotations:
|
|
2379
|
-
|
|
2380
|
-
type:
|
|
2381
|
-
start_index:
|
|
2382
|
-
end_index:
|
|
2383
|
-
url:
|
|
2384
|
-
title:
|
|
2371
|
+
import_v414.z.object({
|
|
2372
|
+
id: import_v414.z.string(),
|
|
2373
|
+
created_at: import_v414.z.number(),
|
|
2374
|
+
model: import_v414.z.string(),
|
|
2375
|
+
output: import_v414.z.array(
|
|
2376
|
+
import_v414.z.discriminatedUnion("type", [
|
|
2377
|
+
import_v414.z.object({
|
|
2378
|
+
type: import_v414.z.literal("message"),
|
|
2379
|
+
role: import_v414.z.literal("assistant"),
|
|
2380
|
+
content: import_v414.z.array(
|
|
2381
|
+
import_v414.z.object({
|
|
2382
|
+
type: import_v414.z.literal("output_text"),
|
|
2383
|
+
text: import_v414.z.string(),
|
|
2384
|
+
annotations: import_v414.z.array(
|
|
2385
|
+
import_v414.z.object({
|
|
2386
|
+
type: import_v414.z.literal("url_citation"),
|
|
2387
|
+
start_index: import_v414.z.number(),
|
|
2388
|
+
end_index: import_v414.z.number(),
|
|
2389
|
+
url: import_v414.z.string(),
|
|
2390
|
+
title: import_v414.z.string()
|
|
2385
2391
|
})
|
|
2386
2392
|
)
|
|
2387
2393
|
})
|
|
2388
2394
|
)
|
|
2389
2395
|
}),
|
|
2390
|
-
|
|
2391
|
-
type:
|
|
2392
|
-
call_id:
|
|
2393
|
-
name:
|
|
2394
|
-
arguments:
|
|
2396
|
+
import_v414.z.object({
|
|
2397
|
+
type: import_v414.z.literal("function_call"),
|
|
2398
|
+
call_id: import_v414.z.string(),
|
|
2399
|
+
name: import_v414.z.string(),
|
|
2400
|
+
arguments: import_v414.z.string()
|
|
2395
2401
|
}),
|
|
2396
|
-
|
|
2397
|
-
type:
|
|
2398
|
-
id:
|
|
2399
|
-
status:
|
|
2402
|
+
import_v414.z.object({
|
|
2403
|
+
type: import_v414.z.literal("web_search_call"),
|
|
2404
|
+
id: import_v414.z.string(),
|
|
2405
|
+
status: import_v414.z.string().optional()
|
|
2400
2406
|
}),
|
|
2401
|
-
|
|
2402
|
-
type:
|
|
2403
|
-
id:
|
|
2404
|
-
status:
|
|
2407
|
+
import_v414.z.object({
|
|
2408
|
+
type: import_v414.z.literal("computer_call"),
|
|
2409
|
+
id: import_v414.z.string(),
|
|
2410
|
+
status: import_v414.z.string().optional()
|
|
2405
2411
|
}),
|
|
2406
|
-
|
|
2407
|
-
type:
|
|
2408
|
-
summary:
|
|
2409
|
-
|
|
2410
|
-
type:
|
|
2411
|
-
text:
|
|
2412
|
+
import_v414.z.object({
|
|
2413
|
+
type: import_v414.z.literal("reasoning"),
|
|
2414
|
+
summary: import_v414.z.array(
|
|
2415
|
+
import_v414.z.object({
|
|
2416
|
+
type: import_v414.z.literal("summary_text"),
|
|
2417
|
+
text: import_v414.z.string()
|
|
2412
2418
|
})
|
|
2413
2419
|
)
|
|
2414
2420
|
})
|
|
2415
2421
|
])
|
|
2416
2422
|
),
|
|
2417
|
-
incomplete_details:
|
|
2423
|
+
incomplete_details: import_v414.z.object({ reason: import_v414.z.string() }).nullable(),
|
|
2418
2424
|
usage: usageSchema2
|
|
2419
2425
|
})
|
|
2420
2426
|
),
|
|
@@ -2755,124 +2761,124 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2755
2761
|
};
|
|
2756
2762
|
}
|
|
2757
2763
|
};
|
|
2758
|
-
var usageSchema2 =
|
|
2759
|
-
input_tokens:
|
|
2760
|
-
input_tokens_details:
|
|
2761
|
-
output_tokens:
|
|
2762
|
-
output_tokens_details:
|
|
2764
|
+
var usageSchema2 = import_v414.z.object({
|
|
2765
|
+
input_tokens: import_v414.z.number(),
|
|
2766
|
+
input_tokens_details: import_v414.z.object({ cached_tokens: import_v414.z.number().nullish() }).nullish(),
|
|
2767
|
+
output_tokens: import_v414.z.number(),
|
|
2768
|
+
output_tokens_details: import_v414.z.object({ reasoning_tokens: import_v414.z.number().nullish() }).nullish()
|
|
2763
2769
|
});
|
|
2764
|
-
var textDeltaChunkSchema =
|
|
2765
|
-
type:
|
|
2766
|
-
item_id:
|
|
2767
|
-
delta:
|
|
2770
|
+
var textDeltaChunkSchema = import_v414.z.object({
|
|
2771
|
+
type: import_v414.z.literal("response.output_text.delta"),
|
|
2772
|
+
item_id: import_v414.z.string(),
|
|
2773
|
+
delta: import_v414.z.string()
|
|
2768
2774
|
});
|
|
2769
|
-
var responseFinishedChunkSchema =
|
|
2770
|
-
type:
|
|
2771
|
-
response:
|
|
2772
|
-
incomplete_details:
|
|
2775
|
+
var responseFinishedChunkSchema = import_v414.z.object({
|
|
2776
|
+
type: import_v414.z.enum(["response.completed", "response.incomplete"]),
|
|
2777
|
+
response: import_v414.z.object({
|
|
2778
|
+
incomplete_details: import_v414.z.object({ reason: import_v414.z.string() }).nullish(),
|
|
2773
2779
|
usage: usageSchema2
|
|
2774
2780
|
})
|
|
2775
2781
|
});
|
|
2776
|
-
var responseCreatedChunkSchema =
|
|
2777
|
-
type:
|
|
2778
|
-
response:
|
|
2779
|
-
id:
|
|
2780
|
-
created_at:
|
|
2781
|
-
model:
|
|
2782
|
+
var responseCreatedChunkSchema = import_v414.z.object({
|
|
2783
|
+
type: import_v414.z.literal("response.created"),
|
|
2784
|
+
response: import_v414.z.object({
|
|
2785
|
+
id: import_v414.z.string(),
|
|
2786
|
+
created_at: import_v414.z.number(),
|
|
2787
|
+
model: import_v414.z.string()
|
|
2782
2788
|
})
|
|
2783
2789
|
});
|
|
2784
|
-
var responseOutputItemAddedSchema =
|
|
2785
|
-
type:
|
|
2786
|
-
output_index:
|
|
2787
|
-
item:
|
|
2788
|
-
|
|
2789
|
-
type:
|
|
2790
|
-
id:
|
|
2790
|
+
var responseOutputItemAddedSchema = import_v414.z.object({
|
|
2791
|
+
type: import_v414.z.literal("response.output_item.added"),
|
|
2792
|
+
output_index: import_v414.z.number(),
|
|
2793
|
+
item: import_v414.z.discriminatedUnion("type", [
|
|
2794
|
+
import_v414.z.object({
|
|
2795
|
+
type: import_v414.z.literal("message"),
|
|
2796
|
+
id: import_v414.z.string()
|
|
2791
2797
|
}),
|
|
2792
|
-
|
|
2793
|
-
type:
|
|
2794
|
-
id:
|
|
2798
|
+
import_v414.z.object({
|
|
2799
|
+
type: import_v414.z.literal("reasoning"),
|
|
2800
|
+
id: import_v414.z.string()
|
|
2795
2801
|
}),
|
|
2796
|
-
|
|
2797
|
-
type:
|
|
2798
|
-
id:
|
|
2799
|
-
call_id:
|
|
2800
|
-
name:
|
|
2801
|
-
arguments:
|
|
2802
|
+
import_v414.z.object({
|
|
2803
|
+
type: import_v414.z.literal("function_call"),
|
|
2804
|
+
id: import_v414.z.string(),
|
|
2805
|
+
call_id: import_v414.z.string(),
|
|
2806
|
+
name: import_v414.z.string(),
|
|
2807
|
+
arguments: import_v414.z.string()
|
|
2802
2808
|
}),
|
|
2803
|
-
|
|
2804
|
-
type:
|
|
2805
|
-
id:
|
|
2806
|
-
status:
|
|
2809
|
+
import_v414.z.object({
|
|
2810
|
+
type: import_v414.z.literal("web_search_call"),
|
|
2811
|
+
id: import_v414.z.string(),
|
|
2812
|
+
status: import_v414.z.string()
|
|
2807
2813
|
}),
|
|
2808
|
-
|
|
2809
|
-
type:
|
|
2810
|
-
id:
|
|
2811
|
-
status:
|
|
2814
|
+
import_v414.z.object({
|
|
2815
|
+
type: import_v414.z.literal("computer_call"),
|
|
2816
|
+
id: import_v414.z.string(),
|
|
2817
|
+
status: import_v414.z.string()
|
|
2812
2818
|
})
|
|
2813
2819
|
])
|
|
2814
2820
|
});
|
|
2815
|
-
var responseOutputItemDoneSchema =
|
|
2816
|
-
type:
|
|
2817
|
-
output_index:
|
|
2818
|
-
item:
|
|
2819
|
-
|
|
2820
|
-
type:
|
|
2821
|
-
id:
|
|
2821
|
+
var responseOutputItemDoneSchema = import_v414.z.object({
|
|
2822
|
+
type: import_v414.z.literal("response.output_item.done"),
|
|
2823
|
+
output_index: import_v414.z.number(),
|
|
2824
|
+
item: import_v414.z.discriminatedUnion("type", [
|
|
2825
|
+
import_v414.z.object({
|
|
2826
|
+
type: import_v414.z.literal("message"),
|
|
2827
|
+
id: import_v414.z.string()
|
|
2822
2828
|
}),
|
|
2823
|
-
|
|
2824
|
-
type:
|
|
2825
|
-
id:
|
|
2829
|
+
import_v414.z.object({
|
|
2830
|
+
type: import_v414.z.literal("reasoning"),
|
|
2831
|
+
id: import_v414.z.string()
|
|
2826
2832
|
}),
|
|
2827
|
-
|
|
2828
|
-
type:
|
|
2829
|
-
id:
|
|
2830
|
-
call_id:
|
|
2831
|
-
name:
|
|
2832
|
-
arguments:
|
|
2833
|
-
status:
|
|
2833
|
+
import_v414.z.object({
|
|
2834
|
+
type: import_v414.z.literal("function_call"),
|
|
2835
|
+
id: import_v414.z.string(),
|
|
2836
|
+
call_id: import_v414.z.string(),
|
|
2837
|
+
name: import_v414.z.string(),
|
|
2838
|
+
arguments: import_v414.z.string(),
|
|
2839
|
+
status: import_v414.z.literal("completed")
|
|
2834
2840
|
}),
|
|
2835
|
-
|
|
2836
|
-
type:
|
|
2837
|
-
id:
|
|
2838
|
-
status:
|
|
2841
|
+
import_v414.z.object({
|
|
2842
|
+
type: import_v414.z.literal("web_search_call"),
|
|
2843
|
+
id: import_v414.z.string(),
|
|
2844
|
+
status: import_v414.z.literal("completed")
|
|
2839
2845
|
}),
|
|
2840
|
-
|
|
2841
|
-
type:
|
|
2842
|
-
id:
|
|
2843
|
-
status:
|
|
2846
|
+
import_v414.z.object({
|
|
2847
|
+
type: import_v414.z.literal("computer_call"),
|
|
2848
|
+
id: import_v414.z.string(),
|
|
2849
|
+
status: import_v414.z.literal("completed")
|
|
2844
2850
|
})
|
|
2845
2851
|
])
|
|
2846
2852
|
});
|
|
2847
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
2848
|
-
type:
|
|
2849
|
-
item_id:
|
|
2850
|
-
output_index:
|
|
2851
|
-
delta:
|
|
2853
|
+
var responseFunctionCallArgumentsDeltaSchema = import_v414.z.object({
|
|
2854
|
+
type: import_v414.z.literal("response.function_call_arguments.delta"),
|
|
2855
|
+
item_id: import_v414.z.string(),
|
|
2856
|
+
output_index: import_v414.z.number(),
|
|
2857
|
+
delta: import_v414.z.string()
|
|
2852
2858
|
});
|
|
2853
|
-
var responseAnnotationAddedSchema =
|
|
2854
|
-
type:
|
|
2855
|
-
annotation:
|
|
2856
|
-
type:
|
|
2857
|
-
url:
|
|
2858
|
-
title:
|
|
2859
|
+
var responseAnnotationAddedSchema = import_v414.z.object({
|
|
2860
|
+
type: import_v414.z.literal("response.output_text.annotation.added"),
|
|
2861
|
+
annotation: import_v414.z.object({
|
|
2862
|
+
type: import_v414.z.literal("url_citation"),
|
|
2863
|
+
url: import_v414.z.string(),
|
|
2864
|
+
title: import_v414.z.string()
|
|
2859
2865
|
})
|
|
2860
2866
|
});
|
|
2861
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
2862
|
-
type:
|
|
2863
|
-
item_id:
|
|
2864
|
-
output_index:
|
|
2865
|
-
summary_index:
|
|
2866
|
-
delta:
|
|
2867
|
+
var responseReasoningSummaryTextDeltaSchema = import_v414.z.object({
|
|
2868
|
+
type: import_v414.z.literal("response.reasoning_summary_text.delta"),
|
|
2869
|
+
item_id: import_v414.z.string(),
|
|
2870
|
+
output_index: import_v414.z.number(),
|
|
2871
|
+
summary_index: import_v414.z.number(),
|
|
2872
|
+
delta: import_v414.z.string()
|
|
2867
2873
|
});
|
|
2868
|
-
var responseReasoningSummaryPartDoneSchema =
|
|
2869
|
-
type:
|
|
2870
|
-
item_id:
|
|
2871
|
-
output_index:
|
|
2872
|
-
summary_index:
|
|
2873
|
-
part:
|
|
2874
|
+
var responseReasoningSummaryPartDoneSchema = import_v414.z.object({
|
|
2875
|
+
type: import_v414.z.literal("response.reasoning_summary_part.done"),
|
|
2876
|
+
item_id: import_v414.z.string(),
|
|
2877
|
+
output_index: import_v414.z.number(),
|
|
2878
|
+
summary_index: import_v414.z.number(),
|
|
2879
|
+
part: import_v414.z.unknown().nullish()
|
|
2874
2880
|
});
|
|
2875
|
-
var openaiResponsesChunkSchema =
|
|
2881
|
+
var openaiResponsesChunkSchema = import_v414.z.union([
|
|
2876
2882
|
textDeltaChunkSchema,
|
|
2877
2883
|
responseFinishedChunkSchema,
|
|
2878
2884
|
responseCreatedChunkSchema,
|
|
@@ -2882,7 +2888,7 @@ var openaiResponsesChunkSchema = import_zod14.z.union([
|
|
|
2882
2888
|
responseAnnotationAddedSchema,
|
|
2883
2889
|
responseReasoningSummaryTextDeltaSchema,
|
|
2884
2890
|
responseReasoningSummaryPartDoneSchema,
|
|
2885
|
-
|
|
2891
|
+
import_v414.z.object({ type: import_v414.z.string() }).passthrough()
|
|
2886
2892
|
// fallback for unknown chunks
|
|
2887
2893
|
]);
|
|
2888
2894
|
function isTextDeltaChunk(chunk) {
|
|
@@ -2933,17 +2939,17 @@ function getResponsesModelConfig(modelId) {
|
|
|
2933
2939
|
function supportsFlexProcessing2(modelId) {
|
|
2934
2940
|
return modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
2935
2941
|
}
|
|
2936
|
-
var openaiResponsesProviderOptionsSchema =
|
|
2937
|
-
metadata:
|
|
2938
|
-
parallelToolCalls:
|
|
2939
|
-
previousResponseId:
|
|
2940
|
-
store:
|
|
2941
|
-
user:
|
|
2942
|
-
reasoningEffort:
|
|
2943
|
-
|
|
2944
|
-
instructions:
|
|
2945
|
-
reasoningSummary:
|
|
2946
|
-
serviceTier:
|
|
2942
|
+
var openaiResponsesProviderOptionsSchema = import_v414.z.object({
|
|
2943
|
+
metadata: import_v414.z.any().nullish(),
|
|
2944
|
+
parallelToolCalls: import_v414.z.boolean().nullish(),
|
|
2945
|
+
previousResponseId: import_v414.z.string().nullish(),
|
|
2946
|
+
store: import_v414.z.boolean().nullish(),
|
|
2947
|
+
user: import_v414.z.string().nullish(),
|
|
2948
|
+
reasoningEffort: import_v414.z.string().nullish(),
|
|
2949
|
+
strictJsonSchema: import_v414.z.boolean().nullish(),
|
|
2950
|
+
instructions: import_v414.z.string().nullish(),
|
|
2951
|
+
reasoningSummary: import_v414.z.string().nullish(),
|
|
2952
|
+
serviceTier: import_v414.z.enum(["auto", "flex"]).nullish()
|
|
2947
2953
|
});
|
|
2948
2954
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2949
2955
|
0 && (module.exports = {
|