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