@ai-sdk/openai 3.0.0-beta.17 → 3.0.0-beta.19
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 +38 -65
- package/dist/index.d.ts +38 -65
- package/dist/index.js +1341 -1033
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1295 -942
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +101 -183
- package/dist/internal/index.d.ts +101 -183
- package/dist/internal/index.js +1338 -1028
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1307 -953
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/internal/index.mjs
CHANGED
|
@@ -11,10 +11,9 @@ import {
|
|
|
11
11
|
parseProviderOptions,
|
|
12
12
|
postJsonToApi
|
|
13
13
|
} from "@ai-sdk/provider-utils";
|
|
14
|
-
import { z as z3 } from "zod/v4";
|
|
15
14
|
|
|
16
15
|
// src/openai-error.ts
|
|
17
|
-
import
|
|
16
|
+
import * as z from "zod/v4";
|
|
18
17
|
import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
|
|
19
18
|
var openaiErrorDataSchema = z.object({
|
|
20
19
|
error: z.object({
|
|
@@ -246,95 +245,246 @@ function mapOpenAIFinishReason(finishReason) {
|
|
|
246
245
|
}
|
|
247
246
|
}
|
|
248
247
|
|
|
248
|
+
// src/chat/openai-chat-api.ts
|
|
249
|
+
import {
|
|
250
|
+
lazyValidator,
|
|
251
|
+
zodSchema
|
|
252
|
+
} from "@ai-sdk/provider-utils";
|
|
253
|
+
import * as z2 from "zod/v4";
|
|
254
|
+
var openaiChatResponseSchema = lazyValidator(
|
|
255
|
+
() => zodSchema(
|
|
256
|
+
z2.object({
|
|
257
|
+
id: z2.string().nullish(),
|
|
258
|
+
created: z2.number().nullish(),
|
|
259
|
+
model: z2.string().nullish(),
|
|
260
|
+
choices: z2.array(
|
|
261
|
+
z2.object({
|
|
262
|
+
message: z2.object({
|
|
263
|
+
role: z2.literal("assistant").nullish(),
|
|
264
|
+
content: z2.string().nullish(),
|
|
265
|
+
tool_calls: z2.array(
|
|
266
|
+
z2.object({
|
|
267
|
+
id: z2.string().nullish(),
|
|
268
|
+
type: z2.literal("function"),
|
|
269
|
+
function: z2.object({
|
|
270
|
+
name: z2.string(),
|
|
271
|
+
arguments: z2.string()
|
|
272
|
+
})
|
|
273
|
+
})
|
|
274
|
+
).nullish(),
|
|
275
|
+
annotations: z2.array(
|
|
276
|
+
z2.object({
|
|
277
|
+
type: z2.literal("url_citation"),
|
|
278
|
+
start_index: z2.number(),
|
|
279
|
+
end_index: z2.number(),
|
|
280
|
+
url: z2.string(),
|
|
281
|
+
title: z2.string()
|
|
282
|
+
})
|
|
283
|
+
).nullish()
|
|
284
|
+
}),
|
|
285
|
+
index: z2.number(),
|
|
286
|
+
logprobs: z2.object({
|
|
287
|
+
content: z2.array(
|
|
288
|
+
z2.object({
|
|
289
|
+
token: z2.string(),
|
|
290
|
+
logprob: z2.number(),
|
|
291
|
+
top_logprobs: z2.array(
|
|
292
|
+
z2.object({
|
|
293
|
+
token: z2.string(),
|
|
294
|
+
logprob: z2.number()
|
|
295
|
+
})
|
|
296
|
+
)
|
|
297
|
+
})
|
|
298
|
+
).nullish()
|
|
299
|
+
}).nullish(),
|
|
300
|
+
finish_reason: z2.string().nullish()
|
|
301
|
+
})
|
|
302
|
+
),
|
|
303
|
+
usage: z2.object({
|
|
304
|
+
prompt_tokens: z2.number().nullish(),
|
|
305
|
+
completion_tokens: z2.number().nullish(),
|
|
306
|
+
total_tokens: z2.number().nullish(),
|
|
307
|
+
prompt_tokens_details: z2.object({
|
|
308
|
+
cached_tokens: z2.number().nullish()
|
|
309
|
+
}).nullish(),
|
|
310
|
+
completion_tokens_details: z2.object({
|
|
311
|
+
reasoning_tokens: z2.number().nullish(),
|
|
312
|
+
accepted_prediction_tokens: z2.number().nullish(),
|
|
313
|
+
rejected_prediction_tokens: z2.number().nullish()
|
|
314
|
+
}).nullish()
|
|
315
|
+
}).nullish()
|
|
316
|
+
})
|
|
317
|
+
)
|
|
318
|
+
);
|
|
319
|
+
var openaiChatChunkSchema = lazyValidator(
|
|
320
|
+
() => zodSchema(
|
|
321
|
+
z2.union([
|
|
322
|
+
z2.object({
|
|
323
|
+
id: z2.string().nullish(),
|
|
324
|
+
created: z2.number().nullish(),
|
|
325
|
+
model: z2.string().nullish(),
|
|
326
|
+
choices: z2.array(
|
|
327
|
+
z2.object({
|
|
328
|
+
delta: z2.object({
|
|
329
|
+
role: z2.enum(["assistant"]).nullish(),
|
|
330
|
+
content: z2.string().nullish(),
|
|
331
|
+
tool_calls: z2.array(
|
|
332
|
+
z2.object({
|
|
333
|
+
index: z2.number(),
|
|
334
|
+
id: z2.string().nullish(),
|
|
335
|
+
type: z2.literal("function").nullish(),
|
|
336
|
+
function: z2.object({
|
|
337
|
+
name: z2.string().nullish(),
|
|
338
|
+
arguments: z2.string().nullish()
|
|
339
|
+
})
|
|
340
|
+
})
|
|
341
|
+
).nullish(),
|
|
342
|
+
annotations: z2.array(
|
|
343
|
+
z2.object({
|
|
344
|
+
type: z2.literal("url_citation"),
|
|
345
|
+
start_index: z2.number(),
|
|
346
|
+
end_index: z2.number(),
|
|
347
|
+
url: z2.string(),
|
|
348
|
+
title: z2.string()
|
|
349
|
+
})
|
|
350
|
+
).nullish()
|
|
351
|
+
}).nullish(),
|
|
352
|
+
logprobs: z2.object({
|
|
353
|
+
content: z2.array(
|
|
354
|
+
z2.object({
|
|
355
|
+
token: z2.string(),
|
|
356
|
+
logprob: z2.number(),
|
|
357
|
+
top_logprobs: z2.array(
|
|
358
|
+
z2.object({
|
|
359
|
+
token: z2.string(),
|
|
360
|
+
logprob: z2.number()
|
|
361
|
+
})
|
|
362
|
+
)
|
|
363
|
+
})
|
|
364
|
+
).nullish()
|
|
365
|
+
}).nullish(),
|
|
366
|
+
finish_reason: z2.string().nullish(),
|
|
367
|
+
index: z2.number()
|
|
368
|
+
})
|
|
369
|
+
),
|
|
370
|
+
usage: z2.object({
|
|
371
|
+
prompt_tokens: z2.number().nullish(),
|
|
372
|
+
completion_tokens: z2.number().nullish(),
|
|
373
|
+
total_tokens: z2.number().nullish(),
|
|
374
|
+
prompt_tokens_details: z2.object({
|
|
375
|
+
cached_tokens: z2.number().nullish()
|
|
376
|
+
}).nullish(),
|
|
377
|
+
completion_tokens_details: z2.object({
|
|
378
|
+
reasoning_tokens: z2.number().nullish(),
|
|
379
|
+
accepted_prediction_tokens: z2.number().nullish(),
|
|
380
|
+
rejected_prediction_tokens: z2.number().nullish()
|
|
381
|
+
}).nullish()
|
|
382
|
+
}).nullish()
|
|
383
|
+
}),
|
|
384
|
+
openaiErrorDataSchema
|
|
385
|
+
])
|
|
386
|
+
)
|
|
387
|
+
);
|
|
388
|
+
|
|
249
389
|
// src/chat/openai-chat-options.ts
|
|
250
|
-
import {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
390
|
+
import {
|
|
391
|
+
lazyValidator as lazyValidator2,
|
|
392
|
+
zodSchema as zodSchema2
|
|
393
|
+
} from "@ai-sdk/provider-utils";
|
|
394
|
+
import * as z3 from "zod/v4";
|
|
395
|
+
var openaiChatLanguageModelOptions = lazyValidator2(
|
|
396
|
+
() => zodSchema2(
|
|
397
|
+
z3.object({
|
|
398
|
+
/**
|
|
399
|
+
* Modify the likelihood of specified tokens appearing in the completion.
|
|
400
|
+
*
|
|
401
|
+
* Accepts a JSON object that maps tokens (specified by their token ID in
|
|
402
|
+
* the GPT tokenizer) to an associated bias value from -100 to 100.
|
|
403
|
+
*/
|
|
404
|
+
logitBias: z3.record(z3.coerce.number(), z3.number()).optional(),
|
|
405
|
+
/**
|
|
406
|
+
* Return the log probabilities of the tokens.
|
|
407
|
+
*
|
|
408
|
+
* Setting to true will return the log probabilities of the tokens that
|
|
409
|
+
* were generated.
|
|
410
|
+
*
|
|
411
|
+
* Setting to a number will return the log probabilities of the top n
|
|
412
|
+
* tokens that were generated.
|
|
413
|
+
*/
|
|
414
|
+
logprobs: z3.union([z3.boolean(), z3.number()]).optional(),
|
|
415
|
+
/**
|
|
416
|
+
* Whether to enable parallel function calling during tool use. Default to true.
|
|
417
|
+
*/
|
|
418
|
+
parallelToolCalls: z3.boolean().optional(),
|
|
419
|
+
/**
|
|
420
|
+
* A unique identifier representing your end-user, which can help OpenAI to
|
|
421
|
+
* monitor and detect abuse.
|
|
422
|
+
*/
|
|
423
|
+
user: z3.string().optional(),
|
|
424
|
+
/**
|
|
425
|
+
* Reasoning effort for reasoning models. Defaults to `medium`.
|
|
426
|
+
*/
|
|
427
|
+
reasoningEffort: z3.enum(["minimal", "low", "medium", "high"]).optional(),
|
|
428
|
+
/**
|
|
429
|
+
* Maximum number of completion tokens to generate. Useful for reasoning models.
|
|
430
|
+
*/
|
|
431
|
+
maxCompletionTokens: z3.number().optional(),
|
|
432
|
+
/**
|
|
433
|
+
* Whether to enable persistence in responses API.
|
|
434
|
+
*/
|
|
435
|
+
store: z3.boolean().optional(),
|
|
436
|
+
/**
|
|
437
|
+
* Metadata to associate with the request.
|
|
438
|
+
*/
|
|
439
|
+
metadata: z3.record(z3.string().max(64), z3.string().max(512)).optional(),
|
|
440
|
+
/**
|
|
441
|
+
* Parameters for prediction mode.
|
|
442
|
+
*/
|
|
443
|
+
prediction: z3.record(z3.string(), z3.any()).optional(),
|
|
444
|
+
/**
|
|
445
|
+
* Whether to use structured outputs.
|
|
446
|
+
*
|
|
447
|
+
* @default true
|
|
448
|
+
*/
|
|
449
|
+
structuredOutputs: z3.boolean().optional(),
|
|
450
|
+
/**
|
|
451
|
+
* Service tier for the request.
|
|
452
|
+
* - 'auto': Default service tier. The request will be processed with the service tier configured in the
|
|
453
|
+
* Project settings. Unless otherwise configured, the Project will use 'default'.
|
|
454
|
+
* - 'flex': 50% cheaper processing at the cost of increased latency. Only available for o3 and o4-mini models.
|
|
455
|
+
* - 'priority': Higher-speed processing with predictably low latency at premium cost. Available for Enterprise customers.
|
|
456
|
+
* - 'default': The request will be processed with the standard pricing and performance for the selected model.
|
|
457
|
+
*
|
|
458
|
+
* @default 'auto'
|
|
459
|
+
*/
|
|
460
|
+
serviceTier: z3.enum(["auto", "flex", "priority", "default"]).optional(),
|
|
461
|
+
/**
|
|
462
|
+
* Whether to use strict JSON schema validation.
|
|
463
|
+
*
|
|
464
|
+
* @default false
|
|
465
|
+
*/
|
|
466
|
+
strictJsonSchema: z3.boolean().optional(),
|
|
467
|
+
/**
|
|
468
|
+
* Controls the verbosity of the model's responses.
|
|
469
|
+
* Lower values will result in more concise responses, while higher values will result in more verbose responses.
|
|
470
|
+
*/
|
|
471
|
+
textVerbosity: z3.enum(["low", "medium", "high"]).optional(),
|
|
472
|
+
/**
|
|
473
|
+
* A cache key for prompt caching. Allows manual control over prompt caching behavior.
|
|
474
|
+
* Useful for improving cache hit rates and working around automatic caching issues.
|
|
475
|
+
*/
|
|
476
|
+
promptCacheKey: z3.string().optional(),
|
|
477
|
+
/**
|
|
478
|
+
* A stable identifier used to help detect users of your application
|
|
479
|
+
* that may be violating OpenAI's usage policies. The IDs should be a
|
|
480
|
+
* string that uniquely identifies each user. We recommend hashing their
|
|
481
|
+
* username or email address, in order to avoid sending us any identifying
|
|
482
|
+
* information.
|
|
483
|
+
*/
|
|
484
|
+
safetyIdentifier: z3.string().optional()
|
|
485
|
+
})
|
|
486
|
+
)
|
|
487
|
+
);
|
|
338
488
|
|
|
339
489
|
// src/chat/openai-chat-prepare-tools.ts
|
|
340
490
|
import {
|
|
@@ -892,121 +1042,6 @@ var OpenAIChatLanguageModel = class {
|
|
|
892
1042
|
};
|
|
893
1043
|
}
|
|
894
1044
|
};
|
|
895
|
-
var openaiTokenUsageSchema = z3.object({
|
|
896
|
-
prompt_tokens: z3.number().nullish(),
|
|
897
|
-
completion_tokens: z3.number().nullish(),
|
|
898
|
-
total_tokens: z3.number().nullish(),
|
|
899
|
-
prompt_tokens_details: z3.object({
|
|
900
|
-
cached_tokens: z3.number().nullish()
|
|
901
|
-
}).nullish(),
|
|
902
|
-
completion_tokens_details: z3.object({
|
|
903
|
-
reasoning_tokens: z3.number().nullish(),
|
|
904
|
-
accepted_prediction_tokens: z3.number().nullish(),
|
|
905
|
-
rejected_prediction_tokens: z3.number().nullish()
|
|
906
|
-
}).nullish()
|
|
907
|
-
}).nullish();
|
|
908
|
-
var openaiChatResponseSchema = z3.object({
|
|
909
|
-
id: z3.string().nullish(),
|
|
910
|
-
created: z3.number().nullish(),
|
|
911
|
-
model: z3.string().nullish(),
|
|
912
|
-
choices: z3.array(
|
|
913
|
-
z3.object({
|
|
914
|
-
message: z3.object({
|
|
915
|
-
role: z3.literal("assistant").nullish(),
|
|
916
|
-
content: z3.string().nullish(),
|
|
917
|
-
tool_calls: z3.array(
|
|
918
|
-
z3.object({
|
|
919
|
-
id: z3.string().nullish(),
|
|
920
|
-
type: z3.literal("function"),
|
|
921
|
-
function: z3.object({
|
|
922
|
-
name: z3.string(),
|
|
923
|
-
arguments: z3.string()
|
|
924
|
-
})
|
|
925
|
-
})
|
|
926
|
-
).nullish(),
|
|
927
|
-
annotations: z3.array(
|
|
928
|
-
z3.object({
|
|
929
|
-
type: z3.literal("url_citation"),
|
|
930
|
-
start_index: z3.number(),
|
|
931
|
-
end_index: z3.number(),
|
|
932
|
-
url: z3.string(),
|
|
933
|
-
title: z3.string()
|
|
934
|
-
})
|
|
935
|
-
).nullish()
|
|
936
|
-
}),
|
|
937
|
-
index: z3.number(),
|
|
938
|
-
logprobs: z3.object({
|
|
939
|
-
content: z3.array(
|
|
940
|
-
z3.object({
|
|
941
|
-
token: z3.string(),
|
|
942
|
-
logprob: z3.number(),
|
|
943
|
-
top_logprobs: z3.array(
|
|
944
|
-
z3.object({
|
|
945
|
-
token: z3.string(),
|
|
946
|
-
logprob: z3.number()
|
|
947
|
-
})
|
|
948
|
-
)
|
|
949
|
-
})
|
|
950
|
-
).nullish()
|
|
951
|
-
}).nullish(),
|
|
952
|
-
finish_reason: z3.string().nullish()
|
|
953
|
-
})
|
|
954
|
-
),
|
|
955
|
-
usage: openaiTokenUsageSchema
|
|
956
|
-
});
|
|
957
|
-
var openaiChatChunkSchema = z3.union([
|
|
958
|
-
z3.object({
|
|
959
|
-
id: z3.string().nullish(),
|
|
960
|
-
created: z3.number().nullish(),
|
|
961
|
-
model: z3.string().nullish(),
|
|
962
|
-
choices: z3.array(
|
|
963
|
-
z3.object({
|
|
964
|
-
delta: z3.object({
|
|
965
|
-
role: z3.enum(["assistant"]).nullish(),
|
|
966
|
-
content: z3.string().nullish(),
|
|
967
|
-
tool_calls: z3.array(
|
|
968
|
-
z3.object({
|
|
969
|
-
index: z3.number(),
|
|
970
|
-
id: z3.string().nullish(),
|
|
971
|
-
type: z3.literal("function").nullish(),
|
|
972
|
-
function: z3.object({
|
|
973
|
-
name: z3.string().nullish(),
|
|
974
|
-
arguments: z3.string().nullish()
|
|
975
|
-
})
|
|
976
|
-
})
|
|
977
|
-
).nullish(),
|
|
978
|
-
annotations: z3.array(
|
|
979
|
-
z3.object({
|
|
980
|
-
type: z3.literal("url_citation"),
|
|
981
|
-
start_index: z3.number(),
|
|
982
|
-
end_index: z3.number(),
|
|
983
|
-
url: z3.string(),
|
|
984
|
-
title: z3.string()
|
|
985
|
-
})
|
|
986
|
-
).nullish()
|
|
987
|
-
}).nullish(),
|
|
988
|
-
logprobs: z3.object({
|
|
989
|
-
content: z3.array(
|
|
990
|
-
z3.object({
|
|
991
|
-
token: z3.string(),
|
|
992
|
-
logprob: z3.number(),
|
|
993
|
-
top_logprobs: z3.array(
|
|
994
|
-
z3.object({
|
|
995
|
-
token: z3.string(),
|
|
996
|
-
logprob: z3.number()
|
|
997
|
-
})
|
|
998
|
-
)
|
|
999
|
-
})
|
|
1000
|
-
).nullish()
|
|
1001
|
-
}).nullish(),
|
|
1002
|
-
finish_reason: z3.string().nullish(),
|
|
1003
|
-
index: z3.number()
|
|
1004
|
-
})
|
|
1005
|
-
),
|
|
1006
|
-
usage: openaiTokenUsageSchema
|
|
1007
|
-
}),
|
|
1008
|
-
openaiErrorDataSchema
|
|
1009
|
-
]);
|
|
1010
1045
|
function isReasoningModel(modelId) {
|
|
1011
1046
|
return (modelId.startsWith("o") || modelId.startsWith("gpt-5")) && !modelId.startsWith("gpt-5-chat");
|
|
1012
1047
|
}
|
|
@@ -1064,7 +1099,6 @@ import {
|
|
|
1064
1099
|
parseProviderOptions as parseProviderOptions2,
|
|
1065
1100
|
postJsonToApi as postJsonToApi2
|
|
1066
1101
|
} from "@ai-sdk/provider-utils";
|
|
1067
|
-
import { z as z5 } from "zod/v4";
|
|
1068
1102
|
|
|
1069
1103
|
// src/completion/convert-to-openai-completion-prompt.ts
|
|
1070
1104
|
import {
|
|
@@ -1174,48 +1208,117 @@ function mapOpenAIFinishReason2(finishReason) {
|
|
|
1174
1208
|
}
|
|
1175
1209
|
}
|
|
1176
1210
|
|
|
1211
|
+
// src/completion/openai-completion-api.ts
|
|
1212
|
+
import * as z4 from "zod/v4";
|
|
1213
|
+
import {
|
|
1214
|
+
lazyValidator as lazyValidator3,
|
|
1215
|
+
zodSchema as zodSchema3
|
|
1216
|
+
} from "@ai-sdk/provider-utils";
|
|
1217
|
+
var openaiCompletionResponseSchema = lazyValidator3(
|
|
1218
|
+
() => zodSchema3(
|
|
1219
|
+
z4.object({
|
|
1220
|
+
id: z4.string().nullish(),
|
|
1221
|
+
created: z4.number().nullish(),
|
|
1222
|
+
model: z4.string().nullish(),
|
|
1223
|
+
choices: z4.array(
|
|
1224
|
+
z4.object({
|
|
1225
|
+
text: z4.string(),
|
|
1226
|
+
finish_reason: z4.string(),
|
|
1227
|
+
logprobs: z4.object({
|
|
1228
|
+
tokens: z4.array(z4.string()),
|
|
1229
|
+
token_logprobs: z4.array(z4.number()),
|
|
1230
|
+
top_logprobs: z4.array(z4.record(z4.string(), z4.number())).nullish()
|
|
1231
|
+
}).nullish()
|
|
1232
|
+
})
|
|
1233
|
+
),
|
|
1234
|
+
usage: z4.object({
|
|
1235
|
+
prompt_tokens: z4.number(),
|
|
1236
|
+
completion_tokens: z4.number(),
|
|
1237
|
+
total_tokens: z4.number()
|
|
1238
|
+
}).nullish()
|
|
1239
|
+
})
|
|
1240
|
+
)
|
|
1241
|
+
);
|
|
1242
|
+
var openaiCompletionChunkSchema = lazyValidator3(
|
|
1243
|
+
() => zodSchema3(
|
|
1244
|
+
z4.union([
|
|
1245
|
+
z4.object({
|
|
1246
|
+
id: z4.string().nullish(),
|
|
1247
|
+
created: z4.number().nullish(),
|
|
1248
|
+
model: z4.string().nullish(),
|
|
1249
|
+
choices: z4.array(
|
|
1250
|
+
z4.object({
|
|
1251
|
+
text: z4.string(),
|
|
1252
|
+
finish_reason: z4.string().nullish(),
|
|
1253
|
+
index: z4.number(),
|
|
1254
|
+
logprobs: z4.object({
|
|
1255
|
+
tokens: z4.array(z4.string()),
|
|
1256
|
+
token_logprobs: z4.array(z4.number()),
|
|
1257
|
+
top_logprobs: z4.array(z4.record(z4.string(), z4.number())).nullish()
|
|
1258
|
+
}).nullish()
|
|
1259
|
+
})
|
|
1260
|
+
),
|
|
1261
|
+
usage: z4.object({
|
|
1262
|
+
prompt_tokens: z4.number(),
|
|
1263
|
+
completion_tokens: z4.number(),
|
|
1264
|
+
total_tokens: z4.number()
|
|
1265
|
+
}).nullish()
|
|
1266
|
+
}),
|
|
1267
|
+
openaiErrorDataSchema
|
|
1268
|
+
])
|
|
1269
|
+
)
|
|
1270
|
+
);
|
|
1271
|
+
|
|
1177
1272
|
// src/completion/openai-completion-options.ts
|
|
1178
|
-
import {
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1273
|
+
import {
|
|
1274
|
+
lazyValidator as lazyValidator4,
|
|
1275
|
+
zodSchema as zodSchema4
|
|
1276
|
+
} from "@ai-sdk/provider-utils";
|
|
1277
|
+
import * as z5 from "zod/v4";
|
|
1278
|
+
var openaiCompletionProviderOptions = lazyValidator4(
|
|
1279
|
+
() => zodSchema4(
|
|
1280
|
+
z5.object({
|
|
1281
|
+
/**
|
|
1282
|
+
Echo back the prompt in addition to the completion.
|
|
1283
|
+
*/
|
|
1284
|
+
echo: z5.boolean().optional(),
|
|
1285
|
+
/**
|
|
1286
|
+
Modify the likelihood of specified tokens appearing in the completion.
|
|
1287
|
+
|
|
1288
|
+
Accepts a JSON object that maps tokens (specified by their token ID in
|
|
1289
|
+
the GPT tokenizer) to an associated bias value from -100 to 100. You
|
|
1290
|
+
can use this tokenizer tool to convert text to token IDs. Mathematically,
|
|
1291
|
+
the bias is added to the logits generated by the model prior to sampling.
|
|
1292
|
+
The exact effect will vary per model, but values between -1 and 1 should
|
|
1293
|
+
decrease or increase likelihood of selection; values like -100 or 100
|
|
1294
|
+
should result in a ban or exclusive selection of the relevant token.
|
|
1295
|
+
|
|
1296
|
+
As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
|
|
1297
|
+
token from being generated.
|
|
1298
|
+
*/
|
|
1299
|
+
logitBias: z5.record(z5.string(), z5.number()).optional(),
|
|
1300
|
+
/**
|
|
1301
|
+
The suffix that comes after a completion of inserted text.
|
|
1302
|
+
*/
|
|
1303
|
+
suffix: z5.string().optional(),
|
|
1304
|
+
/**
|
|
1305
|
+
A unique identifier representing your end-user, which can help OpenAI to
|
|
1306
|
+
monitor and detect abuse. Learn more.
|
|
1307
|
+
*/
|
|
1308
|
+
user: z5.string().optional(),
|
|
1309
|
+
/**
|
|
1310
|
+
Return the log probabilities of the tokens. Including logprobs will increase
|
|
1311
|
+
the response size and can slow down response times. However, it can
|
|
1312
|
+
be useful to better understand how the model is behaving.
|
|
1313
|
+
Setting to true will return the log probabilities of the tokens that
|
|
1314
|
+
were generated.
|
|
1315
|
+
Setting to a number will return the log probabilities of the top n
|
|
1316
|
+
tokens that were generated.
|
|
1317
|
+
*/
|
|
1318
|
+
logprobs: z5.union([z5.boolean(), z5.number()]).optional()
|
|
1319
|
+
})
|
|
1320
|
+
)
|
|
1321
|
+
);
|
|
1219
1322
|
|
|
1220
1323
|
// src/completion/openai-completion-language-model.ts
|
|
1221
1324
|
var OpenAICompletionLanguageModel = class {
|
|
@@ -1446,49 +1549,6 @@ var OpenAICompletionLanguageModel = class {
|
|
|
1446
1549
|
};
|
|
1447
1550
|
}
|
|
1448
1551
|
};
|
|
1449
|
-
var usageSchema = z5.object({
|
|
1450
|
-
prompt_tokens: z5.number(),
|
|
1451
|
-
completion_tokens: z5.number(),
|
|
1452
|
-
total_tokens: z5.number()
|
|
1453
|
-
});
|
|
1454
|
-
var openaiCompletionResponseSchema = z5.object({
|
|
1455
|
-
id: z5.string().nullish(),
|
|
1456
|
-
created: z5.number().nullish(),
|
|
1457
|
-
model: z5.string().nullish(),
|
|
1458
|
-
choices: z5.array(
|
|
1459
|
-
z5.object({
|
|
1460
|
-
text: z5.string(),
|
|
1461
|
-
finish_reason: z5.string(),
|
|
1462
|
-
logprobs: z5.object({
|
|
1463
|
-
tokens: z5.array(z5.string()),
|
|
1464
|
-
token_logprobs: z5.array(z5.number()),
|
|
1465
|
-
top_logprobs: z5.array(z5.record(z5.string(), z5.number())).nullish()
|
|
1466
|
-
}).nullish()
|
|
1467
|
-
})
|
|
1468
|
-
),
|
|
1469
|
-
usage: usageSchema.nullish()
|
|
1470
|
-
});
|
|
1471
|
-
var openaiCompletionChunkSchema = z5.union([
|
|
1472
|
-
z5.object({
|
|
1473
|
-
id: z5.string().nullish(),
|
|
1474
|
-
created: z5.number().nullish(),
|
|
1475
|
-
model: z5.string().nullish(),
|
|
1476
|
-
choices: z5.array(
|
|
1477
|
-
z5.object({
|
|
1478
|
-
text: z5.string(),
|
|
1479
|
-
finish_reason: z5.string().nullish(),
|
|
1480
|
-
index: z5.number(),
|
|
1481
|
-
logprobs: z5.object({
|
|
1482
|
-
tokens: z5.array(z5.string()),
|
|
1483
|
-
token_logprobs: z5.array(z5.number()),
|
|
1484
|
-
top_logprobs: z5.array(z5.record(z5.string(), z5.number())).nullish()
|
|
1485
|
-
}).nullish()
|
|
1486
|
-
})
|
|
1487
|
-
),
|
|
1488
|
-
usage: usageSchema.nullish()
|
|
1489
|
-
}),
|
|
1490
|
-
openaiErrorDataSchema
|
|
1491
|
-
]);
|
|
1492
1552
|
|
|
1493
1553
|
// src/embedding/openai-embedding-model.ts
|
|
1494
1554
|
import {
|
|
@@ -1500,22 +1560,41 @@ import {
|
|
|
1500
1560
|
parseProviderOptions as parseProviderOptions3,
|
|
1501
1561
|
postJsonToApi as postJsonToApi3
|
|
1502
1562
|
} from "@ai-sdk/provider-utils";
|
|
1503
|
-
import { z as z7 } from "zod/v4";
|
|
1504
1563
|
|
|
1505
1564
|
// src/embedding/openai-embedding-options.ts
|
|
1506
|
-
import {
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1565
|
+
import {
|
|
1566
|
+
lazyValidator as lazyValidator5,
|
|
1567
|
+
zodSchema as zodSchema5
|
|
1568
|
+
} from "@ai-sdk/provider-utils";
|
|
1569
|
+
import * as z6 from "zod/v4";
|
|
1570
|
+
var openaiEmbeddingProviderOptions = lazyValidator5(
|
|
1571
|
+
() => zodSchema5(
|
|
1572
|
+
z6.object({
|
|
1573
|
+
/**
|
|
1574
|
+
The number of dimensions the resulting output embeddings should have.
|
|
1575
|
+
Only supported in text-embedding-3 and later models.
|
|
1576
|
+
*/
|
|
1577
|
+
dimensions: z6.number().optional(),
|
|
1578
|
+
/**
|
|
1579
|
+
A unique identifier representing your end-user, which can help OpenAI to
|
|
1580
|
+
monitor and detect abuse. Learn more.
|
|
1581
|
+
*/
|
|
1582
|
+
user: z6.string().optional()
|
|
1583
|
+
})
|
|
1584
|
+
)
|
|
1585
|
+
);
|
|
1586
|
+
|
|
1587
|
+
// src/embedding/openai-embedding-api.ts
|
|
1588
|
+
import { lazyValidator as lazyValidator6, zodSchema as zodSchema6 } from "@ai-sdk/provider-utils";
|
|
1589
|
+
import * as z7 from "zod/v4";
|
|
1590
|
+
var openaiTextEmbeddingResponseSchema = lazyValidator6(
|
|
1591
|
+
() => zodSchema6(
|
|
1592
|
+
z7.object({
|
|
1593
|
+
data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
|
|
1594
|
+
usage: z7.object({ prompt_tokens: z7.number() }).nullish()
|
|
1595
|
+
})
|
|
1596
|
+
)
|
|
1597
|
+
);
|
|
1519
1598
|
|
|
1520
1599
|
// src/embedding/openai-embedding-model.ts
|
|
1521
1600
|
var OpenAIEmbeddingModel = class {
|
|
@@ -1580,10 +1659,6 @@ var OpenAIEmbeddingModel = class {
|
|
|
1580
1659
|
};
|
|
1581
1660
|
}
|
|
1582
1661
|
};
|
|
1583
|
-
var openaiTextEmbeddingResponseSchema = z7.object({
|
|
1584
|
-
data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
|
|
1585
|
-
usage: z7.object({ prompt_tokens: z7.number() }).nullish()
|
|
1586
|
-
});
|
|
1587
1662
|
|
|
1588
1663
|
// src/image/openai-image-model.ts
|
|
1589
1664
|
import {
|
|
@@ -1591,7 +1666,22 @@ import {
|
|
|
1591
1666
|
createJsonResponseHandler as createJsonResponseHandler4,
|
|
1592
1667
|
postJsonToApi as postJsonToApi4
|
|
1593
1668
|
} from "@ai-sdk/provider-utils";
|
|
1594
|
-
|
|
1669
|
+
|
|
1670
|
+
// src/image/openai-image-api.ts
|
|
1671
|
+
import { lazyValidator as lazyValidator7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
|
|
1672
|
+
import * as z8 from "zod/v4";
|
|
1673
|
+
var openaiImageResponseSchema = lazyValidator7(
|
|
1674
|
+
() => zodSchema7(
|
|
1675
|
+
z8.object({
|
|
1676
|
+
data: z8.array(
|
|
1677
|
+
z8.object({
|
|
1678
|
+
b64_json: z8.string(),
|
|
1679
|
+
revised_prompt: z8.string().optional()
|
|
1680
|
+
})
|
|
1681
|
+
)
|
|
1682
|
+
})
|
|
1683
|
+
)
|
|
1684
|
+
);
|
|
1595
1685
|
|
|
1596
1686
|
// src/image/openai-image-options.ts
|
|
1597
1687
|
var modelMaxImagesPerCall = {
|
|
@@ -1683,11 +1773,6 @@ var OpenAIImageModel = class {
|
|
|
1683
1773
|
};
|
|
1684
1774
|
}
|
|
1685
1775
|
};
|
|
1686
|
-
var openaiImageResponseSchema = z8.object({
|
|
1687
|
-
data: z8.array(
|
|
1688
|
-
z8.object({ b64_json: z8.string(), revised_prompt: z8.string().optional() })
|
|
1689
|
-
)
|
|
1690
|
-
});
|
|
1691
1776
|
|
|
1692
1777
|
// src/transcription/openai-transcription-model.ts
|
|
1693
1778
|
import {
|
|
@@ -1698,34 +1783,75 @@ import {
|
|
|
1698
1783
|
parseProviderOptions as parseProviderOptions4,
|
|
1699
1784
|
postFormDataToApi
|
|
1700
1785
|
} from "@ai-sdk/provider-utils";
|
|
1701
|
-
|
|
1786
|
+
|
|
1787
|
+
// src/transcription/openai-transcription-api.ts
|
|
1788
|
+
import { lazyValidator as lazyValidator8, zodSchema as zodSchema8 } from "@ai-sdk/provider-utils";
|
|
1789
|
+
import * as z9 from "zod/v4";
|
|
1790
|
+
var openaiTranscriptionResponseSchema = lazyValidator8(
|
|
1791
|
+
() => zodSchema8(
|
|
1792
|
+
z9.object({
|
|
1793
|
+
text: z9.string(),
|
|
1794
|
+
language: z9.string().nullish(),
|
|
1795
|
+
duration: z9.number().nullish(),
|
|
1796
|
+
words: z9.array(
|
|
1797
|
+
z9.object({
|
|
1798
|
+
word: z9.string(),
|
|
1799
|
+
start: z9.number(),
|
|
1800
|
+
end: z9.number()
|
|
1801
|
+
})
|
|
1802
|
+
).nullish(),
|
|
1803
|
+
segments: z9.array(
|
|
1804
|
+
z9.object({
|
|
1805
|
+
id: z9.number(),
|
|
1806
|
+
seek: z9.number(),
|
|
1807
|
+
start: z9.number(),
|
|
1808
|
+
end: z9.number(),
|
|
1809
|
+
text: z9.string(),
|
|
1810
|
+
tokens: z9.array(z9.number()),
|
|
1811
|
+
temperature: z9.number(),
|
|
1812
|
+
avg_logprob: z9.number(),
|
|
1813
|
+
compression_ratio: z9.number(),
|
|
1814
|
+
no_speech_prob: z9.number()
|
|
1815
|
+
})
|
|
1816
|
+
).nullish()
|
|
1817
|
+
})
|
|
1818
|
+
)
|
|
1819
|
+
);
|
|
1702
1820
|
|
|
1703
1821
|
// src/transcription/openai-transcription-options.ts
|
|
1704
|
-
import {
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1822
|
+
import {
|
|
1823
|
+
lazyValidator as lazyValidator9,
|
|
1824
|
+
zodSchema as zodSchema9
|
|
1825
|
+
} from "@ai-sdk/provider-utils";
|
|
1826
|
+
import * as z10 from "zod/v4";
|
|
1827
|
+
var openAITranscriptionProviderOptions = lazyValidator9(
|
|
1828
|
+
() => zodSchema9(
|
|
1829
|
+
z10.object({
|
|
1830
|
+
/**
|
|
1831
|
+
* Additional information to include in the transcription response.
|
|
1832
|
+
*/
|
|
1833
|
+
include: z10.array(z10.string()).optional(),
|
|
1834
|
+
/**
|
|
1835
|
+
* The language of the input audio in ISO-639-1 format.
|
|
1836
|
+
*/
|
|
1837
|
+
language: z10.string().optional(),
|
|
1838
|
+
/**
|
|
1839
|
+
* An optional text to guide the model's style or continue a previous audio segment.
|
|
1840
|
+
*/
|
|
1841
|
+
prompt: z10.string().optional(),
|
|
1842
|
+
/**
|
|
1843
|
+
* The sampling temperature, between 0 and 1.
|
|
1844
|
+
* @default 0
|
|
1845
|
+
*/
|
|
1846
|
+
temperature: z10.number().min(0).max(1).default(0).optional(),
|
|
1847
|
+
/**
|
|
1848
|
+
* The timestamp granularities to populate for this transcription.
|
|
1849
|
+
* @default ['segment']
|
|
1850
|
+
*/
|
|
1851
|
+
timestampGranularities: z10.array(z10.enum(["word", "segment"])).default(["segment"]).optional()
|
|
1852
|
+
})
|
|
1853
|
+
)
|
|
1854
|
+
);
|
|
1729
1855
|
|
|
1730
1856
|
// src/transcription/openai-transcription-model.ts
|
|
1731
1857
|
var languageMap = {
|
|
@@ -1893,32 +2019,6 @@ var OpenAITranscriptionModel = class {
|
|
|
1893
2019
|
};
|
|
1894
2020
|
}
|
|
1895
2021
|
};
|
|
1896
|
-
var openaiTranscriptionResponseSchema = z10.object({
|
|
1897
|
-
text: z10.string(),
|
|
1898
|
-
language: z10.string().nullish(),
|
|
1899
|
-
duration: z10.number().nullish(),
|
|
1900
|
-
words: z10.array(
|
|
1901
|
-
z10.object({
|
|
1902
|
-
word: z10.string(),
|
|
1903
|
-
start: z10.number(),
|
|
1904
|
-
end: z10.number()
|
|
1905
|
-
})
|
|
1906
|
-
).nullish(),
|
|
1907
|
-
segments: z10.array(
|
|
1908
|
-
z10.object({
|
|
1909
|
-
id: z10.number(),
|
|
1910
|
-
seek: z10.number(),
|
|
1911
|
-
start: z10.number(),
|
|
1912
|
-
end: z10.number(),
|
|
1913
|
-
text: z10.string(),
|
|
1914
|
-
tokens: z10.array(z10.number()),
|
|
1915
|
-
temperature: z10.number(),
|
|
1916
|
-
avg_logprob: z10.number(),
|
|
1917
|
-
compression_ratio: z10.number(),
|
|
1918
|
-
no_speech_prob: z10.number()
|
|
1919
|
-
})
|
|
1920
|
-
).nullish()
|
|
1921
|
-
});
|
|
1922
2022
|
|
|
1923
2023
|
// src/speech/openai-speech-model.ts
|
|
1924
2024
|
import {
|
|
@@ -1927,11 +2027,23 @@ import {
|
|
|
1927
2027
|
parseProviderOptions as parseProviderOptions5,
|
|
1928
2028
|
postJsonToApi as postJsonToApi5
|
|
1929
2029
|
} from "@ai-sdk/provider-utils";
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
2030
|
+
|
|
2031
|
+
// src/speech/openai-speech-options.ts
|
|
2032
|
+
import {
|
|
2033
|
+
lazyValidator as lazyValidator10,
|
|
2034
|
+
zodSchema as zodSchema10
|
|
2035
|
+
} from "@ai-sdk/provider-utils";
|
|
2036
|
+
import * as z11 from "zod/v4";
|
|
2037
|
+
var openaiSpeechProviderOptionsSchema = lazyValidator10(
|
|
2038
|
+
() => zodSchema10(
|
|
2039
|
+
z11.object({
|
|
2040
|
+
instructions: z11.string().nullish(),
|
|
2041
|
+
speed: z11.number().min(0.25).max(4).default(1).nullish()
|
|
2042
|
+
})
|
|
2043
|
+
)
|
|
2044
|
+
);
|
|
2045
|
+
|
|
2046
|
+
// src/speech/openai-speech-model.ts
|
|
1935
2047
|
var OpenAISpeechModel = class {
|
|
1936
2048
|
constructor(modelId, config) {
|
|
1937
2049
|
this.modelId = modelId;
|
|
@@ -1954,7 +2066,7 @@ var OpenAISpeechModel = class {
|
|
|
1954
2066
|
const openAIOptions = await parseProviderOptions5({
|
|
1955
2067
|
provider: "openai",
|
|
1956
2068
|
providerOptions,
|
|
1957
|
-
schema:
|
|
2069
|
+
schema: openaiSpeechProviderOptionsSchema
|
|
1958
2070
|
});
|
|
1959
2071
|
const requestBody = {
|
|
1960
2072
|
model: this.modelId,
|
|
@@ -2044,31 +2156,42 @@ import {
|
|
|
2044
2156
|
parseProviderOptions as parseProviderOptions7,
|
|
2045
2157
|
postJsonToApi as postJsonToApi6
|
|
2046
2158
|
} from "@ai-sdk/provider-utils";
|
|
2047
|
-
import { z as z19 } from "zod/v4";
|
|
2048
2159
|
|
|
2049
2160
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2050
2161
|
import {
|
|
2051
2162
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError4
|
|
2052
2163
|
} from "@ai-sdk/provider";
|
|
2053
|
-
import {
|
|
2054
|
-
|
|
2164
|
+
import {
|
|
2165
|
+
convertToBase64 as convertToBase642,
|
|
2166
|
+
parseProviderOptions as parseProviderOptions6,
|
|
2167
|
+
validateTypes
|
|
2168
|
+
} from "@ai-sdk/provider-utils";
|
|
2169
|
+
import * as z13 from "zod/v4";
|
|
2055
2170
|
|
|
2056
2171
|
// src/tool/local-shell.ts
|
|
2057
|
-
import {
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2172
|
+
import {
|
|
2173
|
+
createProviderDefinedToolFactoryWithOutputSchema,
|
|
2174
|
+
lazySchema,
|
|
2175
|
+
zodSchema as zodSchema11
|
|
2176
|
+
} from "@ai-sdk/provider-utils";
|
|
2177
|
+
import * as z12 from "zod/v4";
|
|
2178
|
+
var localShellInputSchema = lazySchema(
|
|
2179
|
+
() => zodSchema11(
|
|
2180
|
+
z12.object({
|
|
2181
|
+
action: z12.object({
|
|
2182
|
+
type: z12.literal("exec"),
|
|
2183
|
+
command: z12.array(z12.string()),
|
|
2184
|
+
timeoutMs: z12.number().optional(),
|
|
2185
|
+
user: z12.string().optional(),
|
|
2186
|
+
workingDirectory: z12.string().optional(),
|
|
2187
|
+
env: z12.record(z12.string(), z12.string()).optional()
|
|
2188
|
+
})
|
|
2189
|
+
})
|
|
2190
|
+
)
|
|
2191
|
+
);
|
|
2192
|
+
var localShellOutputSchema = lazySchema(
|
|
2193
|
+
() => zodSchema11(z12.object({ output: z12.string() }))
|
|
2194
|
+
);
|
|
2072
2195
|
var localShell = createProviderDefinedToolFactoryWithOutputSchema({
|
|
2073
2196
|
id: "openai.local_shell",
|
|
2074
2197
|
name: "local_shell",
|
|
@@ -2182,7 +2305,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2182
2305
|
break;
|
|
2183
2306
|
}
|
|
2184
2307
|
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2185
|
-
const parsedInput =
|
|
2308
|
+
const parsedInput = await validateTypes({
|
|
2309
|
+
value: part.input,
|
|
2310
|
+
schema: localShellInputSchema
|
|
2311
|
+
});
|
|
2186
2312
|
input.push({
|
|
2187
2313
|
type: "local_shell_call",
|
|
2188
2314
|
call_id: part.toolCallId,
|
|
@@ -2278,10 +2404,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2278
2404
|
for (const part of content) {
|
|
2279
2405
|
const output = part.output;
|
|
2280
2406
|
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2407
|
+
const parsedOutput = await validateTypes({
|
|
2408
|
+
value: output.value,
|
|
2409
|
+
schema: localShellOutputSchema
|
|
2410
|
+
});
|
|
2281
2411
|
input.push({
|
|
2282
2412
|
type: "local_shell_call_output",
|
|
2283
2413
|
call_id: part.toolCallId,
|
|
2284
|
-
output:
|
|
2414
|
+
output: parsedOutput.output
|
|
2285
2415
|
});
|
|
2286
2416
|
break;
|
|
2287
2417
|
}
|
|
@@ -2339,34 +2469,585 @@ function mapOpenAIResponseFinishReason({
|
|
|
2339
2469
|
}
|
|
2340
2470
|
}
|
|
2341
2471
|
|
|
2472
|
+
// src/responses/openai-responses-api.ts
|
|
2473
|
+
import {
|
|
2474
|
+
lazyValidator as lazyValidator11,
|
|
2475
|
+
zodSchema as zodSchema12
|
|
2476
|
+
} from "@ai-sdk/provider-utils";
|
|
2477
|
+
import * as z14 from "zod/v4";
|
|
2478
|
+
var openaiResponsesChunkSchema = lazyValidator11(
|
|
2479
|
+
() => zodSchema12(
|
|
2480
|
+
z14.union([
|
|
2481
|
+
z14.object({
|
|
2482
|
+
type: z14.literal("response.output_text.delta"),
|
|
2483
|
+
item_id: z14.string(),
|
|
2484
|
+
delta: z14.string(),
|
|
2485
|
+
logprobs: z14.array(
|
|
2486
|
+
z14.object({
|
|
2487
|
+
token: z14.string(),
|
|
2488
|
+
logprob: z14.number(),
|
|
2489
|
+
top_logprobs: z14.array(
|
|
2490
|
+
z14.object({
|
|
2491
|
+
token: z14.string(),
|
|
2492
|
+
logprob: z14.number()
|
|
2493
|
+
})
|
|
2494
|
+
)
|
|
2495
|
+
})
|
|
2496
|
+
).nullish()
|
|
2497
|
+
}),
|
|
2498
|
+
z14.object({
|
|
2499
|
+
type: z14.enum(["response.completed", "response.incomplete"]),
|
|
2500
|
+
response: z14.object({
|
|
2501
|
+
incomplete_details: z14.object({ reason: z14.string() }).nullish(),
|
|
2502
|
+
usage: z14.object({
|
|
2503
|
+
input_tokens: z14.number(),
|
|
2504
|
+
input_tokens_details: z14.object({ cached_tokens: z14.number().nullish() }).nullish(),
|
|
2505
|
+
output_tokens: z14.number(),
|
|
2506
|
+
output_tokens_details: z14.object({ reasoning_tokens: z14.number().nullish() }).nullish()
|
|
2507
|
+
}),
|
|
2508
|
+
service_tier: z14.string().nullish()
|
|
2509
|
+
})
|
|
2510
|
+
}),
|
|
2511
|
+
z14.object({
|
|
2512
|
+
type: z14.literal("response.created"),
|
|
2513
|
+
response: z14.object({
|
|
2514
|
+
id: z14.string(),
|
|
2515
|
+
created_at: z14.number(),
|
|
2516
|
+
model: z14.string(),
|
|
2517
|
+
service_tier: z14.string().nullish()
|
|
2518
|
+
})
|
|
2519
|
+
}),
|
|
2520
|
+
z14.object({
|
|
2521
|
+
type: z14.literal("response.output_item.added"),
|
|
2522
|
+
output_index: z14.number(),
|
|
2523
|
+
item: z14.discriminatedUnion("type", [
|
|
2524
|
+
z14.object({
|
|
2525
|
+
type: z14.literal("message"),
|
|
2526
|
+
id: z14.string()
|
|
2527
|
+
}),
|
|
2528
|
+
z14.object({
|
|
2529
|
+
type: z14.literal("reasoning"),
|
|
2530
|
+
id: z14.string(),
|
|
2531
|
+
encrypted_content: z14.string().nullish()
|
|
2532
|
+
}),
|
|
2533
|
+
z14.object({
|
|
2534
|
+
type: z14.literal("function_call"),
|
|
2535
|
+
id: z14.string(),
|
|
2536
|
+
call_id: z14.string(),
|
|
2537
|
+
name: z14.string(),
|
|
2538
|
+
arguments: z14.string()
|
|
2539
|
+
}),
|
|
2540
|
+
z14.object({
|
|
2541
|
+
type: z14.literal("web_search_call"),
|
|
2542
|
+
id: z14.string(),
|
|
2543
|
+
status: z14.string(),
|
|
2544
|
+
action: z14.object({
|
|
2545
|
+
type: z14.literal("search"),
|
|
2546
|
+
query: z14.string().optional()
|
|
2547
|
+
}).nullish()
|
|
2548
|
+
}),
|
|
2549
|
+
z14.object({
|
|
2550
|
+
type: z14.literal("computer_call"),
|
|
2551
|
+
id: z14.string(),
|
|
2552
|
+
status: z14.string()
|
|
2553
|
+
}),
|
|
2554
|
+
z14.object({
|
|
2555
|
+
type: z14.literal("file_search_call"),
|
|
2556
|
+
id: z14.string()
|
|
2557
|
+
}),
|
|
2558
|
+
z14.object({
|
|
2559
|
+
type: z14.literal("image_generation_call"),
|
|
2560
|
+
id: z14.string()
|
|
2561
|
+
}),
|
|
2562
|
+
z14.object({
|
|
2563
|
+
type: z14.literal("code_interpreter_call"),
|
|
2564
|
+
id: z14.string(),
|
|
2565
|
+
container_id: z14.string(),
|
|
2566
|
+
code: z14.string().nullable(),
|
|
2567
|
+
outputs: z14.array(
|
|
2568
|
+
z14.discriminatedUnion("type", [
|
|
2569
|
+
z14.object({ type: z14.literal("logs"), logs: z14.string() }),
|
|
2570
|
+
z14.object({ type: z14.literal("image"), url: z14.string() })
|
|
2571
|
+
])
|
|
2572
|
+
).nullable(),
|
|
2573
|
+
status: z14.string()
|
|
2574
|
+
})
|
|
2575
|
+
])
|
|
2576
|
+
}),
|
|
2577
|
+
z14.object({
|
|
2578
|
+
type: z14.literal("response.output_item.done"),
|
|
2579
|
+
output_index: z14.number(),
|
|
2580
|
+
item: z14.discriminatedUnion("type", [
|
|
2581
|
+
z14.object({
|
|
2582
|
+
type: z14.literal("message"),
|
|
2583
|
+
id: z14.string()
|
|
2584
|
+
}),
|
|
2585
|
+
z14.object({
|
|
2586
|
+
type: z14.literal("reasoning"),
|
|
2587
|
+
id: z14.string(),
|
|
2588
|
+
encrypted_content: z14.string().nullish()
|
|
2589
|
+
}),
|
|
2590
|
+
z14.object({
|
|
2591
|
+
type: z14.literal("function_call"),
|
|
2592
|
+
id: z14.string(),
|
|
2593
|
+
call_id: z14.string(),
|
|
2594
|
+
name: z14.string(),
|
|
2595
|
+
arguments: z14.string(),
|
|
2596
|
+
status: z14.literal("completed")
|
|
2597
|
+
}),
|
|
2598
|
+
z14.object({
|
|
2599
|
+
type: z14.literal("code_interpreter_call"),
|
|
2600
|
+
id: z14.string(),
|
|
2601
|
+
code: z14.string().nullable(),
|
|
2602
|
+
container_id: z14.string(),
|
|
2603
|
+
outputs: z14.array(
|
|
2604
|
+
z14.discriminatedUnion("type", [
|
|
2605
|
+
z14.object({ type: z14.literal("logs"), logs: z14.string() }),
|
|
2606
|
+
z14.object({ type: z14.literal("image"), url: z14.string() })
|
|
2607
|
+
])
|
|
2608
|
+
).nullable()
|
|
2609
|
+
}),
|
|
2610
|
+
z14.object({
|
|
2611
|
+
type: z14.literal("image_generation_call"),
|
|
2612
|
+
id: z14.string(),
|
|
2613
|
+
result: z14.string()
|
|
2614
|
+
}),
|
|
2615
|
+
z14.object({
|
|
2616
|
+
type: z14.literal("web_search_call"),
|
|
2617
|
+
id: z14.string(),
|
|
2618
|
+
status: z14.string(),
|
|
2619
|
+
action: z14.discriminatedUnion("type", [
|
|
2620
|
+
z14.object({
|
|
2621
|
+
type: z14.literal("search"),
|
|
2622
|
+
query: z14.string().nullish()
|
|
2623
|
+
}),
|
|
2624
|
+
z14.object({
|
|
2625
|
+
type: z14.literal("open_page"),
|
|
2626
|
+
url: z14.string()
|
|
2627
|
+
}),
|
|
2628
|
+
z14.object({
|
|
2629
|
+
type: z14.literal("find"),
|
|
2630
|
+
url: z14.string(),
|
|
2631
|
+
pattern: z14.string()
|
|
2632
|
+
})
|
|
2633
|
+
]).nullish()
|
|
2634
|
+
}),
|
|
2635
|
+
z14.object({
|
|
2636
|
+
type: z14.literal("file_search_call"),
|
|
2637
|
+
id: z14.string(),
|
|
2638
|
+
queries: z14.array(z14.string()),
|
|
2639
|
+
results: z14.array(
|
|
2640
|
+
z14.object({
|
|
2641
|
+
attributes: z14.record(z14.string(), z14.unknown()),
|
|
2642
|
+
file_id: z14.string(),
|
|
2643
|
+
filename: z14.string(),
|
|
2644
|
+
score: z14.number(),
|
|
2645
|
+
text: z14.string()
|
|
2646
|
+
})
|
|
2647
|
+
).nullish()
|
|
2648
|
+
}),
|
|
2649
|
+
z14.object({
|
|
2650
|
+
type: z14.literal("local_shell_call"),
|
|
2651
|
+
id: z14.string(),
|
|
2652
|
+
call_id: z14.string(),
|
|
2653
|
+
action: z14.object({
|
|
2654
|
+
type: z14.literal("exec"),
|
|
2655
|
+
command: z14.array(z14.string()),
|
|
2656
|
+
timeout_ms: z14.number().optional(),
|
|
2657
|
+
user: z14.string().optional(),
|
|
2658
|
+
working_directory: z14.string().optional(),
|
|
2659
|
+
env: z14.record(z14.string(), z14.string()).optional()
|
|
2660
|
+
})
|
|
2661
|
+
}),
|
|
2662
|
+
z14.object({
|
|
2663
|
+
type: z14.literal("computer_call"),
|
|
2664
|
+
id: z14.string(),
|
|
2665
|
+
status: z14.literal("completed")
|
|
2666
|
+
})
|
|
2667
|
+
])
|
|
2668
|
+
}),
|
|
2669
|
+
z14.object({
|
|
2670
|
+
type: z14.literal("response.function_call_arguments.delta"),
|
|
2671
|
+
item_id: z14.string(),
|
|
2672
|
+
output_index: z14.number(),
|
|
2673
|
+
delta: z14.string()
|
|
2674
|
+
}),
|
|
2675
|
+
z14.object({
|
|
2676
|
+
type: z14.literal("response.image_generation_call.partial_image"),
|
|
2677
|
+
item_id: z14.string(),
|
|
2678
|
+
output_index: z14.number(),
|
|
2679
|
+
partial_image_b64: z14.string()
|
|
2680
|
+
}),
|
|
2681
|
+
z14.object({
|
|
2682
|
+
type: z14.literal("response.code_interpreter_call_code.delta"),
|
|
2683
|
+
item_id: z14.string(),
|
|
2684
|
+
output_index: z14.number(),
|
|
2685
|
+
delta: z14.string()
|
|
2686
|
+
}),
|
|
2687
|
+
z14.object({
|
|
2688
|
+
type: z14.literal("response.code_interpreter_call_code.done"),
|
|
2689
|
+
item_id: z14.string(),
|
|
2690
|
+
output_index: z14.number(),
|
|
2691
|
+
code: z14.string()
|
|
2692
|
+
}),
|
|
2693
|
+
z14.object({
|
|
2694
|
+
type: z14.literal("response.output_text.annotation.added"),
|
|
2695
|
+
annotation: z14.discriminatedUnion("type", [
|
|
2696
|
+
z14.object({
|
|
2697
|
+
type: z14.literal("url_citation"),
|
|
2698
|
+
url: z14.string(),
|
|
2699
|
+
title: z14.string()
|
|
2700
|
+
}),
|
|
2701
|
+
z14.object({
|
|
2702
|
+
type: z14.literal("file_citation"),
|
|
2703
|
+
file_id: z14.string(),
|
|
2704
|
+
filename: z14.string().nullish(),
|
|
2705
|
+
index: z14.number().nullish(),
|
|
2706
|
+
start_index: z14.number().nullish(),
|
|
2707
|
+
end_index: z14.number().nullish(),
|
|
2708
|
+
quote: z14.string().nullish()
|
|
2709
|
+
})
|
|
2710
|
+
])
|
|
2711
|
+
}),
|
|
2712
|
+
z14.object({
|
|
2713
|
+
type: z14.literal("response.reasoning_summary_part.added"),
|
|
2714
|
+
item_id: z14.string(),
|
|
2715
|
+
summary_index: z14.number()
|
|
2716
|
+
}),
|
|
2717
|
+
z14.object({
|
|
2718
|
+
type: z14.literal("response.reasoning_summary_text.delta"),
|
|
2719
|
+
item_id: z14.string(),
|
|
2720
|
+
summary_index: z14.number(),
|
|
2721
|
+
delta: z14.string()
|
|
2722
|
+
}),
|
|
2723
|
+
z14.object({
|
|
2724
|
+
type: z14.literal("error"),
|
|
2725
|
+
code: z14.string(),
|
|
2726
|
+
message: z14.string(),
|
|
2727
|
+
param: z14.string().nullish(),
|
|
2728
|
+
sequence_number: z14.number()
|
|
2729
|
+
}),
|
|
2730
|
+
z14.object({ type: z14.string() }).loose().transform((value) => ({
|
|
2731
|
+
type: "unknown_chunk",
|
|
2732
|
+
message: value.type
|
|
2733
|
+
}))
|
|
2734
|
+
// fallback for unknown chunks
|
|
2735
|
+
])
|
|
2736
|
+
)
|
|
2737
|
+
);
|
|
2738
|
+
var openaiResponsesResponseSchema = lazyValidator11(
|
|
2739
|
+
() => zodSchema12(
|
|
2740
|
+
z14.object({
|
|
2741
|
+
id: z14.string(),
|
|
2742
|
+
created_at: z14.number(),
|
|
2743
|
+
error: z14.object({
|
|
2744
|
+
code: z14.string(),
|
|
2745
|
+
message: z14.string()
|
|
2746
|
+
}).nullish(),
|
|
2747
|
+
model: z14.string(),
|
|
2748
|
+
output: z14.array(
|
|
2749
|
+
z14.discriminatedUnion("type", [
|
|
2750
|
+
z14.object({
|
|
2751
|
+
type: z14.literal("message"),
|
|
2752
|
+
role: z14.literal("assistant"),
|
|
2753
|
+
id: z14.string(),
|
|
2754
|
+
content: z14.array(
|
|
2755
|
+
z14.object({
|
|
2756
|
+
type: z14.literal("output_text"),
|
|
2757
|
+
text: z14.string(),
|
|
2758
|
+
logprobs: z14.array(
|
|
2759
|
+
z14.object({
|
|
2760
|
+
token: z14.string(),
|
|
2761
|
+
logprob: z14.number(),
|
|
2762
|
+
top_logprobs: z14.array(
|
|
2763
|
+
z14.object({
|
|
2764
|
+
token: z14.string(),
|
|
2765
|
+
logprob: z14.number()
|
|
2766
|
+
})
|
|
2767
|
+
)
|
|
2768
|
+
})
|
|
2769
|
+
).nullish(),
|
|
2770
|
+
annotations: z14.array(
|
|
2771
|
+
z14.discriminatedUnion("type", [
|
|
2772
|
+
z14.object({
|
|
2773
|
+
type: z14.literal("url_citation"),
|
|
2774
|
+
start_index: z14.number(),
|
|
2775
|
+
end_index: z14.number(),
|
|
2776
|
+
url: z14.string(),
|
|
2777
|
+
title: z14.string()
|
|
2778
|
+
}),
|
|
2779
|
+
z14.object({
|
|
2780
|
+
type: z14.literal("file_citation"),
|
|
2781
|
+
file_id: z14.string(),
|
|
2782
|
+
filename: z14.string().nullish(),
|
|
2783
|
+
index: z14.number().nullish(),
|
|
2784
|
+
start_index: z14.number().nullish(),
|
|
2785
|
+
end_index: z14.number().nullish(),
|
|
2786
|
+
quote: z14.string().nullish()
|
|
2787
|
+
}),
|
|
2788
|
+
z14.object({
|
|
2789
|
+
type: z14.literal("container_file_citation")
|
|
2790
|
+
})
|
|
2791
|
+
])
|
|
2792
|
+
)
|
|
2793
|
+
})
|
|
2794
|
+
)
|
|
2795
|
+
}),
|
|
2796
|
+
z14.object({
|
|
2797
|
+
type: z14.literal("web_search_call"),
|
|
2798
|
+
id: z14.string(),
|
|
2799
|
+
status: z14.string(),
|
|
2800
|
+
action: z14.discriminatedUnion("type", [
|
|
2801
|
+
z14.object({
|
|
2802
|
+
type: z14.literal("search"),
|
|
2803
|
+
query: z14.string().nullish()
|
|
2804
|
+
}),
|
|
2805
|
+
z14.object({
|
|
2806
|
+
type: z14.literal("open_page"),
|
|
2807
|
+
url: z14.string()
|
|
2808
|
+
}),
|
|
2809
|
+
z14.object({
|
|
2810
|
+
type: z14.literal("find"),
|
|
2811
|
+
url: z14.string(),
|
|
2812
|
+
pattern: z14.string()
|
|
2813
|
+
})
|
|
2814
|
+
]).nullish()
|
|
2815
|
+
}),
|
|
2816
|
+
z14.object({
|
|
2817
|
+
type: z14.literal("file_search_call"),
|
|
2818
|
+
id: z14.string(),
|
|
2819
|
+
queries: z14.array(z14.string()),
|
|
2820
|
+
results: z14.array(
|
|
2821
|
+
z14.object({
|
|
2822
|
+
attributes: z14.record(z14.string(), z14.unknown()),
|
|
2823
|
+
file_id: z14.string(),
|
|
2824
|
+
filename: z14.string(),
|
|
2825
|
+
score: z14.number(),
|
|
2826
|
+
text: z14.string()
|
|
2827
|
+
})
|
|
2828
|
+
).nullish()
|
|
2829
|
+
}),
|
|
2830
|
+
z14.object({
|
|
2831
|
+
type: z14.literal("code_interpreter_call"),
|
|
2832
|
+
id: z14.string(),
|
|
2833
|
+
code: z14.string().nullable(),
|
|
2834
|
+
container_id: z14.string(),
|
|
2835
|
+
outputs: z14.array(
|
|
2836
|
+
z14.discriminatedUnion("type", [
|
|
2837
|
+
z14.object({ type: z14.literal("logs"), logs: z14.string() }),
|
|
2838
|
+
z14.object({ type: z14.literal("image"), url: z14.string() })
|
|
2839
|
+
])
|
|
2840
|
+
).nullable()
|
|
2841
|
+
}),
|
|
2842
|
+
z14.object({
|
|
2843
|
+
type: z14.literal("image_generation_call"),
|
|
2844
|
+
id: z14.string(),
|
|
2845
|
+
result: z14.string()
|
|
2846
|
+
}),
|
|
2847
|
+
z14.object({
|
|
2848
|
+
type: z14.literal("local_shell_call"),
|
|
2849
|
+
id: z14.string(),
|
|
2850
|
+
call_id: z14.string(),
|
|
2851
|
+
action: z14.object({
|
|
2852
|
+
type: z14.literal("exec"),
|
|
2853
|
+
command: z14.array(z14.string()),
|
|
2854
|
+
timeout_ms: z14.number().optional(),
|
|
2855
|
+
user: z14.string().optional(),
|
|
2856
|
+
working_directory: z14.string().optional(),
|
|
2857
|
+
env: z14.record(z14.string(), z14.string()).optional()
|
|
2858
|
+
})
|
|
2859
|
+
}),
|
|
2860
|
+
z14.object({
|
|
2861
|
+
type: z14.literal("function_call"),
|
|
2862
|
+
call_id: z14.string(),
|
|
2863
|
+
name: z14.string(),
|
|
2864
|
+
arguments: z14.string(),
|
|
2865
|
+
id: z14.string()
|
|
2866
|
+
}),
|
|
2867
|
+
z14.object({
|
|
2868
|
+
type: z14.literal("computer_call"),
|
|
2869
|
+
id: z14.string(),
|
|
2870
|
+
status: z14.string().optional()
|
|
2871
|
+
}),
|
|
2872
|
+
z14.object({
|
|
2873
|
+
type: z14.literal("reasoning"),
|
|
2874
|
+
id: z14.string(),
|
|
2875
|
+
encrypted_content: z14.string().nullish(),
|
|
2876
|
+
summary: z14.array(
|
|
2877
|
+
z14.object({
|
|
2878
|
+
type: z14.literal("summary_text"),
|
|
2879
|
+
text: z14.string()
|
|
2880
|
+
})
|
|
2881
|
+
)
|
|
2882
|
+
})
|
|
2883
|
+
])
|
|
2884
|
+
),
|
|
2885
|
+
service_tier: z14.string().nullish(),
|
|
2886
|
+
incomplete_details: z14.object({ reason: z14.string() }).nullish(),
|
|
2887
|
+
usage: z14.object({
|
|
2888
|
+
input_tokens: z14.number(),
|
|
2889
|
+
input_tokens_details: z14.object({ cached_tokens: z14.number().nullish() }).nullish(),
|
|
2890
|
+
output_tokens: z14.number(),
|
|
2891
|
+
output_tokens_details: z14.object({ reasoning_tokens: z14.number().nullish() }).nullish()
|
|
2892
|
+
})
|
|
2893
|
+
})
|
|
2894
|
+
)
|
|
2895
|
+
);
|
|
2896
|
+
|
|
2897
|
+
// src/responses/openai-responses-options.ts
|
|
2898
|
+
import {
|
|
2899
|
+
lazyValidator as lazyValidator12,
|
|
2900
|
+
zodSchema as zodSchema13
|
|
2901
|
+
} from "@ai-sdk/provider-utils";
|
|
2902
|
+
import * as z15 from "zod/v4";
|
|
2903
|
+
var TOP_LOGPROBS_MAX = 20;
|
|
2904
|
+
var openaiResponsesReasoningModelIds = [
|
|
2905
|
+
"o1",
|
|
2906
|
+
"o1-2024-12-17",
|
|
2907
|
+
"o3-mini",
|
|
2908
|
+
"o3-mini-2025-01-31",
|
|
2909
|
+
"o3",
|
|
2910
|
+
"o3-2025-04-16",
|
|
2911
|
+
"o4-mini",
|
|
2912
|
+
"o4-mini-2025-04-16",
|
|
2913
|
+
"codex-mini-latest",
|
|
2914
|
+
"computer-use-preview",
|
|
2915
|
+
"gpt-5",
|
|
2916
|
+
"gpt-5-2025-08-07",
|
|
2917
|
+
"gpt-5-codex",
|
|
2918
|
+
"gpt-5-mini",
|
|
2919
|
+
"gpt-5-mini-2025-08-07",
|
|
2920
|
+
"gpt-5-nano",
|
|
2921
|
+
"gpt-5-nano-2025-08-07",
|
|
2922
|
+
"gpt-5-pro",
|
|
2923
|
+
"gpt-5-pro-2025-10-06"
|
|
2924
|
+
];
|
|
2925
|
+
var openaiResponsesModelIds = [
|
|
2926
|
+
"gpt-4.1",
|
|
2927
|
+
"gpt-4.1-2025-04-14",
|
|
2928
|
+
"gpt-4.1-mini",
|
|
2929
|
+
"gpt-4.1-mini-2025-04-14",
|
|
2930
|
+
"gpt-4.1-nano",
|
|
2931
|
+
"gpt-4.1-nano-2025-04-14",
|
|
2932
|
+
"gpt-4o",
|
|
2933
|
+
"gpt-4o-2024-05-13",
|
|
2934
|
+
"gpt-4o-2024-08-06",
|
|
2935
|
+
"gpt-4o-2024-11-20",
|
|
2936
|
+
"gpt-4o-audio-preview",
|
|
2937
|
+
"gpt-4o-audio-preview-2024-10-01",
|
|
2938
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
2939
|
+
"gpt-4o-search-preview",
|
|
2940
|
+
"gpt-4o-search-preview-2025-03-11",
|
|
2941
|
+
"gpt-4o-mini-search-preview",
|
|
2942
|
+
"gpt-4o-mini-search-preview-2025-03-11",
|
|
2943
|
+
"gpt-4o-mini",
|
|
2944
|
+
"gpt-4o-mini-2024-07-18",
|
|
2945
|
+
"gpt-4-turbo",
|
|
2946
|
+
"gpt-4-turbo-2024-04-09",
|
|
2947
|
+
"gpt-4-turbo-preview",
|
|
2948
|
+
"gpt-4-0125-preview",
|
|
2949
|
+
"gpt-4-1106-preview",
|
|
2950
|
+
"gpt-4",
|
|
2951
|
+
"gpt-4-0613",
|
|
2952
|
+
"gpt-4.5-preview",
|
|
2953
|
+
"gpt-4.5-preview-2025-02-27",
|
|
2954
|
+
"gpt-3.5-turbo-0125",
|
|
2955
|
+
"gpt-3.5-turbo",
|
|
2956
|
+
"gpt-3.5-turbo-1106",
|
|
2957
|
+
"chatgpt-4o-latest",
|
|
2958
|
+
"gpt-5-chat-latest",
|
|
2959
|
+
...openaiResponsesReasoningModelIds
|
|
2960
|
+
];
|
|
2961
|
+
var openaiResponsesProviderOptionsSchema = lazyValidator12(
|
|
2962
|
+
() => zodSchema13(
|
|
2963
|
+
z15.object({
|
|
2964
|
+
include: z15.array(
|
|
2965
|
+
z15.enum([
|
|
2966
|
+
"reasoning.encrypted_content",
|
|
2967
|
+
"file_search_call.results",
|
|
2968
|
+
"message.output_text.logprobs"
|
|
2969
|
+
])
|
|
2970
|
+
).nullish(),
|
|
2971
|
+
instructions: z15.string().nullish(),
|
|
2972
|
+
/**
|
|
2973
|
+
* Return the log probabilities of the tokens.
|
|
2974
|
+
*
|
|
2975
|
+
* Setting to true will return the log probabilities of the tokens that
|
|
2976
|
+
* were generated.
|
|
2977
|
+
*
|
|
2978
|
+
* Setting to a number will return the log probabilities of the top n
|
|
2979
|
+
* tokens that were generated.
|
|
2980
|
+
*
|
|
2981
|
+
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
2982
|
+
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
2983
|
+
*/
|
|
2984
|
+
logprobs: z15.union([z15.boolean(), z15.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
2985
|
+
/**
|
|
2986
|
+
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
2987
|
+
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
2988
|
+
* Any further attempts to call a tool by the model will be ignored.
|
|
2989
|
+
*/
|
|
2990
|
+
maxToolCalls: z15.number().nullish(),
|
|
2991
|
+
metadata: z15.any().nullish(),
|
|
2992
|
+
parallelToolCalls: z15.boolean().nullish(),
|
|
2993
|
+
previousResponseId: z15.string().nullish(),
|
|
2994
|
+
promptCacheKey: z15.string().nullish(),
|
|
2995
|
+
reasoningEffort: z15.string().nullish(),
|
|
2996
|
+
reasoningSummary: z15.string().nullish(),
|
|
2997
|
+
safetyIdentifier: z15.string().nullish(),
|
|
2998
|
+
serviceTier: z15.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
2999
|
+
store: z15.boolean().nullish(),
|
|
3000
|
+
strictJsonSchema: z15.boolean().nullish(),
|
|
3001
|
+
textVerbosity: z15.enum(["low", "medium", "high"]).nullish(),
|
|
3002
|
+
user: z15.string().nullish()
|
|
3003
|
+
})
|
|
3004
|
+
)
|
|
3005
|
+
);
|
|
3006
|
+
|
|
2342
3007
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2343
3008
|
import {
|
|
2344
3009
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError5
|
|
2345
3010
|
} from "@ai-sdk/provider";
|
|
2346
3011
|
|
|
2347
3012
|
// src/tool/code-interpreter.ts
|
|
2348
|
-
import {
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
var
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
])
|
|
2360
|
-
).nullish()
|
|
2361
|
-
});
|
|
2362
|
-
var codeInterpreterArgsSchema = z14.object({
|
|
2363
|
-
container: z14.union([
|
|
2364
|
-
z14.string(),
|
|
2365
|
-
z14.object({
|
|
2366
|
-
fileIds: z14.array(z14.string()).optional()
|
|
3013
|
+
import {
|
|
3014
|
+
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
|
|
3015
|
+
lazySchema as lazySchema2,
|
|
3016
|
+
zodSchema as zodSchema14
|
|
3017
|
+
} from "@ai-sdk/provider-utils";
|
|
3018
|
+
import * as z16 from "zod/v4";
|
|
3019
|
+
var codeInterpreterInputSchema = lazySchema2(
|
|
3020
|
+
() => zodSchema14(
|
|
3021
|
+
z16.object({
|
|
3022
|
+
code: z16.string().nullish(),
|
|
3023
|
+
containerId: z16.string()
|
|
2367
3024
|
})
|
|
2368
|
-
|
|
2369
|
-
|
|
3025
|
+
)
|
|
3026
|
+
);
|
|
3027
|
+
var codeInterpreterOutputSchema = lazySchema2(
|
|
3028
|
+
() => zodSchema14(
|
|
3029
|
+
z16.object({
|
|
3030
|
+
outputs: z16.array(
|
|
3031
|
+
z16.discriminatedUnion("type", [
|
|
3032
|
+
z16.object({ type: z16.literal("logs"), logs: z16.string() }),
|
|
3033
|
+
z16.object({ type: z16.literal("image"), url: z16.string() })
|
|
3034
|
+
])
|
|
3035
|
+
).nullish()
|
|
3036
|
+
})
|
|
3037
|
+
)
|
|
3038
|
+
);
|
|
3039
|
+
var codeInterpreterArgsSchema = lazySchema2(
|
|
3040
|
+
() => zodSchema14(
|
|
3041
|
+
z16.object({
|
|
3042
|
+
container: z16.union([
|
|
3043
|
+
z16.string(),
|
|
3044
|
+
z16.object({
|
|
3045
|
+
fileIds: z16.array(z16.string()).optional()
|
|
3046
|
+
})
|
|
3047
|
+
]).optional()
|
|
3048
|
+
})
|
|
3049
|
+
)
|
|
3050
|
+
);
|
|
2370
3051
|
var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema2({
|
|
2371
3052
|
id: "openai.code_interpreter",
|
|
2372
3053
|
name: "code_interpreter",
|
|
@@ -2378,169 +3059,216 @@ var codeInterpreter = (args = {}) => {
|
|
|
2378
3059
|
};
|
|
2379
3060
|
|
|
2380
3061
|
// src/tool/file-search.ts
|
|
2381
|
-
import {
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
3062
|
+
import {
|
|
3063
|
+
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
|
|
3064
|
+
lazySchema as lazySchema3,
|
|
3065
|
+
zodSchema as zodSchema15
|
|
3066
|
+
} from "@ai-sdk/provider-utils";
|
|
3067
|
+
import * as z17 from "zod/v4";
|
|
3068
|
+
var comparisonFilterSchema = z17.object({
|
|
3069
|
+
key: z17.string(),
|
|
3070
|
+
type: z17.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
|
|
3071
|
+
value: z17.union([z17.string(), z17.number(), z17.boolean()])
|
|
2387
3072
|
});
|
|
2388
|
-
var compoundFilterSchema =
|
|
2389
|
-
type:
|
|
2390
|
-
filters:
|
|
2391
|
-
|
|
3073
|
+
var compoundFilterSchema = z17.object({
|
|
3074
|
+
type: z17.enum(["and", "or"]),
|
|
3075
|
+
filters: z17.array(
|
|
3076
|
+
z17.union([comparisonFilterSchema, z17.lazy(() => compoundFilterSchema)])
|
|
2392
3077
|
)
|
|
2393
3078
|
});
|
|
2394
|
-
var fileSearchArgsSchema =
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
})
|
|
2403
|
-
|
|
2404
|
-
queries: z15.array(z15.string()),
|
|
2405
|
-
results: z15.array(
|
|
2406
|
-
z15.object({
|
|
2407
|
-
attributes: z15.record(z15.string(), z15.unknown()),
|
|
2408
|
-
fileId: z15.string(),
|
|
2409
|
-
filename: z15.string(),
|
|
2410
|
-
score: z15.number(),
|
|
2411
|
-
text: z15.string()
|
|
3079
|
+
var fileSearchArgsSchema = lazySchema3(
|
|
3080
|
+
() => zodSchema15(
|
|
3081
|
+
z17.object({
|
|
3082
|
+
vectorStoreIds: z17.array(z17.string()),
|
|
3083
|
+
maxNumResults: z17.number().optional(),
|
|
3084
|
+
ranking: z17.object({
|
|
3085
|
+
ranker: z17.string().optional(),
|
|
3086
|
+
scoreThreshold: z17.number().optional()
|
|
3087
|
+
}).optional(),
|
|
3088
|
+
filters: z17.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
2412
3089
|
})
|
|
2413
|
-
)
|
|
2414
|
-
|
|
3090
|
+
)
|
|
3091
|
+
);
|
|
3092
|
+
var fileSearchOutputSchema = lazySchema3(
|
|
3093
|
+
() => zodSchema15(
|
|
3094
|
+
z17.object({
|
|
3095
|
+
queries: z17.array(z17.string()),
|
|
3096
|
+
results: z17.array(
|
|
3097
|
+
z17.object({
|
|
3098
|
+
attributes: z17.record(z17.string(), z17.unknown()),
|
|
3099
|
+
fileId: z17.string(),
|
|
3100
|
+
filename: z17.string(),
|
|
3101
|
+
score: z17.number(),
|
|
3102
|
+
text: z17.string()
|
|
3103
|
+
})
|
|
3104
|
+
).nullable()
|
|
3105
|
+
})
|
|
3106
|
+
)
|
|
3107
|
+
);
|
|
2415
3108
|
var fileSearch = createProviderDefinedToolFactoryWithOutputSchema3({
|
|
2416
3109
|
id: "openai.file_search",
|
|
2417
3110
|
name: "file_search",
|
|
2418
|
-
inputSchema:
|
|
3111
|
+
inputSchema: z17.object({}),
|
|
2419
3112
|
outputSchema: fileSearchOutputSchema
|
|
2420
3113
|
});
|
|
2421
3114
|
|
|
2422
3115
|
// src/tool/web-search.ts
|
|
2423
|
-
import {
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
3116
|
+
import {
|
|
3117
|
+
createProviderDefinedToolFactory,
|
|
3118
|
+
lazySchema as lazySchema4,
|
|
3119
|
+
zodSchema as zodSchema16
|
|
3120
|
+
} from "@ai-sdk/provider-utils";
|
|
3121
|
+
import * as z18 from "zod/v4";
|
|
3122
|
+
var webSearchArgsSchema = lazySchema4(
|
|
3123
|
+
() => zodSchema16(
|
|
3124
|
+
z18.object({
|
|
3125
|
+
filters: z18.object({
|
|
3126
|
+
allowedDomains: z18.array(z18.string()).optional()
|
|
3127
|
+
}).optional(),
|
|
3128
|
+
searchContextSize: z18.enum(["low", "medium", "high"]).optional(),
|
|
3129
|
+
userLocation: z18.object({
|
|
3130
|
+
type: z18.literal("approximate"),
|
|
3131
|
+
country: z18.string().optional(),
|
|
3132
|
+
city: z18.string().optional(),
|
|
3133
|
+
region: z18.string().optional(),
|
|
3134
|
+
timezone: z18.string().optional()
|
|
3135
|
+
}).optional()
|
|
3136
|
+
})
|
|
3137
|
+
)
|
|
3138
|
+
);
|
|
3139
|
+
var webSearchInputSchema = lazySchema4(
|
|
3140
|
+
() => zodSchema16(
|
|
3141
|
+
z18.object({
|
|
3142
|
+
action: z18.discriminatedUnion("type", [
|
|
3143
|
+
z18.object({
|
|
3144
|
+
type: z18.literal("search"),
|
|
3145
|
+
query: z18.string().nullish()
|
|
3146
|
+
}),
|
|
3147
|
+
z18.object({
|
|
3148
|
+
type: z18.literal("open_page"),
|
|
3149
|
+
url: z18.string()
|
|
3150
|
+
}),
|
|
3151
|
+
z18.object({
|
|
3152
|
+
type: z18.literal("find"),
|
|
3153
|
+
url: z18.string(),
|
|
3154
|
+
pattern: z18.string()
|
|
3155
|
+
})
|
|
3156
|
+
]).nullish()
|
|
3157
|
+
})
|
|
3158
|
+
)
|
|
3159
|
+
);
|
|
2438
3160
|
var webSearchToolFactory = createProviderDefinedToolFactory({
|
|
2439
3161
|
id: "openai.web_search",
|
|
2440
3162
|
name: "web_search",
|
|
2441
|
-
inputSchema:
|
|
2442
|
-
action: z16.discriminatedUnion("type", [
|
|
2443
|
-
z16.object({
|
|
2444
|
-
type: z16.literal("search"),
|
|
2445
|
-
query: z16.string().nullish()
|
|
2446
|
-
}),
|
|
2447
|
-
z16.object({
|
|
2448
|
-
type: z16.literal("open_page"),
|
|
2449
|
-
url: z16.string()
|
|
2450
|
-
}),
|
|
2451
|
-
z16.object({
|
|
2452
|
-
type: z16.literal("find"),
|
|
2453
|
-
url: z16.string(),
|
|
2454
|
-
pattern: z16.string()
|
|
2455
|
-
})
|
|
2456
|
-
]).nullish()
|
|
2457
|
-
})
|
|
3163
|
+
inputSchema: webSearchInputSchema
|
|
2458
3164
|
});
|
|
2459
3165
|
|
|
2460
3166
|
// src/tool/web-search-preview.ts
|
|
2461
|
-
import {
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
3167
|
+
import {
|
|
3168
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
|
|
3169
|
+
lazySchema as lazySchema5,
|
|
3170
|
+
zodSchema as zodSchema17
|
|
3171
|
+
} from "@ai-sdk/provider-utils";
|
|
3172
|
+
import * as z19 from "zod/v4";
|
|
3173
|
+
var webSearchPreviewArgsSchema = lazySchema5(
|
|
3174
|
+
() => zodSchema17(
|
|
3175
|
+
z19.object({
|
|
3176
|
+
/**
|
|
3177
|
+
* Search context size to use for the web search.
|
|
3178
|
+
* - high: Most comprehensive context, highest cost, slower response
|
|
3179
|
+
* - medium: Balanced context, cost, and latency (default)
|
|
3180
|
+
* - low: Least context, lowest cost, fastest response
|
|
3181
|
+
*/
|
|
3182
|
+
searchContextSize: z19.enum(["low", "medium", "high"]).optional(),
|
|
3183
|
+
/**
|
|
3184
|
+
* User location information to provide geographically relevant search results.
|
|
3185
|
+
*/
|
|
3186
|
+
userLocation: z19.object({
|
|
3187
|
+
/**
|
|
3188
|
+
* Type of location (always 'approximate')
|
|
3189
|
+
*/
|
|
3190
|
+
type: z19.literal("approximate"),
|
|
3191
|
+
/**
|
|
3192
|
+
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
3193
|
+
*/
|
|
3194
|
+
country: z19.string().optional(),
|
|
3195
|
+
/**
|
|
3196
|
+
* City name (free text, e.g., 'Minneapolis')
|
|
3197
|
+
*/
|
|
3198
|
+
city: z19.string().optional(),
|
|
3199
|
+
/**
|
|
3200
|
+
* Region name (free text, e.g., 'Minnesota')
|
|
3201
|
+
*/
|
|
3202
|
+
region: z19.string().optional(),
|
|
3203
|
+
/**
|
|
3204
|
+
* IANA timezone (e.g., 'America/Chicago')
|
|
3205
|
+
*/
|
|
3206
|
+
timezone: z19.string().optional()
|
|
3207
|
+
}).optional()
|
|
3208
|
+
})
|
|
3209
|
+
)
|
|
3210
|
+
);
|
|
3211
|
+
var webSearchPreviewInputSchema = lazySchema5(
|
|
3212
|
+
() => zodSchema17(
|
|
3213
|
+
z19.object({
|
|
3214
|
+
action: z19.discriminatedUnion("type", [
|
|
3215
|
+
z19.object({
|
|
3216
|
+
type: z19.literal("search"),
|
|
3217
|
+
query: z19.string().nullish()
|
|
3218
|
+
}),
|
|
3219
|
+
z19.object({
|
|
3220
|
+
type: z19.literal("open_page"),
|
|
3221
|
+
url: z19.string()
|
|
3222
|
+
}),
|
|
3223
|
+
z19.object({
|
|
3224
|
+
type: z19.literal("find"),
|
|
3225
|
+
url: z19.string(),
|
|
3226
|
+
pattern: z19.string()
|
|
3227
|
+
})
|
|
3228
|
+
]).nullish()
|
|
3229
|
+
})
|
|
3230
|
+
)
|
|
3231
|
+
);
|
|
2497
3232
|
var webSearchPreview = createProviderDefinedToolFactory2({
|
|
2498
3233
|
id: "openai.web_search_preview",
|
|
2499
3234
|
name: "web_search_preview",
|
|
2500
|
-
inputSchema:
|
|
2501
|
-
action: z17.discriminatedUnion("type", [
|
|
2502
|
-
z17.object({
|
|
2503
|
-
type: z17.literal("search"),
|
|
2504
|
-
query: z17.string().nullish()
|
|
2505
|
-
}),
|
|
2506
|
-
z17.object({
|
|
2507
|
-
type: z17.literal("open_page"),
|
|
2508
|
-
url: z17.string()
|
|
2509
|
-
}),
|
|
2510
|
-
z17.object({
|
|
2511
|
-
type: z17.literal("find"),
|
|
2512
|
-
url: z17.string(),
|
|
2513
|
-
pattern: z17.string()
|
|
2514
|
-
})
|
|
2515
|
-
]).nullish()
|
|
2516
|
-
})
|
|
3235
|
+
inputSchema: webSearchPreviewInputSchema
|
|
2517
3236
|
});
|
|
2518
3237
|
|
|
2519
3238
|
// src/tool/image-generation.ts
|
|
2520
|
-
import {
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
3239
|
+
import {
|
|
3240
|
+
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
|
|
3241
|
+
lazySchema as lazySchema6,
|
|
3242
|
+
zodSchema as zodSchema18
|
|
3243
|
+
} from "@ai-sdk/provider-utils";
|
|
3244
|
+
import * as z20 from "zod/v4";
|
|
3245
|
+
var imageGenerationArgsSchema = lazySchema6(
|
|
3246
|
+
() => zodSchema18(
|
|
3247
|
+
z20.object({
|
|
3248
|
+
background: z20.enum(["auto", "opaque", "transparent"]).optional(),
|
|
3249
|
+
inputFidelity: z20.enum(["low", "high"]).optional(),
|
|
3250
|
+
inputImageMask: z20.object({
|
|
3251
|
+
fileId: z20.string().optional(),
|
|
3252
|
+
imageUrl: z20.string().optional()
|
|
3253
|
+
}).optional(),
|
|
3254
|
+
model: z20.string().optional(),
|
|
3255
|
+
moderation: z20.enum(["auto"]).optional(),
|
|
3256
|
+
outputCompression: z20.number().int().min(0).max(100).optional(),
|
|
3257
|
+
outputFormat: z20.enum(["png", "jpeg", "webp"]).optional(),
|
|
3258
|
+
partialImages: z20.number().int().min(0).max(3).optional(),
|
|
3259
|
+
quality: z20.enum(["auto", "low", "medium", "high"]).optional(),
|
|
3260
|
+
size: z20.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
3261
|
+
}).strict()
|
|
3262
|
+
)
|
|
3263
|
+
);
|
|
3264
|
+
var imageGenerationInputSchema = lazySchema6(() => zodSchema18(z20.object({})));
|
|
3265
|
+
var imageGenerationOutputSchema = lazySchema6(
|
|
3266
|
+
() => zodSchema18(z20.object({ result: z20.string() }))
|
|
3267
|
+
);
|
|
2540
3268
|
var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
2541
3269
|
id: "openai.image_generation",
|
|
2542
3270
|
name: "image_generation",
|
|
2543
|
-
inputSchema:
|
|
3271
|
+
inputSchema: imageGenerationInputSchema,
|
|
2544
3272
|
outputSchema: imageGenerationOutputSchema
|
|
2545
3273
|
});
|
|
2546
3274
|
var imageGeneration = (args = {}) => {
|
|
@@ -2548,7 +3276,8 @@ var imageGeneration = (args = {}) => {
|
|
|
2548
3276
|
};
|
|
2549
3277
|
|
|
2550
3278
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2551
|
-
|
|
3279
|
+
import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
|
|
3280
|
+
async function prepareResponsesTools({
|
|
2552
3281
|
tools,
|
|
2553
3282
|
toolChoice,
|
|
2554
3283
|
strictJsonSchema
|
|
@@ -2573,7 +3302,10 @@ function prepareResponsesTools({
|
|
|
2573
3302
|
case "provider-defined": {
|
|
2574
3303
|
switch (tool.id) {
|
|
2575
3304
|
case "openai.file_search": {
|
|
2576
|
-
const args =
|
|
3305
|
+
const args = await validateTypes2({
|
|
3306
|
+
value: tool.args,
|
|
3307
|
+
schema: fileSearchArgsSchema
|
|
3308
|
+
});
|
|
2577
3309
|
openaiTools.push({
|
|
2578
3310
|
type: "file_search",
|
|
2579
3311
|
vector_store_ids: args.vectorStoreIds,
|
|
@@ -2593,7 +3325,10 @@ function prepareResponsesTools({
|
|
|
2593
3325
|
break;
|
|
2594
3326
|
}
|
|
2595
3327
|
case "openai.web_search_preview": {
|
|
2596
|
-
const args =
|
|
3328
|
+
const args = await validateTypes2({
|
|
3329
|
+
value: tool.args,
|
|
3330
|
+
schema: webSearchPreviewArgsSchema
|
|
3331
|
+
});
|
|
2597
3332
|
openaiTools.push({
|
|
2598
3333
|
type: "web_search_preview",
|
|
2599
3334
|
search_context_size: args.searchContextSize,
|
|
@@ -2602,7 +3337,10 @@ function prepareResponsesTools({
|
|
|
2602
3337
|
break;
|
|
2603
3338
|
}
|
|
2604
3339
|
case "openai.web_search": {
|
|
2605
|
-
const args =
|
|
3340
|
+
const args = await validateTypes2({
|
|
3341
|
+
value: tool.args,
|
|
3342
|
+
schema: webSearchArgsSchema
|
|
3343
|
+
});
|
|
2606
3344
|
openaiTools.push({
|
|
2607
3345
|
type: "web_search",
|
|
2608
3346
|
filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
|
|
@@ -2612,7 +3350,10 @@ function prepareResponsesTools({
|
|
|
2612
3350
|
break;
|
|
2613
3351
|
}
|
|
2614
3352
|
case "openai.code_interpreter": {
|
|
2615
|
-
const args =
|
|
3353
|
+
const args = await validateTypes2({
|
|
3354
|
+
value: tool.args,
|
|
3355
|
+
schema: codeInterpreterArgsSchema
|
|
3356
|
+
});
|
|
2616
3357
|
openaiTools.push({
|
|
2617
3358
|
type: "code_interpreter",
|
|
2618
3359
|
container: args.container == null ? { type: "auto", file_ids: void 0 } : typeof args.container === "string" ? args.container : { type: "auto", file_ids: args.container.fileIds }
|
|
@@ -2620,7 +3361,10 @@ function prepareResponsesTools({
|
|
|
2620
3361
|
break;
|
|
2621
3362
|
}
|
|
2622
3363
|
case "openai.image_generation": {
|
|
2623
|
-
const args =
|
|
3364
|
+
const args = await validateTypes2({
|
|
3365
|
+
value: tool.args,
|
|
3366
|
+
schema: imageGenerationArgsSchema
|
|
3367
|
+
});
|
|
2624
3368
|
openaiTools.push({
|
|
2625
3369
|
type: "image_generation",
|
|
2626
3370
|
background: args.background,
|
|
@@ -2672,83 +3416,6 @@ function prepareResponsesTools({
|
|
|
2672
3416
|
}
|
|
2673
3417
|
|
|
2674
3418
|
// src/responses/openai-responses-language-model.ts
|
|
2675
|
-
var webSearchCallItem = z19.object({
|
|
2676
|
-
type: z19.literal("web_search_call"),
|
|
2677
|
-
id: z19.string(),
|
|
2678
|
-
status: z19.string(),
|
|
2679
|
-
action: z19.discriminatedUnion("type", [
|
|
2680
|
-
z19.object({
|
|
2681
|
-
type: z19.literal("search"),
|
|
2682
|
-
query: z19.string().nullish()
|
|
2683
|
-
}),
|
|
2684
|
-
z19.object({
|
|
2685
|
-
type: z19.literal("open_page"),
|
|
2686
|
-
url: z19.string()
|
|
2687
|
-
}),
|
|
2688
|
-
z19.object({
|
|
2689
|
-
type: z19.literal("find"),
|
|
2690
|
-
url: z19.string(),
|
|
2691
|
-
pattern: z19.string()
|
|
2692
|
-
})
|
|
2693
|
-
]).nullish()
|
|
2694
|
-
});
|
|
2695
|
-
var fileSearchCallItem = z19.object({
|
|
2696
|
-
type: z19.literal("file_search_call"),
|
|
2697
|
-
id: z19.string(),
|
|
2698
|
-
queries: z19.array(z19.string()),
|
|
2699
|
-
results: z19.array(
|
|
2700
|
-
z19.object({
|
|
2701
|
-
attributes: z19.record(z19.string(), z19.unknown()),
|
|
2702
|
-
file_id: z19.string(),
|
|
2703
|
-
filename: z19.string(),
|
|
2704
|
-
score: z19.number(),
|
|
2705
|
-
text: z19.string()
|
|
2706
|
-
})
|
|
2707
|
-
).nullish()
|
|
2708
|
-
});
|
|
2709
|
-
var codeInterpreterCallItem = z19.object({
|
|
2710
|
-
type: z19.literal("code_interpreter_call"),
|
|
2711
|
-
id: z19.string(),
|
|
2712
|
-
code: z19.string().nullable(),
|
|
2713
|
-
container_id: z19.string(),
|
|
2714
|
-
outputs: z19.array(
|
|
2715
|
-
z19.discriminatedUnion("type", [
|
|
2716
|
-
z19.object({ type: z19.literal("logs"), logs: z19.string() }),
|
|
2717
|
-
z19.object({ type: z19.literal("image"), url: z19.string() })
|
|
2718
|
-
])
|
|
2719
|
-
).nullable()
|
|
2720
|
-
});
|
|
2721
|
-
var localShellCallItem = z19.object({
|
|
2722
|
-
type: z19.literal("local_shell_call"),
|
|
2723
|
-
id: z19.string(),
|
|
2724
|
-
call_id: z19.string(),
|
|
2725
|
-
action: z19.object({
|
|
2726
|
-
type: z19.literal("exec"),
|
|
2727
|
-
command: z19.array(z19.string()),
|
|
2728
|
-
timeout_ms: z19.number().optional(),
|
|
2729
|
-
user: z19.string().optional(),
|
|
2730
|
-
working_directory: z19.string().optional(),
|
|
2731
|
-
env: z19.record(z19.string(), z19.string()).optional()
|
|
2732
|
-
})
|
|
2733
|
-
});
|
|
2734
|
-
var imageGenerationCallItem = z19.object({
|
|
2735
|
-
type: z19.literal("image_generation_call"),
|
|
2736
|
-
id: z19.string(),
|
|
2737
|
-
result: z19.string()
|
|
2738
|
-
});
|
|
2739
|
-
var TOP_LOGPROBS_MAX = 20;
|
|
2740
|
-
var LOGPROBS_SCHEMA = z19.array(
|
|
2741
|
-
z19.object({
|
|
2742
|
-
token: z19.string(),
|
|
2743
|
-
logprob: z19.number(),
|
|
2744
|
-
top_logprobs: z19.array(
|
|
2745
|
-
z19.object({
|
|
2746
|
-
token: z19.string(),
|
|
2747
|
-
logprob: z19.number()
|
|
2748
|
-
})
|
|
2749
|
-
)
|
|
2750
|
-
})
|
|
2751
|
-
);
|
|
2752
3419
|
var OpenAIResponsesLanguageModel = class {
|
|
2753
3420
|
constructor(modelId, config) {
|
|
2754
3421
|
this.specificationVersion = "v3";
|
|
@@ -2940,7 +3607,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2940
3607
|
tools: openaiTools,
|
|
2941
3608
|
toolChoice: openaiToolChoice,
|
|
2942
3609
|
toolWarnings
|
|
2943
|
-
} = prepareResponsesTools({
|
|
3610
|
+
} = await prepareResponsesTools({
|
|
2944
3611
|
tools,
|
|
2945
3612
|
toolChoice,
|
|
2946
3613
|
strictJsonSchema
|
|
@@ -2976,85 +3643,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2976
3643
|
body,
|
|
2977
3644
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2978
3645
|
successfulResponseHandler: createJsonResponseHandler6(
|
|
2979
|
-
|
|
2980
|
-
id: z19.string(),
|
|
2981
|
-
created_at: z19.number(),
|
|
2982
|
-
error: z19.object({
|
|
2983
|
-
code: z19.string(),
|
|
2984
|
-
message: z19.string()
|
|
2985
|
-
}).nullish(),
|
|
2986
|
-
model: z19.string(),
|
|
2987
|
-
output: z19.array(
|
|
2988
|
-
z19.discriminatedUnion("type", [
|
|
2989
|
-
z19.object({
|
|
2990
|
-
type: z19.literal("message"),
|
|
2991
|
-
role: z19.literal("assistant"),
|
|
2992
|
-
id: z19.string(),
|
|
2993
|
-
content: z19.array(
|
|
2994
|
-
z19.object({
|
|
2995
|
-
type: z19.literal("output_text"),
|
|
2996
|
-
text: z19.string(),
|
|
2997
|
-
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2998
|
-
annotations: z19.array(
|
|
2999
|
-
z19.discriminatedUnion("type", [
|
|
3000
|
-
z19.object({
|
|
3001
|
-
type: z19.literal("url_citation"),
|
|
3002
|
-
start_index: z19.number(),
|
|
3003
|
-
end_index: z19.number(),
|
|
3004
|
-
url: z19.string(),
|
|
3005
|
-
title: z19.string()
|
|
3006
|
-
}),
|
|
3007
|
-
z19.object({
|
|
3008
|
-
type: z19.literal("file_citation"),
|
|
3009
|
-
file_id: z19.string(),
|
|
3010
|
-
filename: z19.string().nullish(),
|
|
3011
|
-
index: z19.number().nullish(),
|
|
3012
|
-
start_index: z19.number().nullish(),
|
|
3013
|
-
end_index: z19.number().nullish(),
|
|
3014
|
-
quote: z19.string().nullish()
|
|
3015
|
-
}),
|
|
3016
|
-
z19.object({
|
|
3017
|
-
type: z19.literal("container_file_citation")
|
|
3018
|
-
})
|
|
3019
|
-
])
|
|
3020
|
-
)
|
|
3021
|
-
})
|
|
3022
|
-
)
|
|
3023
|
-
}),
|
|
3024
|
-
webSearchCallItem,
|
|
3025
|
-
fileSearchCallItem,
|
|
3026
|
-
codeInterpreterCallItem,
|
|
3027
|
-
imageGenerationCallItem,
|
|
3028
|
-
localShellCallItem,
|
|
3029
|
-
z19.object({
|
|
3030
|
-
type: z19.literal("function_call"),
|
|
3031
|
-
call_id: z19.string(),
|
|
3032
|
-
name: z19.string(),
|
|
3033
|
-
arguments: z19.string(),
|
|
3034
|
-
id: z19.string()
|
|
3035
|
-
}),
|
|
3036
|
-
z19.object({
|
|
3037
|
-
type: z19.literal("computer_call"),
|
|
3038
|
-
id: z19.string(),
|
|
3039
|
-
status: z19.string().optional()
|
|
3040
|
-
}),
|
|
3041
|
-
z19.object({
|
|
3042
|
-
type: z19.literal("reasoning"),
|
|
3043
|
-
id: z19.string(),
|
|
3044
|
-
encrypted_content: z19.string().nullish(),
|
|
3045
|
-
summary: z19.array(
|
|
3046
|
-
z19.object({
|
|
3047
|
-
type: z19.literal("summary_text"),
|
|
3048
|
-
text: z19.string()
|
|
3049
|
-
})
|
|
3050
|
-
)
|
|
3051
|
-
})
|
|
3052
|
-
])
|
|
3053
|
-
),
|
|
3054
|
-
service_tier: z19.string().nullish(),
|
|
3055
|
-
incomplete_details: z19.object({ reason: z19.string() }).nullish(),
|
|
3056
|
-
usage: usageSchema2
|
|
3057
|
-
})
|
|
3646
|
+
openaiResponsesResponseSchema
|
|
3058
3647
|
),
|
|
3059
3648
|
abortSignal: options.abortSignal,
|
|
3060
3649
|
fetch: this.config.fetch
|
|
@@ -3117,7 +3706,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3117
3706
|
type: "tool-call",
|
|
3118
3707
|
toolCallId: part.call_id,
|
|
3119
3708
|
toolName: "local_shell",
|
|
3120
|
-
input: JSON.stringify({
|
|
3709
|
+
input: JSON.stringify({
|
|
3710
|
+
action: part.action
|
|
3711
|
+
}),
|
|
3121
3712
|
providerMetadata: {
|
|
3122
3713
|
openai: {
|
|
3123
3714
|
itemId: part.id
|
|
@@ -3748,203 +4339,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3748
4339
|
};
|
|
3749
4340
|
}
|
|
3750
4341
|
};
|
|
3751
|
-
var usageSchema2 = z19.object({
|
|
3752
|
-
input_tokens: z19.number(),
|
|
3753
|
-
input_tokens_details: z19.object({ cached_tokens: z19.number().nullish() }).nullish(),
|
|
3754
|
-
output_tokens: z19.number(),
|
|
3755
|
-
output_tokens_details: z19.object({ reasoning_tokens: z19.number().nullish() }).nullish()
|
|
3756
|
-
});
|
|
3757
|
-
var textDeltaChunkSchema = z19.object({
|
|
3758
|
-
type: z19.literal("response.output_text.delta"),
|
|
3759
|
-
item_id: z19.string(),
|
|
3760
|
-
delta: z19.string(),
|
|
3761
|
-
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3762
|
-
});
|
|
3763
|
-
var errorChunkSchema = z19.object({
|
|
3764
|
-
type: z19.literal("error"),
|
|
3765
|
-
code: z19.string(),
|
|
3766
|
-
message: z19.string(),
|
|
3767
|
-
param: z19.string().nullish(),
|
|
3768
|
-
sequence_number: z19.number()
|
|
3769
|
-
});
|
|
3770
|
-
var responseFinishedChunkSchema = z19.object({
|
|
3771
|
-
type: z19.enum(["response.completed", "response.incomplete"]),
|
|
3772
|
-
response: z19.object({
|
|
3773
|
-
incomplete_details: z19.object({ reason: z19.string() }).nullish(),
|
|
3774
|
-
usage: usageSchema2,
|
|
3775
|
-
service_tier: z19.string().nullish()
|
|
3776
|
-
})
|
|
3777
|
-
});
|
|
3778
|
-
var responseCreatedChunkSchema = z19.object({
|
|
3779
|
-
type: z19.literal("response.created"),
|
|
3780
|
-
response: z19.object({
|
|
3781
|
-
id: z19.string(),
|
|
3782
|
-
created_at: z19.number(),
|
|
3783
|
-
model: z19.string(),
|
|
3784
|
-
service_tier: z19.string().nullish()
|
|
3785
|
-
})
|
|
3786
|
-
});
|
|
3787
|
-
var responseOutputItemAddedSchema = z19.object({
|
|
3788
|
-
type: z19.literal("response.output_item.added"),
|
|
3789
|
-
output_index: z19.number(),
|
|
3790
|
-
item: z19.discriminatedUnion("type", [
|
|
3791
|
-
z19.object({
|
|
3792
|
-
type: z19.literal("message"),
|
|
3793
|
-
id: z19.string()
|
|
3794
|
-
}),
|
|
3795
|
-
z19.object({
|
|
3796
|
-
type: z19.literal("reasoning"),
|
|
3797
|
-
id: z19.string(),
|
|
3798
|
-
encrypted_content: z19.string().nullish()
|
|
3799
|
-
}),
|
|
3800
|
-
z19.object({
|
|
3801
|
-
type: z19.literal("function_call"),
|
|
3802
|
-
id: z19.string(),
|
|
3803
|
-
call_id: z19.string(),
|
|
3804
|
-
name: z19.string(),
|
|
3805
|
-
arguments: z19.string()
|
|
3806
|
-
}),
|
|
3807
|
-
z19.object({
|
|
3808
|
-
type: z19.literal("web_search_call"),
|
|
3809
|
-
id: z19.string(),
|
|
3810
|
-
status: z19.string(),
|
|
3811
|
-
action: z19.object({
|
|
3812
|
-
type: z19.literal("search"),
|
|
3813
|
-
query: z19.string().optional()
|
|
3814
|
-
}).nullish()
|
|
3815
|
-
}),
|
|
3816
|
-
z19.object({
|
|
3817
|
-
type: z19.literal("computer_call"),
|
|
3818
|
-
id: z19.string(),
|
|
3819
|
-
status: z19.string()
|
|
3820
|
-
}),
|
|
3821
|
-
z19.object({
|
|
3822
|
-
type: z19.literal("file_search_call"),
|
|
3823
|
-
id: z19.string()
|
|
3824
|
-
}),
|
|
3825
|
-
z19.object({
|
|
3826
|
-
type: z19.literal("image_generation_call"),
|
|
3827
|
-
id: z19.string()
|
|
3828
|
-
}),
|
|
3829
|
-
z19.object({
|
|
3830
|
-
type: z19.literal("code_interpreter_call"),
|
|
3831
|
-
id: z19.string(),
|
|
3832
|
-
container_id: z19.string(),
|
|
3833
|
-
code: z19.string().nullable(),
|
|
3834
|
-
outputs: z19.array(
|
|
3835
|
-
z19.discriminatedUnion("type", [
|
|
3836
|
-
z19.object({ type: z19.literal("logs"), logs: z19.string() }),
|
|
3837
|
-
z19.object({ type: z19.literal("image"), url: z19.string() })
|
|
3838
|
-
])
|
|
3839
|
-
).nullable(),
|
|
3840
|
-
status: z19.string()
|
|
3841
|
-
})
|
|
3842
|
-
])
|
|
3843
|
-
});
|
|
3844
|
-
var responseOutputItemDoneSchema = z19.object({
|
|
3845
|
-
type: z19.literal("response.output_item.done"),
|
|
3846
|
-
output_index: z19.number(),
|
|
3847
|
-
item: z19.discriminatedUnion("type", [
|
|
3848
|
-
z19.object({
|
|
3849
|
-
type: z19.literal("message"),
|
|
3850
|
-
id: z19.string()
|
|
3851
|
-
}),
|
|
3852
|
-
z19.object({
|
|
3853
|
-
type: z19.literal("reasoning"),
|
|
3854
|
-
id: z19.string(),
|
|
3855
|
-
encrypted_content: z19.string().nullish()
|
|
3856
|
-
}),
|
|
3857
|
-
z19.object({
|
|
3858
|
-
type: z19.literal("function_call"),
|
|
3859
|
-
id: z19.string(),
|
|
3860
|
-
call_id: z19.string(),
|
|
3861
|
-
name: z19.string(),
|
|
3862
|
-
arguments: z19.string(),
|
|
3863
|
-
status: z19.literal("completed")
|
|
3864
|
-
}),
|
|
3865
|
-
codeInterpreterCallItem,
|
|
3866
|
-
imageGenerationCallItem,
|
|
3867
|
-
webSearchCallItem,
|
|
3868
|
-
fileSearchCallItem,
|
|
3869
|
-
localShellCallItem,
|
|
3870
|
-
z19.object({
|
|
3871
|
-
type: z19.literal("computer_call"),
|
|
3872
|
-
id: z19.string(),
|
|
3873
|
-
status: z19.literal("completed")
|
|
3874
|
-
})
|
|
3875
|
-
])
|
|
3876
|
-
});
|
|
3877
|
-
var responseFunctionCallArgumentsDeltaSchema = z19.object({
|
|
3878
|
-
type: z19.literal("response.function_call_arguments.delta"),
|
|
3879
|
-
item_id: z19.string(),
|
|
3880
|
-
output_index: z19.number(),
|
|
3881
|
-
delta: z19.string()
|
|
3882
|
-
});
|
|
3883
|
-
var responseImageGenerationCallPartialImageSchema = z19.object({
|
|
3884
|
-
type: z19.literal("response.image_generation_call.partial_image"),
|
|
3885
|
-
item_id: z19.string(),
|
|
3886
|
-
output_index: z19.number(),
|
|
3887
|
-
partial_image_b64: z19.string()
|
|
3888
|
-
});
|
|
3889
|
-
var responseCodeInterpreterCallCodeDeltaSchema = z19.object({
|
|
3890
|
-
type: z19.literal("response.code_interpreter_call_code.delta"),
|
|
3891
|
-
item_id: z19.string(),
|
|
3892
|
-
output_index: z19.number(),
|
|
3893
|
-
delta: z19.string()
|
|
3894
|
-
});
|
|
3895
|
-
var responseCodeInterpreterCallCodeDoneSchema = z19.object({
|
|
3896
|
-
type: z19.literal("response.code_interpreter_call_code.done"),
|
|
3897
|
-
item_id: z19.string(),
|
|
3898
|
-
output_index: z19.number(),
|
|
3899
|
-
code: z19.string()
|
|
3900
|
-
});
|
|
3901
|
-
var responseAnnotationAddedSchema = z19.object({
|
|
3902
|
-
type: z19.literal("response.output_text.annotation.added"),
|
|
3903
|
-
annotation: z19.discriminatedUnion("type", [
|
|
3904
|
-
z19.object({
|
|
3905
|
-
type: z19.literal("url_citation"),
|
|
3906
|
-
url: z19.string(),
|
|
3907
|
-
title: z19.string()
|
|
3908
|
-
}),
|
|
3909
|
-
z19.object({
|
|
3910
|
-
type: z19.literal("file_citation"),
|
|
3911
|
-
file_id: z19.string(),
|
|
3912
|
-
filename: z19.string().nullish(),
|
|
3913
|
-
index: z19.number().nullish(),
|
|
3914
|
-
start_index: z19.number().nullish(),
|
|
3915
|
-
end_index: z19.number().nullish(),
|
|
3916
|
-
quote: z19.string().nullish()
|
|
3917
|
-
})
|
|
3918
|
-
])
|
|
3919
|
-
});
|
|
3920
|
-
var responseReasoningSummaryPartAddedSchema = z19.object({
|
|
3921
|
-
type: z19.literal("response.reasoning_summary_part.added"),
|
|
3922
|
-
item_id: z19.string(),
|
|
3923
|
-
summary_index: z19.number()
|
|
3924
|
-
});
|
|
3925
|
-
var responseReasoningSummaryTextDeltaSchema = z19.object({
|
|
3926
|
-
type: z19.literal("response.reasoning_summary_text.delta"),
|
|
3927
|
-
item_id: z19.string(),
|
|
3928
|
-
summary_index: z19.number(),
|
|
3929
|
-
delta: z19.string()
|
|
3930
|
-
});
|
|
3931
|
-
var openaiResponsesChunkSchema = z19.union([
|
|
3932
|
-
textDeltaChunkSchema,
|
|
3933
|
-
responseFinishedChunkSchema,
|
|
3934
|
-
responseCreatedChunkSchema,
|
|
3935
|
-
responseOutputItemAddedSchema,
|
|
3936
|
-
responseOutputItemDoneSchema,
|
|
3937
|
-
responseFunctionCallArgumentsDeltaSchema,
|
|
3938
|
-
responseImageGenerationCallPartialImageSchema,
|
|
3939
|
-
responseCodeInterpreterCallCodeDeltaSchema,
|
|
3940
|
-
responseCodeInterpreterCallCodeDoneSchema,
|
|
3941
|
-
responseAnnotationAddedSchema,
|
|
3942
|
-
responseReasoningSummaryPartAddedSchema,
|
|
3943
|
-
responseReasoningSummaryTextDeltaSchema,
|
|
3944
|
-
errorChunkSchema,
|
|
3945
|
-
z19.object({ type: z19.string() }).loose()
|
|
3946
|
-
// fallback for unknown chunks
|
|
3947
|
-
]);
|
|
3948
4342
|
function isTextDeltaChunk(chunk) {
|
|
3949
4343
|
return chunk.type === "response.output_text.delta";
|
|
3950
4344
|
}
|
|
@@ -4024,47 +4418,6 @@ function getResponsesModelConfig(modelId) {
|
|
|
4024
4418
|
isReasoningModel: false
|
|
4025
4419
|
};
|
|
4026
4420
|
}
|
|
4027
|
-
var openaiResponsesProviderOptionsSchema = z19.object({
|
|
4028
|
-
include: z19.array(
|
|
4029
|
-
z19.enum([
|
|
4030
|
-
"reasoning.encrypted_content",
|
|
4031
|
-
"file_search_call.results",
|
|
4032
|
-
"message.output_text.logprobs"
|
|
4033
|
-
])
|
|
4034
|
-
).nullish(),
|
|
4035
|
-
instructions: z19.string().nullish(),
|
|
4036
|
-
/**
|
|
4037
|
-
* Return the log probabilities of the tokens.
|
|
4038
|
-
*
|
|
4039
|
-
* Setting to true will return the log probabilities of the tokens that
|
|
4040
|
-
* were generated.
|
|
4041
|
-
*
|
|
4042
|
-
* Setting to a number will return the log probabilities of the top n
|
|
4043
|
-
* tokens that were generated.
|
|
4044
|
-
*
|
|
4045
|
-
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
4046
|
-
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
4047
|
-
*/
|
|
4048
|
-
logprobs: z19.union([z19.boolean(), z19.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
4049
|
-
/**
|
|
4050
|
-
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
4051
|
-
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
4052
|
-
* Any further attempts to call a tool by the model will be ignored.
|
|
4053
|
-
*/
|
|
4054
|
-
maxToolCalls: z19.number().nullish(),
|
|
4055
|
-
metadata: z19.any().nullish(),
|
|
4056
|
-
parallelToolCalls: z19.boolean().nullish(),
|
|
4057
|
-
previousResponseId: z19.string().nullish(),
|
|
4058
|
-
promptCacheKey: z19.string().nullish(),
|
|
4059
|
-
reasoningEffort: z19.string().nullish(),
|
|
4060
|
-
reasoningSummary: z19.string().nullish(),
|
|
4061
|
-
safetyIdentifier: z19.string().nullish(),
|
|
4062
|
-
serviceTier: z19.enum(["auto", "flex", "priority"]).nullish(),
|
|
4063
|
-
store: z19.boolean().nullish(),
|
|
4064
|
-
strictJsonSchema: z19.boolean().nullish(),
|
|
4065
|
-
textVerbosity: z19.enum(["low", "medium", "high"]).nullish(),
|
|
4066
|
-
user: z19.string().nullish()
|
|
4067
|
-
});
|
|
4068
4421
|
export {
|
|
4069
4422
|
OpenAIChatLanguageModel,
|
|
4070
4423
|
OpenAICompletionLanguageModel,
|
|
@@ -4089,6 +4442,7 @@ export {
|
|
|
4089
4442
|
openAITranscriptionProviderOptions,
|
|
4090
4443
|
openaiChatLanguageModelOptions,
|
|
4091
4444
|
openaiCompletionProviderOptions,
|
|
4092
|
-
openaiEmbeddingProviderOptions
|
|
4445
|
+
openaiEmbeddingProviderOptions,
|
|
4446
|
+
openaiSpeechProviderOptionsSchema
|
|
4093
4447
|
};
|
|
4094
4448
|
//# sourceMappingURL=index.mjs.map
|