@ai-sdk/openai 3.0.0-beta.17 → 3.0.0-beta.18
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 +10 -0
- package/dist/index.d.mts +38 -65
- package/dist/index.d.ts +38 -65
- package/dist/index.js +1339 -1033
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1293 -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 +1336 -1028
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1305 -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,244 @@ 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
|
|
453
|
+
* - 'flex': 50% cheaper processing at the cost of increased latency. Only available for o3 and o4-mini models.
|
|
454
|
+
* - 'priority': Higher-speed processing with predictably low latency at premium cost. Available for Enterprise customers.
|
|
455
|
+
*
|
|
456
|
+
* @default 'auto'
|
|
457
|
+
*/
|
|
458
|
+
serviceTier: z3.enum(["auto", "flex", "priority"]).optional(),
|
|
459
|
+
/**
|
|
460
|
+
* Whether to use strict JSON schema validation.
|
|
461
|
+
*
|
|
462
|
+
* @default false
|
|
463
|
+
*/
|
|
464
|
+
strictJsonSchema: z3.boolean().optional(),
|
|
465
|
+
/**
|
|
466
|
+
* Controls the verbosity of the model's responses.
|
|
467
|
+
* Lower values will result in more concise responses, while higher values will result in more verbose responses.
|
|
468
|
+
*/
|
|
469
|
+
textVerbosity: z3.enum(["low", "medium", "high"]).optional(),
|
|
470
|
+
/**
|
|
471
|
+
* A cache key for prompt caching. Allows manual control over prompt caching behavior.
|
|
472
|
+
* Useful for improving cache hit rates and working around automatic caching issues.
|
|
473
|
+
*/
|
|
474
|
+
promptCacheKey: z3.string().optional(),
|
|
475
|
+
/**
|
|
476
|
+
* A stable identifier used to help detect users of your application
|
|
477
|
+
* that may be violating OpenAI's usage policies. The IDs should be a
|
|
478
|
+
* string that uniquely identifies each user. We recommend hashing their
|
|
479
|
+
* username or email address, in order to avoid sending us any identifying
|
|
480
|
+
* information.
|
|
481
|
+
*/
|
|
482
|
+
safetyIdentifier: z3.string().optional()
|
|
483
|
+
})
|
|
484
|
+
)
|
|
485
|
+
);
|
|
338
486
|
|
|
339
487
|
// src/chat/openai-chat-prepare-tools.ts
|
|
340
488
|
import {
|
|
@@ -892,121 +1040,6 @@ var OpenAIChatLanguageModel = class {
|
|
|
892
1040
|
};
|
|
893
1041
|
}
|
|
894
1042
|
};
|
|
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
1043
|
function isReasoningModel(modelId) {
|
|
1011
1044
|
return (modelId.startsWith("o") || modelId.startsWith("gpt-5")) && !modelId.startsWith("gpt-5-chat");
|
|
1012
1045
|
}
|
|
@@ -1064,7 +1097,6 @@ import {
|
|
|
1064
1097
|
parseProviderOptions as parseProviderOptions2,
|
|
1065
1098
|
postJsonToApi as postJsonToApi2
|
|
1066
1099
|
} from "@ai-sdk/provider-utils";
|
|
1067
|
-
import { z as z5 } from "zod/v4";
|
|
1068
1100
|
|
|
1069
1101
|
// src/completion/convert-to-openai-completion-prompt.ts
|
|
1070
1102
|
import {
|
|
@@ -1174,48 +1206,117 @@ function mapOpenAIFinishReason2(finishReason) {
|
|
|
1174
1206
|
}
|
|
1175
1207
|
}
|
|
1176
1208
|
|
|
1209
|
+
// src/completion/openai-completion-api.ts
|
|
1210
|
+
import * as z4 from "zod/v4";
|
|
1211
|
+
import {
|
|
1212
|
+
lazyValidator as lazyValidator3,
|
|
1213
|
+
zodSchema as zodSchema3
|
|
1214
|
+
} from "@ai-sdk/provider-utils";
|
|
1215
|
+
var openaiCompletionResponseSchema = lazyValidator3(
|
|
1216
|
+
() => zodSchema3(
|
|
1217
|
+
z4.object({
|
|
1218
|
+
id: z4.string().nullish(),
|
|
1219
|
+
created: z4.number().nullish(),
|
|
1220
|
+
model: z4.string().nullish(),
|
|
1221
|
+
choices: z4.array(
|
|
1222
|
+
z4.object({
|
|
1223
|
+
text: z4.string(),
|
|
1224
|
+
finish_reason: z4.string(),
|
|
1225
|
+
logprobs: z4.object({
|
|
1226
|
+
tokens: z4.array(z4.string()),
|
|
1227
|
+
token_logprobs: z4.array(z4.number()),
|
|
1228
|
+
top_logprobs: z4.array(z4.record(z4.string(), z4.number())).nullish()
|
|
1229
|
+
}).nullish()
|
|
1230
|
+
})
|
|
1231
|
+
),
|
|
1232
|
+
usage: z4.object({
|
|
1233
|
+
prompt_tokens: z4.number(),
|
|
1234
|
+
completion_tokens: z4.number(),
|
|
1235
|
+
total_tokens: z4.number()
|
|
1236
|
+
}).nullish()
|
|
1237
|
+
})
|
|
1238
|
+
)
|
|
1239
|
+
);
|
|
1240
|
+
var openaiCompletionChunkSchema = lazyValidator3(
|
|
1241
|
+
() => zodSchema3(
|
|
1242
|
+
z4.union([
|
|
1243
|
+
z4.object({
|
|
1244
|
+
id: z4.string().nullish(),
|
|
1245
|
+
created: z4.number().nullish(),
|
|
1246
|
+
model: z4.string().nullish(),
|
|
1247
|
+
choices: z4.array(
|
|
1248
|
+
z4.object({
|
|
1249
|
+
text: z4.string(),
|
|
1250
|
+
finish_reason: z4.string().nullish(),
|
|
1251
|
+
index: z4.number(),
|
|
1252
|
+
logprobs: z4.object({
|
|
1253
|
+
tokens: z4.array(z4.string()),
|
|
1254
|
+
token_logprobs: z4.array(z4.number()),
|
|
1255
|
+
top_logprobs: z4.array(z4.record(z4.string(), z4.number())).nullish()
|
|
1256
|
+
}).nullish()
|
|
1257
|
+
})
|
|
1258
|
+
),
|
|
1259
|
+
usage: z4.object({
|
|
1260
|
+
prompt_tokens: z4.number(),
|
|
1261
|
+
completion_tokens: z4.number(),
|
|
1262
|
+
total_tokens: z4.number()
|
|
1263
|
+
}).nullish()
|
|
1264
|
+
}),
|
|
1265
|
+
openaiErrorDataSchema
|
|
1266
|
+
])
|
|
1267
|
+
)
|
|
1268
|
+
);
|
|
1269
|
+
|
|
1177
1270
|
// 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
|
-
|
|
1271
|
+
import {
|
|
1272
|
+
lazyValidator as lazyValidator4,
|
|
1273
|
+
zodSchema as zodSchema4
|
|
1274
|
+
} from "@ai-sdk/provider-utils";
|
|
1275
|
+
import * as z5 from "zod/v4";
|
|
1276
|
+
var openaiCompletionProviderOptions = lazyValidator4(
|
|
1277
|
+
() => zodSchema4(
|
|
1278
|
+
z5.object({
|
|
1279
|
+
/**
|
|
1280
|
+
Echo back the prompt in addition to the completion.
|
|
1281
|
+
*/
|
|
1282
|
+
echo: z5.boolean().optional(),
|
|
1283
|
+
/**
|
|
1284
|
+
Modify the likelihood of specified tokens appearing in the completion.
|
|
1285
|
+
|
|
1286
|
+
Accepts a JSON object that maps tokens (specified by their token ID in
|
|
1287
|
+
the GPT tokenizer) to an associated bias value from -100 to 100. You
|
|
1288
|
+
can use this tokenizer tool to convert text to token IDs. Mathematically,
|
|
1289
|
+
the bias is added to the logits generated by the model prior to sampling.
|
|
1290
|
+
The exact effect will vary per model, but values between -1 and 1 should
|
|
1291
|
+
decrease or increase likelihood of selection; values like -100 or 100
|
|
1292
|
+
should result in a ban or exclusive selection of the relevant token.
|
|
1293
|
+
|
|
1294
|
+
As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
|
|
1295
|
+
token from being generated.
|
|
1296
|
+
*/
|
|
1297
|
+
logitBias: z5.record(z5.string(), z5.number()).optional(),
|
|
1298
|
+
/**
|
|
1299
|
+
The suffix that comes after a completion of inserted text.
|
|
1300
|
+
*/
|
|
1301
|
+
suffix: z5.string().optional(),
|
|
1302
|
+
/**
|
|
1303
|
+
A unique identifier representing your end-user, which can help OpenAI to
|
|
1304
|
+
monitor and detect abuse. Learn more.
|
|
1305
|
+
*/
|
|
1306
|
+
user: z5.string().optional(),
|
|
1307
|
+
/**
|
|
1308
|
+
Return the log probabilities of the tokens. Including logprobs will increase
|
|
1309
|
+
the response size and can slow down response times. However, it can
|
|
1310
|
+
be useful to better understand how the model is behaving.
|
|
1311
|
+
Setting to true will return the log probabilities of the tokens that
|
|
1312
|
+
were generated.
|
|
1313
|
+
Setting to a number will return the log probabilities of the top n
|
|
1314
|
+
tokens that were generated.
|
|
1315
|
+
*/
|
|
1316
|
+
logprobs: z5.union([z5.boolean(), z5.number()]).optional()
|
|
1317
|
+
})
|
|
1318
|
+
)
|
|
1319
|
+
);
|
|
1219
1320
|
|
|
1220
1321
|
// src/completion/openai-completion-language-model.ts
|
|
1221
1322
|
var OpenAICompletionLanguageModel = class {
|
|
@@ -1446,49 +1547,6 @@ var OpenAICompletionLanguageModel = class {
|
|
|
1446
1547
|
};
|
|
1447
1548
|
}
|
|
1448
1549
|
};
|
|
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
1550
|
|
|
1493
1551
|
// src/embedding/openai-embedding-model.ts
|
|
1494
1552
|
import {
|
|
@@ -1500,22 +1558,41 @@ import {
|
|
|
1500
1558
|
parseProviderOptions as parseProviderOptions3,
|
|
1501
1559
|
postJsonToApi as postJsonToApi3
|
|
1502
1560
|
} from "@ai-sdk/provider-utils";
|
|
1503
|
-
import { z as z7 } from "zod/v4";
|
|
1504
1561
|
|
|
1505
1562
|
// src/embedding/openai-embedding-options.ts
|
|
1506
|
-
import {
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1563
|
+
import {
|
|
1564
|
+
lazyValidator as lazyValidator5,
|
|
1565
|
+
zodSchema as zodSchema5
|
|
1566
|
+
} from "@ai-sdk/provider-utils";
|
|
1567
|
+
import * as z6 from "zod/v4";
|
|
1568
|
+
var openaiEmbeddingProviderOptions = lazyValidator5(
|
|
1569
|
+
() => zodSchema5(
|
|
1570
|
+
z6.object({
|
|
1571
|
+
/**
|
|
1572
|
+
The number of dimensions the resulting output embeddings should have.
|
|
1573
|
+
Only supported in text-embedding-3 and later models.
|
|
1574
|
+
*/
|
|
1575
|
+
dimensions: z6.number().optional(),
|
|
1576
|
+
/**
|
|
1577
|
+
A unique identifier representing your end-user, which can help OpenAI to
|
|
1578
|
+
monitor and detect abuse. Learn more.
|
|
1579
|
+
*/
|
|
1580
|
+
user: z6.string().optional()
|
|
1581
|
+
})
|
|
1582
|
+
)
|
|
1583
|
+
);
|
|
1584
|
+
|
|
1585
|
+
// src/embedding/openai-embedding-api.ts
|
|
1586
|
+
import { lazyValidator as lazyValidator6, zodSchema as zodSchema6 } from "@ai-sdk/provider-utils";
|
|
1587
|
+
import * as z7 from "zod/v4";
|
|
1588
|
+
var openaiTextEmbeddingResponseSchema = lazyValidator6(
|
|
1589
|
+
() => zodSchema6(
|
|
1590
|
+
z7.object({
|
|
1591
|
+
data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
|
|
1592
|
+
usage: z7.object({ prompt_tokens: z7.number() }).nullish()
|
|
1593
|
+
})
|
|
1594
|
+
)
|
|
1595
|
+
);
|
|
1519
1596
|
|
|
1520
1597
|
// src/embedding/openai-embedding-model.ts
|
|
1521
1598
|
var OpenAIEmbeddingModel = class {
|
|
@@ -1580,10 +1657,6 @@ var OpenAIEmbeddingModel = class {
|
|
|
1580
1657
|
};
|
|
1581
1658
|
}
|
|
1582
1659
|
};
|
|
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
1660
|
|
|
1588
1661
|
// src/image/openai-image-model.ts
|
|
1589
1662
|
import {
|
|
@@ -1591,7 +1664,22 @@ import {
|
|
|
1591
1664
|
createJsonResponseHandler as createJsonResponseHandler4,
|
|
1592
1665
|
postJsonToApi as postJsonToApi4
|
|
1593
1666
|
} from "@ai-sdk/provider-utils";
|
|
1594
|
-
|
|
1667
|
+
|
|
1668
|
+
// src/image/openai-image-api.ts
|
|
1669
|
+
import { lazyValidator as lazyValidator7, zodSchema as zodSchema7 } from "@ai-sdk/provider-utils";
|
|
1670
|
+
import * as z8 from "zod/v4";
|
|
1671
|
+
var openaiImageResponseSchema = lazyValidator7(
|
|
1672
|
+
() => zodSchema7(
|
|
1673
|
+
z8.object({
|
|
1674
|
+
data: z8.array(
|
|
1675
|
+
z8.object({
|
|
1676
|
+
b64_json: z8.string(),
|
|
1677
|
+
revised_prompt: z8.string().optional()
|
|
1678
|
+
})
|
|
1679
|
+
)
|
|
1680
|
+
})
|
|
1681
|
+
)
|
|
1682
|
+
);
|
|
1595
1683
|
|
|
1596
1684
|
// src/image/openai-image-options.ts
|
|
1597
1685
|
var modelMaxImagesPerCall = {
|
|
@@ -1683,11 +1771,6 @@ var OpenAIImageModel = class {
|
|
|
1683
1771
|
};
|
|
1684
1772
|
}
|
|
1685
1773
|
};
|
|
1686
|
-
var openaiImageResponseSchema = z8.object({
|
|
1687
|
-
data: z8.array(
|
|
1688
|
-
z8.object({ b64_json: z8.string(), revised_prompt: z8.string().optional() })
|
|
1689
|
-
)
|
|
1690
|
-
});
|
|
1691
1774
|
|
|
1692
1775
|
// src/transcription/openai-transcription-model.ts
|
|
1693
1776
|
import {
|
|
@@ -1698,34 +1781,75 @@ import {
|
|
|
1698
1781
|
parseProviderOptions as parseProviderOptions4,
|
|
1699
1782
|
postFormDataToApi
|
|
1700
1783
|
} from "@ai-sdk/provider-utils";
|
|
1701
|
-
|
|
1784
|
+
|
|
1785
|
+
// src/transcription/openai-transcription-api.ts
|
|
1786
|
+
import { lazyValidator as lazyValidator8, zodSchema as zodSchema8 } from "@ai-sdk/provider-utils";
|
|
1787
|
+
import * as z9 from "zod/v4";
|
|
1788
|
+
var openaiTranscriptionResponseSchema = lazyValidator8(
|
|
1789
|
+
() => zodSchema8(
|
|
1790
|
+
z9.object({
|
|
1791
|
+
text: z9.string(),
|
|
1792
|
+
language: z9.string().nullish(),
|
|
1793
|
+
duration: z9.number().nullish(),
|
|
1794
|
+
words: z9.array(
|
|
1795
|
+
z9.object({
|
|
1796
|
+
word: z9.string(),
|
|
1797
|
+
start: z9.number(),
|
|
1798
|
+
end: z9.number()
|
|
1799
|
+
})
|
|
1800
|
+
).nullish(),
|
|
1801
|
+
segments: z9.array(
|
|
1802
|
+
z9.object({
|
|
1803
|
+
id: z9.number(),
|
|
1804
|
+
seek: z9.number(),
|
|
1805
|
+
start: z9.number(),
|
|
1806
|
+
end: z9.number(),
|
|
1807
|
+
text: z9.string(),
|
|
1808
|
+
tokens: z9.array(z9.number()),
|
|
1809
|
+
temperature: z9.number(),
|
|
1810
|
+
avg_logprob: z9.number(),
|
|
1811
|
+
compression_ratio: z9.number(),
|
|
1812
|
+
no_speech_prob: z9.number()
|
|
1813
|
+
})
|
|
1814
|
+
).nullish()
|
|
1815
|
+
})
|
|
1816
|
+
)
|
|
1817
|
+
);
|
|
1702
1818
|
|
|
1703
1819
|
// 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
|
-
|
|
1820
|
+
import {
|
|
1821
|
+
lazyValidator as lazyValidator9,
|
|
1822
|
+
zodSchema as zodSchema9
|
|
1823
|
+
} from "@ai-sdk/provider-utils";
|
|
1824
|
+
import * as z10 from "zod/v4";
|
|
1825
|
+
var openAITranscriptionProviderOptions = lazyValidator9(
|
|
1826
|
+
() => zodSchema9(
|
|
1827
|
+
z10.object({
|
|
1828
|
+
/**
|
|
1829
|
+
* Additional information to include in the transcription response.
|
|
1830
|
+
*/
|
|
1831
|
+
include: z10.array(z10.string()).optional(),
|
|
1832
|
+
/**
|
|
1833
|
+
* The language of the input audio in ISO-639-1 format.
|
|
1834
|
+
*/
|
|
1835
|
+
language: z10.string().optional(),
|
|
1836
|
+
/**
|
|
1837
|
+
* An optional text to guide the model's style or continue a previous audio segment.
|
|
1838
|
+
*/
|
|
1839
|
+
prompt: z10.string().optional(),
|
|
1840
|
+
/**
|
|
1841
|
+
* The sampling temperature, between 0 and 1.
|
|
1842
|
+
* @default 0
|
|
1843
|
+
*/
|
|
1844
|
+
temperature: z10.number().min(0).max(1).default(0).optional(),
|
|
1845
|
+
/**
|
|
1846
|
+
* The timestamp granularities to populate for this transcription.
|
|
1847
|
+
* @default ['segment']
|
|
1848
|
+
*/
|
|
1849
|
+
timestampGranularities: z10.array(z10.enum(["word", "segment"])).default(["segment"]).optional()
|
|
1850
|
+
})
|
|
1851
|
+
)
|
|
1852
|
+
);
|
|
1729
1853
|
|
|
1730
1854
|
// src/transcription/openai-transcription-model.ts
|
|
1731
1855
|
var languageMap = {
|
|
@@ -1893,32 +2017,6 @@ var OpenAITranscriptionModel = class {
|
|
|
1893
2017
|
};
|
|
1894
2018
|
}
|
|
1895
2019
|
};
|
|
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
2020
|
|
|
1923
2021
|
// src/speech/openai-speech-model.ts
|
|
1924
2022
|
import {
|
|
@@ -1927,11 +2025,23 @@ import {
|
|
|
1927
2025
|
parseProviderOptions as parseProviderOptions5,
|
|
1928
2026
|
postJsonToApi as postJsonToApi5
|
|
1929
2027
|
} from "@ai-sdk/provider-utils";
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
2028
|
+
|
|
2029
|
+
// src/speech/openai-speech-options.ts
|
|
2030
|
+
import {
|
|
2031
|
+
lazyValidator as lazyValidator10,
|
|
2032
|
+
zodSchema as zodSchema10
|
|
2033
|
+
} from "@ai-sdk/provider-utils";
|
|
2034
|
+
import * as z11 from "zod/v4";
|
|
2035
|
+
var openaiSpeechProviderOptionsSchema = lazyValidator10(
|
|
2036
|
+
() => zodSchema10(
|
|
2037
|
+
z11.object({
|
|
2038
|
+
instructions: z11.string().nullish(),
|
|
2039
|
+
speed: z11.number().min(0.25).max(4).default(1).nullish()
|
|
2040
|
+
})
|
|
2041
|
+
)
|
|
2042
|
+
);
|
|
2043
|
+
|
|
2044
|
+
// src/speech/openai-speech-model.ts
|
|
1935
2045
|
var OpenAISpeechModel = class {
|
|
1936
2046
|
constructor(modelId, config) {
|
|
1937
2047
|
this.modelId = modelId;
|
|
@@ -1954,7 +2064,7 @@ var OpenAISpeechModel = class {
|
|
|
1954
2064
|
const openAIOptions = await parseProviderOptions5({
|
|
1955
2065
|
provider: "openai",
|
|
1956
2066
|
providerOptions,
|
|
1957
|
-
schema:
|
|
2067
|
+
schema: openaiSpeechProviderOptionsSchema
|
|
1958
2068
|
});
|
|
1959
2069
|
const requestBody = {
|
|
1960
2070
|
model: this.modelId,
|
|
@@ -2044,31 +2154,42 @@ import {
|
|
|
2044
2154
|
parseProviderOptions as parseProviderOptions7,
|
|
2045
2155
|
postJsonToApi as postJsonToApi6
|
|
2046
2156
|
} from "@ai-sdk/provider-utils";
|
|
2047
|
-
import { z as z19 } from "zod/v4";
|
|
2048
2157
|
|
|
2049
2158
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2050
2159
|
import {
|
|
2051
2160
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError4
|
|
2052
2161
|
} from "@ai-sdk/provider";
|
|
2053
|
-
import {
|
|
2054
|
-
|
|
2162
|
+
import {
|
|
2163
|
+
convertToBase64 as convertToBase642,
|
|
2164
|
+
parseProviderOptions as parseProviderOptions6,
|
|
2165
|
+
validateTypes
|
|
2166
|
+
} from "@ai-sdk/provider-utils";
|
|
2167
|
+
import * as z13 from "zod/v4";
|
|
2055
2168
|
|
|
2056
2169
|
// src/tool/local-shell.ts
|
|
2057
|
-
import {
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2170
|
+
import {
|
|
2171
|
+
createProviderDefinedToolFactoryWithOutputSchema,
|
|
2172
|
+
lazySchema,
|
|
2173
|
+
zodSchema as zodSchema11
|
|
2174
|
+
} from "@ai-sdk/provider-utils";
|
|
2175
|
+
import * as z12 from "zod/v4";
|
|
2176
|
+
var localShellInputSchema = lazySchema(
|
|
2177
|
+
() => zodSchema11(
|
|
2178
|
+
z12.object({
|
|
2179
|
+
action: z12.object({
|
|
2180
|
+
type: z12.literal("exec"),
|
|
2181
|
+
command: z12.array(z12.string()),
|
|
2182
|
+
timeoutMs: z12.number().optional(),
|
|
2183
|
+
user: z12.string().optional(),
|
|
2184
|
+
workingDirectory: z12.string().optional(),
|
|
2185
|
+
env: z12.record(z12.string(), z12.string()).optional()
|
|
2186
|
+
})
|
|
2187
|
+
})
|
|
2188
|
+
)
|
|
2189
|
+
);
|
|
2190
|
+
var localShellOutputSchema = lazySchema(
|
|
2191
|
+
() => zodSchema11(z12.object({ output: z12.string() }))
|
|
2192
|
+
);
|
|
2072
2193
|
var localShell = createProviderDefinedToolFactoryWithOutputSchema({
|
|
2073
2194
|
id: "openai.local_shell",
|
|
2074
2195
|
name: "local_shell",
|
|
@@ -2182,7 +2303,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2182
2303
|
break;
|
|
2183
2304
|
}
|
|
2184
2305
|
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2185
|
-
const parsedInput =
|
|
2306
|
+
const parsedInput = await validateTypes({
|
|
2307
|
+
value: part.input,
|
|
2308
|
+
schema: localShellInputSchema
|
|
2309
|
+
});
|
|
2186
2310
|
input.push({
|
|
2187
2311
|
type: "local_shell_call",
|
|
2188
2312
|
call_id: part.toolCallId,
|
|
@@ -2278,10 +2402,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2278
2402
|
for (const part of content) {
|
|
2279
2403
|
const output = part.output;
|
|
2280
2404
|
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2405
|
+
const parsedOutput = await validateTypes({
|
|
2406
|
+
value: output.value,
|
|
2407
|
+
schema: localShellOutputSchema
|
|
2408
|
+
});
|
|
2281
2409
|
input.push({
|
|
2282
2410
|
type: "local_shell_call_output",
|
|
2283
2411
|
call_id: part.toolCallId,
|
|
2284
|
-
output:
|
|
2412
|
+
output: parsedOutput.output
|
|
2285
2413
|
});
|
|
2286
2414
|
break;
|
|
2287
2415
|
}
|
|
@@ -2339,34 +2467,585 @@ function mapOpenAIResponseFinishReason({
|
|
|
2339
2467
|
}
|
|
2340
2468
|
}
|
|
2341
2469
|
|
|
2470
|
+
// src/responses/openai-responses-api.ts
|
|
2471
|
+
import {
|
|
2472
|
+
lazyValidator as lazyValidator11,
|
|
2473
|
+
zodSchema as zodSchema12
|
|
2474
|
+
} from "@ai-sdk/provider-utils";
|
|
2475
|
+
import * as z14 from "zod/v4";
|
|
2476
|
+
var openaiResponsesChunkSchema = lazyValidator11(
|
|
2477
|
+
() => zodSchema12(
|
|
2478
|
+
z14.union([
|
|
2479
|
+
z14.object({
|
|
2480
|
+
type: z14.literal("response.output_text.delta"),
|
|
2481
|
+
item_id: z14.string(),
|
|
2482
|
+
delta: z14.string(),
|
|
2483
|
+
logprobs: z14.array(
|
|
2484
|
+
z14.object({
|
|
2485
|
+
token: z14.string(),
|
|
2486
|
+
logprob: z14.number(),
|
|
2487
|
+
top_logprobs: z14.array(
|
|
2488
|
+
z14.object({
|
|
2489
|
+
token: z14.string(),
|
|
2490
|
+
logprob: z14.number()
|
|
2491
|
+
})
|
|
2492
|
+
)
|
|
2493
|
+
})
|
|
2494
|
+
).nullish()
|
|
2495
|
+
}),
|
|
2496
|
+
z14.object({
|
|
2497
|
+
type: z14.enum(["response.completed", "response.incomplete"]),
|
|
2498
|
+
response: z14.object({
|
|
2499
|
+
incomplete_details: z14.object({ reason: z14.string() }).nullish(),
|
|
2500
|
+
usage: z14.object({
|
|
2501
|
+
input_tokens: z14.number(),
|
|
2502
|
+
input_tokens_details: z14.object({ cached_tokens: z14.number().nullish() }).nullish(),
|
|
2503
|
+
output_tokens: z14.number(),
|
|
2504
|
+
output_tokens_details: z14.object({ reasoning_tokens: z14.number().nullish() }).nullish()
|
|
2505
|
+
}),
|
|
2506
|
+
service_tier: z14.string().nullish()
|
|
2507
|
+
})
|
|
2508
|
+
}),
|
|
2509
|
+
z14.object({
|
|
2510
|
+
type: z14.literal("response.created"),
|
|
2511
|
+
response: z14.object({
|
|
2512
|
+
id: z14.string(),
|
|
2513
|
+
created_at: z14.number(),
|
|
2514
|
+
model: z14.string(),
|
|
2515
|
+
service_tier: z14.string().nullish()
|
|
2516
|
+
})
|
|
2517
|
+
}),
|
|
2518
|
+
z14.object({
|
|
2519
|
+
type: z14.literal("response.output_item.added"),
|
|
2520
|
+
output_index: z14.number(),
|
|
2521
|
+
item: z14.discriminatedUnion("type", [
|
|
2522
|
+
z14.object({
|
|
2523
|
+
type: z14.literal("message"),
|
|
2524
|
+
id: z14.string()
|
|
2525
|
+
}),
|
|
2526
|
+
z14.object({
|
|
2527
|
+
type: z14.literal("reasoning"),
|
|
2528
|
+
id: z14.string(),
|
|
2529
|
+
encrypted_content: z14.string().nullish()
|
|
2530
|
+
}),
|
|
2531
|
+
z14.object({
|
|
2532
|
+
type: z14.literal("function_call"),
|
|
2533
|
+
id: z14.string(),
|
|
2534
|
+
call_id: z14.string(),
|
|
2535
|
+
name: z14.string(),
|
|
2536
|
+
arguments: z14.string()
|
|
2537
|
+
}),
|
|
2538
|
+
z14.object({
|
|
2539
|
+
type: z14.literal("web_search_call"),
|
|
2540
|
+
id: z14.string(),
|
|
2541
|
+
status: z14.string(),
|
|
2542
|
+
action: z14.object({
|
|
2543
|
+
type: z14.literal("search"),
|
|
2544
|
+
query: z14.string().optional()
|
|
2545
|
+
}).nullish()
|
|
2546
|
+
}),
|
|
2547
|
+
z14.object({
|
|
2548
|
+
type: z14.literal("computer_call"),
|
|
2549
|
+
id: z14.string(),
|
|
2550
|
+
status: z14.string()
|
|
2551
|
+
}),
|
|
2552
|
+
z14.object({
|
|
2553
|
+
type: z14.literal("file_search_call"),
|
|
2554
|
+
id: z14.string()
|
|
2555
|
+
}),
|
|
2556
|
+
z14.object({
|
|
2557
|
+
type: z14.literal("image_generation_call"),
|
|
2558
|
+
id: z14.string()
|
|
2559
|
+
}),
|
|
2560
|
+
z14.object({
|
|
2561
|
+
type: z14.literal("code_interpreter_call"),
|
|
2562
|
+
id: z14.string(),
|
|
2563
|
+
container_id: z14.string(),
|
|
2564
|
+
code: z14.string().nullable(),
|
|
2565
|
+
outputs: z14.array(
|
|
2566
|
+
z14.discriminatedUnion("type", [
|
|
2567
|
+
z14.object({ type: z14.literal("logs"), logs: z14.string() }),
|
|
2568
|
+
z14.object({ type: z14.literal("image"), url: z14.string() })
|
|
2569
|
+
])
|
|
2570
|
+
).nullable(),
|
|
2571
|
+
status: z14.string()
|
|
2572
|
+
})
|
|
2573
|
+
])
|
|
2574
|
+
}),
|
|
2575
|
+
z14.object({
|
|
2576
|
+
type: z14.literal("response.output_item.done"),
|
|
2577
|
+
output_index: z14.number(),
|
|
2578
|
+
item: z14.discriminatedUnion("type", [
|
|
2579
|
+
z14.object({
|
|
2580
|
+
type: z14.literal("message"),
|
|
2581
|
+
id: z14.string()
|
|
2582
|
+
}),
|
|
2583
|
+
z14.object({
|
|
2584
|
+
type: z14.literal("reasoning"),
|
|
2585
|
+
id: z14.string(),
|
|
2586
|
+
encrypted_content: z14.string().nullish()
|
|
2587
|
+
}),
|
|
2588
|
+
z14.object({
|
|
2589
|
+
type: z14.literal("function_call"),
|
|
2590
|
+
id: z14.string(),
|
|
2591
|
+
call_id: z14.string(),
|
|
2592
|
+
name: z14.string(),
|
|
2593
|
+
arguments: z14.string(),
|
|
2594
|
+
status: z14.literal("completed")
|
|
2595
|
+
}),
|
|
2596
|
+
z14.object({
|
|
2597
|
+
type: z14.literal("code_interpreter_call"),
|
|
2598
|
+
id: z14.string(),
|
|
2599
|
+
code: z14.string().nullable(),
|
|
2600
|
+
container_id: z14.string(),
|
|
2601
|
+
outputs: z14.array(
|
|
2602
|
+
z14.discriminatedUnion("type", [
|
|
2603
|
+
z14.object({ type: z14.literal("logs"), logs: z14.string() }),
|
|
2604
|
+
z14.object({ type: z14.literal("image"), url: z14.string() })
|
|
2605
|
+
])
|
|
2606
|
+
).nullable()
|
|
2607
|
+
}),
|
|
2608
|
+
z14.object({
|
|
2609
|
+
type: z14.literal("image_generation_call"),
|
|
2610
|
+
id: z14.string(),
|
|
2611
|
+
result: z14.string()
|
|
2612
|
+
}),
|
|
2613
|
+
z14.object({
|
|
2614
|
+
type: z14.literal("web_search_call"),
|
|
2615
|
+
id: z14.string(),
|
|
2616
|
+
status: z14.string(),
|
|
2617
|
+
action: z14.discriminatedUnion("type", [
|
|
2618
|
+
z14.object({
|
|
2619
|
+
type: z14.literal("search"),
|
|
2620
|
+
query: z14.string().nullish()
|
|
2621
|
+
}),
|
|
2622
|
+
z14.object({
|
|
2623
|
+
type: z14.literal("open_page"),
|
|
2624
|
+
url: z14.string()
|
|
2625
|
+
}),
|
|
2626
|
+
z14.object({
|
|
2627
|
+
type: z14.literal("find"),
|
|
2628
|
+
url: z14.string(),
|
|
2629
|
+
pattern: z14.string()
|
|
2630
|
+
})
|
|
2631
|
+
]).nullish()
|
|
2632
|
+
}),
|
|
2633
|
+
z14.object({
|
|
2634
|
+
type: z14.literal("file_search_call"),
|
|
2635
|
+
id: z14.string(),
|
|
2636
|
+
queries: z14.array(z14.string()),
|
|
2637
|
+
results: z14.array(
|
|
2638
|
+
z14.object({
|
|
2639
|
+
attributes: z14.record(z14.string(), z14.unknown()),
|
|
2640
|
+
file_id: z14.string(),
|
|
2641
|
+
filename: z14.string(),
|
|
2642
|
+
score: z14.number(),
|
|
2643
|
+
text: z14.string()
|
|
2644
|
+
})
|
|
2645
|
+
).nullish()
|
|
2646
|
+
}),
|
|
2647
|
+
z14.object({
|
|
2648
|
+
type: z14.literal("local_shell_call"),
|
|
2649
|
+
id: z14.string(),
|
|
2650
|
+
call_id: z14.string(),
|
|
2651
|
+
action: z14.object({
|
|
2652
|
+
type: z14.literal("exec"),
|
|
2653
|
+
command: z14.array(z14.string()),
|
|
2654
|
+
timeout_ms: z14.number().optional(),
|
|
2655
|
+
user: z14.string().optional(),
|
|
2656
|
+
working_directory: z14.string().optional(),
|
|
2657
|
+
env: z14.record(z14.string(), z14.string()).optional()
|
|
2658
|
+
})
|
|
2659
|
+
}),
|
|
2660
|
+
z14.object({
|
|
2661
|
+
type: z14.literal("computer_call"),
|
|
2662
|
+
id: z14.string(),
|
|
2663
|
+
status: z14.literal("completed")
|
|
2664
|
+
})
|
|
2665
|
+
])
|
|
2666
|
+
}),
|
|
2667
|
+
z14.object({
|
|
2668
|
+
type: z14.literal("response.function_call_arguments.delta"),
|
|
2669
|
+
item_id: z14.string(),
|
|
2670
|
+
output_index: z14.number(),
|
|
2671
|
+
delta: z14.string()
|
|
2672
|
+
}),
|
|
2673
|
+
z14.object({
|
|
2674
|
+
type: z14.literal("response.image_generation_call.partial_image"),
|
|
2675
|
+
item_id: z14.string(),
|
|
2676
|
+
output_index: z14.number(),
|
|
2677
|
+
partial_image_b64: z14.string()
|
|
2678
|
+
}),
|
|
2679
|
+
z14.object({
|
|
2680
|
+
type: z14.literal("response.code_interpreter_call_code.delta"),
|
|
2681
|
+
item_id: z14.string(),
|
|
2682
|
+
output_index: z14.number(),
|
|
2683
|
+
delta: z14.string()
|
|
2684
|
+
}),
|
|
2685
|
+
z14.object({
|
|
2686
|
+
type: z14.literal("response.code_interpreter_call_code.done"),
|
|
2687
|
+
item_id: z14.string(),
|
|
2688
|
+
output_index: z14.number(),
|
|
2689
|
+
code: z14.string()
|
|
2690
|
+
}),
|
|
2691
|
+
z14.object({
|
|
2692
|
+
type: z14.literal("response.output_text.annotation.added"),
|
|
2693
|
+
annotation: z14.discriminatedUnion("type", [
|
|
2694
|
+
z14.object({
|
|
2695
|
+
type: z14.literal("url_citation"),
|
|
2696
|
+
url: z14.string(),
|
|
2697
|
+
title: z14.string()
|
|
2698
|
+
}),
|
|
2699
|
+
z14.object({
|
|
2700
|
+
type: z14.literal("file_citation"),
|
|
2701
|
+
file_id: z14.string(),
|
|
2702
|
+
filename: z14.string().nullish(),
|
|
2703
|
+
index: z14.number().nullish(),
|
|
2704
|
+
start_index: z14.number().nullish(),
|
|
2705
|
+
end_index: z14.number().nullish(),
|
|
2706
|
+
quote: z14.string().nullish()
|
|
2707
|
+
})
|
|
2708
|
+
])
|
|
2709
|
+
}),
|
|
2710
|
+
z14.object({
|
|
2711
|
+
type: z14.literal("response.reasoning_summary_part.added"),
|
|
2712
|
+
item_id: z14.string(),
|
|
2713
|
+
summary_index: z14.number()
|
|
2714
|
+
}),
|
|
2715
|
+
z14.object({
|
|
2716
|
+
type: z14.literal("response.reasoning_summary_text.delta"),
|
|
2717
|
+
item_id: z14.string(),
|
|
2718
|
+
summary_index: z14.number(),
|
|
2719
|
+
delta: z14.string()
|
|
2720
|
+
}),
|
|
2721
|
+
z14.object({
|
|
2722
|
+
type: z14.literal("error"),
|
|
2723
|
+
code: z14.string(),
|
|
2724
|
+
message: z14.string(),
|
|
2725
|
+
param: z14.string().nullish(),
|
|
2726
|
+
sequence_number: z14.number()
|
|
2727
|
+
}),
|
|
2728
|
+
z14.object({ type: z14.string() }).loose().transform((value) => ({
|
|
2729
|
+
type: "unknown_chunk",
|
|
2730
|
+
message: value.type
|
|
2731
|
+
}))
|
|
2732
|
+
// fallback for unknown chunks
|
|
2733
|
+
])
|
|
2734
|
+
)
|
|
2735
|
+
);
|
|
2736
|
+
var openaiResponsesResponseSchema = lazyValidator11(
|
|
2737
|
+
() => zodSchema12(
|
|
2738
|
+
z14.object({
|
|
2739
|
+
id: z14.string(),
|
|
2740
|
+
created_at: z14.number(),
|
|
2741
|
+
error: z14.object({
|
|
2742
|
+
code: z14.string(),
|
|
2743
|
+
message: z14.string()
|
|
2744
|
+
}).nullish(),
|
|
2745
|
+
model: z14.string(),
|
|
2746
|
+
output: z14.array(
|
|
2747
|
+
z14.discriminatedUnion("type", [
|
|
2748
|
+
z14.object({
|
|
2749
|
+
type: z14.literal("message"),
|
|
2750
|
+
role: z14.literal("assistant"),
|
|
2751
|
+
id: z14.string(),
|
|
2752
|
+
content: z14.array(
|
|
2753
|
+
z14.object({
|
|
2754
|
+
type: z14.literal("output_text"),
|
|
2755
|
+
text: z14.string(),
|
|
2756
|
+
logprobs: z14.array(
|
|
2757
|
+
z14.object({
|
|
2758
|
+
token: z14.string(),
|
|
2759
|
+
logprob: z14.number(),
|
|
2760
|
+
top_logprobs: z14.array(
|
|
2761
|
+
z14.object({
|
|
2762
|
+
token: z14.string(),
|
|
2763
|
+
logprob: z14.number()
|
|
2764
|
+
})
|
|
2765
|
+
)
|
|
2766
|
+
})
|
|
2767
|
+
).nullish(),
|
|
2768
|
+
annotations: z14.array(
|
|
2769
|
+
z14.discriminatedUnion("type", [
|
|
2770
|
+
z14.object({
|
|
2771
|
+
type: z14.literal("url_citation"),
|
|
2772
|
+
start_index: z14.number(),
|
|
2773
|
+
end_index: z14.number(),
|
|
2774
|
+
url: z14.string(),
|
|
2775
|
+
title: z14.string()
|
|
2776
|
+
}),
|
|
2777
|
+
z14.object({
|
|
2778
|
+
type: z14.literal("file_citation"),
|
|
2779
|
+
file_id: z14.string(),
|
|
2780
|
+
filename: z14.string().nullish(),
|
|
2781
|
+
index: z14.number().nullish(),
|
|
2782
|
+
start_index: z14.number().nullish(),
|
|
2783
|
+
end_index: z14.number().nullish(),
|
|
2784
|
+
quote: z14.string().nullish()
|
|
2785
|
+
}),
|
|
2786
|
+
z14.object({
|
|
2787
|
+
type: z14.literal("container_file_citation")
|
|
2788
|
+
})
|
|
2789
|
+
])
|
|
2790
|
+
)
|
|
2791
|
+
})
|
|
2792
|
+
)
|
|
2793
|
+
}),
|
|
2794
|
+
z14.object({
|
|
2795
|
+
type: z14.literal("web_search_call"),
|
|
2796
|
+
id: z14.string(),
|
|
2797
|
+
status: z14.string(),
|
|
2798
|
+
action: z14.discriminatedUnion("type", [
|
|
2799
|
+
z14.object({
|
|
2800
|
+
type: z14.literal("search"),
|
|
2801
|
+
query: z14.string().nullish()
|
|
2802
|
+
}),
|
|
2803
|
+
z14.object({
|
|
2804
|
+
type: z14.literal("open_page"),
|
|
2805
|
+
url: z14.string()
|
|
2806
|
+
}),
|
|
2807
|
+
z14.object({
|
|
2808
|
+
type: z14.literal("find"),
|
|
2809
|
+
url: z14.string(),
|
|
2810
|
+
pattern: z14.string()
|
|
2811
|
+
})
|
|
2812
|
+
]).nullish()
|
|
2813
|
+
}),
|
|
2814
|
+
z14.object({
|
|
2815
|
+
type: z14.literal("file_search_call"),
|
|
2816
|
+
id: z14.string(),
|
|
2817
|
+
queries: z14.array(z14.string()),
|
|
2818
|
+
results: z14.array(
|
|
2819
|
+
z14.object({
|
|
2820
|
+
attributes: z14.record(z14.string(), z14.unknown()),
|
|
2821
|
+
file_id: z14.string(),
|
|
2822
|
+
filename: z14.string(),
|
|
2823
|
+
score: z14.number(),
|
|
2824
|
+
text: z14.string()
|
|
2825
|
+
})
|
|
2826
|
+
).nullish()
|
|
2827
|
+
}),
|
|
2828
|
+
z14.object({
|
|
2829
|
+
type: z14.literal("code_interpreter_call"),
|
|
2830
|
+
id: z14.string(),
|
|
2831
|
+
code: z14.string().nullable(),
|
|
2832
|
+
container_id: z14.string(),
|
|
2833
|
+
outputs: z14.array(
|
|
2834
|
+
z14.discriminatedUnion("type", [
|
|
2835
|
+
z14.object({ type: z14.literal("logs"), logs: z14.string() }),
|
|
2836
|
+
z14.object({ type: z14.literal("image"), url: z14.string() })
|
|
2837
|
+
])
|
|
2838
|
+
).nullable()
|
|
2839
|
+
}),
|
|
2840
|
+
z14.object({
|
|
2841
|
+
type: z14.literal("image_generation_call"),
|
|
2842
|
+
id: z14.string(),
|
|
2843
|
+
result: z14.string()
|
|
2844
|
+
}),
|
|
2845
|
+
z14.object({
|
|
2846
|
+
type: z14.literal("local_shell_call"),
|
|
2847
|
+
id: z14.string(),
|
|
2848
|
+
call_id: z14.string(),
|
|
2849
|
+
action: z14.object({
|
|
2850
|
+
type: z14.literal("exec"),
|
|
2851
|
+
command: z14.array(z14.string()),
|
|
2852
|
+
timeout_ms: z14.number().optional(),
|
|
2853
|
+
user: z14.string().optional(),
|
|
2854
|
+
working_directory: z14.string().optional(),
|
|
2855
|
+
env: z14.record(z14.string(), z14.string()).optional()
|
|
2856
|
+
})
|
|
2857
|
+
}),
|
|
2858
|
+
z14.object({
|
|
2859
|
+
type: z14.literal("function_call"),
|
|
2860
|
+
call_id: z14.string(),
|
|
2861
|
+
name: z14.string(),
|
|
2862
|
+
arguments: z14.string(),
|
|
2863
|
+
id: z14.string()
|
|
2864
|
+
}),
|
|
2865
|
+
z14.object({
|
|
2866
|
+
type: z14.literal("computer_call"),
|
|
2867
|
+
id: z14.string(),
|
|
2868
|
+
status: z14.string().optional()
|
|
2869
|
+
}),
|
|
2870
|
+
z14.object({
|
|
2871
|
+
type: z14.literal("reasoning"),
|
|
2872
|
+
id: z14.string(),
|
|
2873
|
+
encrypted_content: z14.string().nullish(),
|
|
2874
|
+
summary: z14.array(
|
|
2875
|
+
z14.object({
|
|
2876
|
+
type: z14.literal("summary_text"),
|
|
2877
|
+
text: z14.string()
|
|
2878
|
+
})
|
|
2879
|
+
)
|
|
2880
|
+
})
|
|
2881
|
+
])
|
|
2882
|
+
),
|
|
2883
|
+
service_tier: z14.string().nullish(),
|
|
2884
|
+
incomplete_details: z14.object({ reason: z14.string() }).nullish(),
|
|
2885
|
+
usage: z14.object({
|
|
2886
|
+
input_tokens: z14.number(),
|
|
2887
|
+
input_tokens_details: z14.object({ cached_tokens: z14.number().nullish() }).nullish(),
|
|
2888
|
+
output_tokens: z14.number(),
|
|
2889
|
+
output_tokens_details: z14.object({ reasoning_tokens: z14.number().nullish() }).nullish()
|
|
2890
|
+
})
|
|
2891
|
+
})
|
|
2892
|
+
)
|
|
2893
|
+
);
|
|
2894
|
+
|
|
2895
|
+
// src/responses/openai-responses-options.ts
|
|
2896
|
+
import {
|
|
2897
|
+
lazyValidator as lazyValidator12,
|
|
2898
|
+
zodSchema as zodSchema13
|
|
2899
|
+
} from "@ai-sdk/provider-utils";
|
|
2900
|
+
import * as z15 from "zod/v4";
|
|
2901
|
+
var TOP_LOGPROBS_MAX = 20;
|
|
2902
|
+
var openaiResponsesReasoningModelIds = [
|
|
2903
|
+
"o1",
|
|
2904
|
+
"o1-2024-12-17",
|
|
2905
|
+
"o3-mini",
|
|
2906
|
+
"o3-mini-2025-01-31",
|
|
2907
|
+
"o3",
|
|
2908
|
+
"o3-2025-04-16",
|
|
2909
|
+
"o4-mini",
|
|
2910
|
+
"o4-mini-2025-04-16",
|
|
2911
|
+
"codex-mini-latest",
|
|
2912
|
+
"computer-use-preview",
|
|
2913
|
+
"gpt-5",
|
|
2914
|
+
"gpt-5-2025-08-07",
|
|
2915
|
+
"gpt-5-codex",
|
|
2916
|
+
"gpt-5-mini",
|
|
2917
|
+
"gpt-5-mini-2025-08-07",
|
|
2918
|
+
"gpt-5-nano",
|
|
2919
|
+
"gpt-5-nano-2025-08-07",
|
|
2920
|
+
"gpt-5-pro",
|
|
2921
|
+
"gpt-5-pro-2025-10-06"
|
|
2922
|
+
];
|
|
2923
|
+
var openaiResponsesModelIds = [
|
|
2924
|
+
"gpt-4.1",
|
|
2925
|
+
"gpt-4.1-2025-04-14",
|
|
2926
|
+
"gpt-4.1-mini",
|
|
2927
|
+
"gpt-4.1-mini-2025-04-14",
|
|
2928
|
+
"gpt-4.1-nano",
|
|
2929
|
+
"gpt-4.1-nano-2025-04-14",
|
|
2930
|
+
"gpt-4o",
|
|
2931
|
+
"gpt-4o-2024-05-13",
|
|
2932
|
+
"gpt-4o-2024-08-06",
|
|
2933
|
+
"gpt-4o-2024-11-20",
|
|
2934
|
+
"gpt-4o-audio-preview",
|
|
2935
|
+
"gpt-4o-audio-preview-2024-10-01",
|
|
2936
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
2937
|
+
"gpt-4o-search-preview",
|
|
2938
|
+
"gpt-4o-search-preview-2025-03-11",
|
|
2939
|
+
"gpt-4o-mini-search-preview",
|
|
2940
|
+
"gpt-4o-mini-search-preview-2025-03-11",
|
|
2941
|
+
"gpt-4o-mini",
|
|
2942
|
+
"gpt-4o-mini-2024-07-18",
|
|
2943
|
+
"gpt-4-turbo",
|
|
2944
|
+
"gpt-4-turbo-2024-04-09",
|
|
2945
|
+
"gpt-4-turbo-preview",
|
|
2946
|
+
"gpt-4-0125-preview",
|
|
2947
|
+
"gpt-4-1106-preview",
|
|
2948
|
+
"gpt-4",
|
|
2949
|
+
"gpt-4-0613",
|
|
2950
|
+
"gpt-4.5-preview",
|
|
2951
|
+
"gpt-4.5-preview-2025-02-27",
|
|
2952
|
+
"gpt-3.5-turbo-0125",
|
|
2953
|
+
"gpt-3.5-turbo",
|
|
2954
|
+
"gpt-3.5-turbo-1106",
|
|
2955
|
+
"chatgpt-4o-latest",
|
|
2956
|
+
"gpt-5-chat-latest",
|
|
2957
|
+
...openaiResponsesReasoningModelIds
|
|
2958
|
+
];
|
|
2959
|
+
var openaiResponsesProviderOptionsSchema = lazyValidator12(
|
|
2960
|
+
() => zodSchema13(
|
|
2961
|
+
z15.object({
|
|
2962
|
+
include: z15.array(
|
|
2963
|
+
z15.enum([
|
|
2964
|
+
"reasoning.encrypted_content",
|
|
2965
|
+
"file_search_call.results",
|
|
2966
|
+
"message.output_text.logprobs"
|
|
2967
|
+
])
|
|
2968
|
+
).nullish(),
|
|
2969
|
+
instructions: z15.string().nullish(),
|
|
2970
|
+
/**
|
|
2971
|
+
* Return the log probabilities of the tokens.
|
|
2972
|
+
*
|
|
2973
|
+
* Setting to true will return the log probabilities of the tokens that
|
|
2974
|
+
* were generated.
|
|
2975
|
+
*
|
|
2976
|
+
* Setting to a number will return the log probabilities of the top n
|
|
2977
|
+
* tokens that were generated.
|
|
2978
|
+
*
|
|
2979
|
+
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
2980
|
+
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
2981
|
+
*/
|
|
2982
|
+
logprobs: z15.union([z15.boolean(), z15.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
2983
|
+
/**
|
|
2984
|
+
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
2985
|
+
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
2986
|
+
* Any further attempts to call a tool by the model will be ignored.
|
|
2987
|
+
*/
|
|
2988
|
+
maxToolCalls: z15.number().nullish(),
|
|
2989
|
+
metadata: z15.any().nullish(),
|
|
2990
|
+
parallelToolCalls: z15.boolean().nullish(),
|
|
2991
|
+
previousResponseId: z15.string().nullish(),
|
|
2992
|
+
promptCacheKey: z15.string().nullish(),
|
|
2993
|
+
reasoningEffort: z15.string().nullish(),
|
|
2994
|
+
reasoningSummary: z15.string().nullish(),
|
|
2995
|
+
safetyIdentifier: z15.string().nullish(),
|
|
2996
|
+
serviceTier: z15.enum(["auto", "flex", "priority"]).nullish(),
|
|
2997
|
+
store: z15.boolean().nullish(),
|
|
2998
|
+
strictJsonSchema: z15.boolean().nullish(),
|
|
2999
|
+
textVerbosity: z15.enum(["low", "medium", "high"]).nullish(),
|
|
3000
|
+
user: z15.string().nullish()
|
|
3001
|
+
})
|
|
3002
|
+
)
|
|
3003
|
+
);
|
|
3004
|
+
|
|
2342
3005
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2343
3006
|
import {
|
|
2344
3007
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError5
|
|
2345
3008
|
} from "@ai-sdk/provider";
|
|
2346
3009
|
|
|
2347
3010
|
// 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()
|
|
3011
|
+
import {
|
|
3012
|
+
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2,
|
|
3013
|
+
lazySchema as lazySchema2,
|
|
3014
|
+
zodSchema as zodSchema14
|
|
3015
|
+
} from "@ai-sdk/provider-utils";
|
|
3016
|
+
import * as z16 from "zod/v4";
|
|
3017
|
+
var codeInterpreterInputSchema = lazySchema2(
|
|
3018
|
+
() => zodSchema14(
|
|
3019
|
+
z16.object({
|
|
3020
|
+
code: z16.string().nullish(),
|
|
3021
|
+
containerId: z16.string()
|
|
2367
3022
|
})
|
|
2368
|
-
|
|
2369
|
-
|
|
3023
|
+
)
|
|
3024
|
+
);
|
|
3025
|
+
var codeInterpreterOutputSchema = lazySchema2(
|
|
3026
|
+
() => zodSchema14(
|
|
3027
|
+
z16.object({
|
|
3028
|
+
outputs: z16.array(
|
|
3029
|
+
z16.discriminatedUnion("type", [
|
|
3030
|
+
z16.object({ type: z16.literal("logs"), logs: z16.string() }),
|
|
3031
|
+
z16.object({ type: z16.literal("image"), url: z16.string() })
|
|
3032
|
+
])
|
|
3033
|
+
).nullish()
|
|
3034
|
+
})
|
|
3035
|
+
)
|
|
3036
|
+
);
|
|
3037
|
+
var codeInterpreterArgsSchema = lazySchema2(
|
|
3038
|
+
() => zodSchema14(
|
|
3039
|
+
z16.object({
|
|
3040
|
+
container: z16.union([
|
|
3041
|
+
z16.string(),
|
|
3042
|
+
z16.object({
|
|
3043
|
+
fileIds: z16.array(z16.string()).optional()
|
|
3044
|
+
})
|
|
3045
|
+
]).optional()
|
|
3046
|
+
})
|
|
3047
|
+
)
|
|
3048
|
+
);
|
|
2370
3049
|
var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema2({
|
|
2371
3050
|
id: "openai.code_interpreter",
|
|
2372
3051
|
name: "code_interpreter",
|
|
@@ -2378,169 +3057,216 @@ var codeInterpreter = (args = {}) => {
|
|
|
2378
3057
|
};
|
|
2379
3058
|
|
|
2380
3059
|
// src/tool/file-search.ts
|
|
2381
|
-
import {
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
3060
|
+
import {
|
|
3061
|
+
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3,
|
|
3062
|
+
lazySchema as lazySchema3,
|
|
3063
|
+
zodSchema as zodSchema15
|
|
3064
|
+
} from "@ai-sdk/provider-utils";
|
|
3065
|
+
import * as z17 from "zod/v4";
|
|
3066
|
+
var comparisonFilterSchema = z17.object({
|
|
3067
|
+
key: z17.string(),
|
|
3068
|
+
type: z17.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
|
|
3069
|
+
value: z17.union([z17.string(), z17.number(), z17.boolean()])
|
|
2387
3070
|
});
|
|
2388
|
-
var compoundFilterSchema =
|
|
2389
|
-
type:
|
|
2390
|
-
filters:
|
|
2391
|
-
|
|
3071
|
+
var compoundFilterSchema = z17.object({
|
|
3072
|
+
type: z17.enum(["and", "or"]),
|
|
3073
|
+
filters: z17.array(
|
|
3074
|
+
z17.union([comparisonFilterSchema, z17.lazy(() => compoundFilterSchema)])
|
|
2392
3075
|
)
|
|
2393
3076
|
});
|
|
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()
|
|
3077
|
+
var fileSearchArgsSchema = lazySchema3(
|
|
3078
|
+
() => zodSchema15(
|
|
3079
|
+
z17.object({
|
|
3080
|
+
vectorStoreIds: z17.array(z17.string()),
|
|
3081
|
+
maxNumResults: z17.number().optional(),
|
|
3082
|
+
ranking: z17.object({
|
|
3083
|
+
ranker: z17.string().optional(),
|
|
3084
|
+
scoreThreshold: z17.number().optional()
|
|
3085
|
+
}).optional(),
|
|
3086
|
+
filters: z17.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
2412
3087
|
})
|
|
2413
|
-
)
|
|
2414
|
-
|
|
3088
|
+
)
|
|
3089
|
+
);
|
|
3090
|
+
var fileSearchOutputSchema = lazySchema3(
|
|
3091
|
+
() => zodSchema15(
|
|
3092
|
+
z17.object({
|
|
3093
|
+
queries: z17.array(z17.string()),
|
|
3094
|
+
results: z17.array(
|
|
3095
|
+
z17.object({
|
|
3096
|
+
attributes: z17.record(z17.string(), z17.unknown()),
|
|
3097
|
+
fileId: z17.string(),
|
|
3098
|
+
filename: z17.string(),
|
|
3099
|
+
score: z17.number(),
|
|
3100
|
+
text: z17.string()
|
|
3101
|
+
})
|
|
3102
|
+
).nullable()
|
|
3103
|
+
})
|
|
3104
|
+
)
|
|
3105
|
+
);
|
|
2415
3106
|
var fileSearch = createProviderDefinedToolFactoryWithOutputSchema3({
|
|
2416
3107
|
id: "openai.file_search",
|
|
2417
3108
|
name: "file_search",
|
|
2418
|
-
inputSchema:
|
|
3109
|
+
inputSchema: z17.object({}),
|
|
2419
3110
|
outputSchema: fileSearchOutputSchema
|
|
2420
3111
|
});
|
|
2421
3112
|
|
|
2422
3113
|
// src/tool/web-search.ts
|
|
2423
|
-
import {
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
3114
|
+
import {
|
|
3115
|
+
createProviderDefinedToolFactory,
|
|
3116
|
+
lazySchema as lazySchema4,
|
|
3117
|
+
zodSchema as zodSchema16
|
|
3118
|
+
} from "@ai-sdk/provider-utils";
|
|
3119
|
+
import * as z18 from "zod/v4";
|
|
3120
|
+
var webSearchArgsSchema = lazySchema4(
|
|
3121
|
+
() => zodSchema16(
|
|
3122
|
+
z18.object({
|
|
3123
|
+
filters: z18.object({
|
|
3124
|
+
allowedDomains: z18.array(z18.string()).optional()
|
|
3125
|
+
}).optional(),
|
|
3126
|
+
searchContextSize: z18.enum(["low", "medium", "high"]).optional(),
|
|
3127
|
+
userLocation: z18.object({
|
|
3128
|
+
type: z18.literal("approximate"),
|
|
3129
|
+
country: z18.string().optional(),
|
|
3130
|
+
city: z18.string().optional(),
|
|
3131
|
+
region: z18.string().optional(),
|
|
3132
|
+
timezone: z18.string().optional()
|
|
3133
|
+
}).optional()
|
|
3134
|
+
})
|
|
3135
|
+
)
|
|
3136
|
+
);
|
|
3137
|
+
var webSearchInputSchema = lazySchema4(
|
|
3138
|
+
() => zodSchema16(
|
|
3139
|
+
z18.object({
|
|
3140
|
+
action: z18.discriminatedUnion("type", [
|
|
3141
|
+
z18.object({
|
|
3142
|
+
type: z18.literal("search"),
|
|
3143
|
+
query: z18.string().nullish()
|
|
3144
|
+
}),
|
|
3145
|
+
z18.object({
|
|
3146
|
+
type: z18.literal("open_page"),
|
|
3147
|
+
url: z18.string()
|
|
3148
|
+
}),
|
|
3149
|
+
z18.object({
|
|
3150
|
+
type: z18.literal("find"),
|
|
3151
|
+
url: z18.string(),
|
|
3152
|
+
pattern: z18.string()
|
|
3153
|
+
})
|
|
3154
|
+
]).nullish()
|
|
3155
|
+
})
|
|
3156
|
+
)
|
|
3157
|
+
);
|
|
2438
3158
|
var webSearchToolFactory = createProviderDefinedToolFactory({
|
|
2439
3159
|
id: "openai.web_search",
|
|
2440
3160
|
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
|
-
})
|
|
3161
|
+
inputSchema: webSearchInputSchema
|
|
2458
3162
|
});
|
|
2459
3163
|
|
|
2460
3164
|
// 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
|
-
|
|
3165
|
+
import {
|
|
3166
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
|
|
3167
|
+
lazySchema as lazySchema5,
|
|
3168
|
+
zodSchema as zodSchema17
|
|
3169
|
+
} from "@ai-sdk/provider-utils";
|
|
3170
|
+
import * as z19 from "zod/v4";
|
|
3171
|
+
var webSearchPreviewArgsSchema = lazySchema5(
|
|
3172
|
+
() => zodSchema17(
|
|
3173
|
+
z19.object({
|
|
3174
|
+
/**
|
|
3175
|
+
* Search context size to use for the web search.
|
|
3176
|
+
* - high: Most comprehensive context, highest cost, slower response
|
|
3177
|
+
* - medium: Balanced context, cost, and latency (default)
|
|
3178
|
+
* - low: Least context, lowest cost, fastest response
|
|
3179
|
+
*/
|
|
3180
|
+
searchContextSize: z19.enum(["low", "medium", "high"]).optional(),
|
|
3181
|
+
/**
|
|
3182
|
+
* User location information to provide geographically relevant search results.
|
|
3183
|
+
*/
|
|
3184
|
+
userLocation: z19.object({
|
|
3185
|
+
/**
|
|
3186
|
+
* Type of location (always 'approximate')
|
|
3187
|
+
*/
|
|
3188
|
+
type: z19.literal("approximate"),
|
|
3189
|
+
/**
|
|
3190
|
+
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
3191
|
+
*/
|
|
3192
|
+
country: z19.string().optional(),
|
|
3193
|
+
/**
|
|
3194
|
+
* City name (free text, e.g., 'Minneapolis')
|
|
3195
|
+
*/
|
|
3196
|
+
city: z19.string().optional(),
|
|
3197
|
+
/**
|
|
3198
|
+
* Region name (free text, e.g., 'Minnesota')
|
|
3199
|
+
*/
|
|
3200
|
+
region: z19.string().optional(),
|
|
3201
|
+
/**
|
|
3202
|
+
* IANA timezone (e.g., 'America/Chicago')
|
|
3203
|
+
*/
|
|
3204
|
+
timezone: z19.string().optional()
|
|
3205
|
+
}).optional()
|
|
3206
|
+
})
|
|
3207
|
+
)
|
|
3208
|
+
);
|
|
3209
|
+
var webSearchPreviewInputSchema = lazySchema5(
|
|
3210
|
+
() => zodSchema17(
|
|
3211
|
+
z19.object({
|
|
3212
|
+
action: z19.discriminatedUnion("type", [
|
|
3213
|
+
z19.object({
|
|
3214
|
+
type: z19.literal("search"),
|
|
3215
|
+
query: z19.string().nullish()
|
|
3216
|
+
}),
|
|
3217
|
+
z19.object({
|
|
3218
|
+
type: z19.literal("open_page"),
|
|
3219
|
+
url: z19.string()
|
|
3220
|
+
}),
|
|
3221
|
+
z19.object({
|
|
3222
|
+
type: z19.literal("find"),
|
|
3223
|
+
url: z19.string(),
|
|
3224
|
+
pattern: z19.string()
|
|
3225
|
+
})
|
|
3226
|
+
]).nullish()
|
|
3227
|
+
})
|
|
3228
|
+
)
|
|
3229
|
+
);
|
|
2497
3230
|
var webSearchPreview = createProviderDefinedToolFactory2({
|
|
2498
3231
|
id: "openai.web_search_preview",
|
|
2499
3232
|
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
|
-
})
|
|
3233
|
+
inputSchema: webSearchPreviewInputSchema
|
|
2517
3234
|
});
|
|
2518
3235
|
|
|
2519
3236
|
// 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
|
-
|
|
3237
|
+
import {
|
|
3238
|
+
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema4,
|
|
3239
|
+
lazySchema as lazySchema6,
|
|
3240
|
+
zodSchema as zodSchema18
|
|
3241
|
+
} from "@ai-sdk/provider-utils";
|
|
3242
|
+
import * as z20 from "zod/v4";
|
|
3243
|
+
var imageGenerationArgsSchema = lazySchema6(
|
|
3244
|
+
() => zodSchema18(
|
|
3245
|
+
z20.object({
|
|
3246
|
+
background: z20.enum(["auto", "opaque", "transparent"]).optional(),
|
|
3247
|
+
inputFidelity: z20.enum(["low", "high"]).optional(),
|
|
3248
|
+
inputImageMask: z20.object({
|
|
3249
|
+
fileId: z20.string().optional(),
|
|
3250
|
+
imageUrl: z20.string().optional()
|
|
3251
|
+
}).optional(),
|
|
3252
|
+
model: z20.string().optional(),
|
|
3253
|
+
moderation: z20.enum(["auto"]).optional(),
|
|
3254
|
+
outputCompression: z20.number().int().min(0).max(100).optional(),
|
|
3255
|
+
outputFormat: z20.enum(["png", "jpeg", "webp"]).optional(),
|
|
3256
|
+
partialImages: z20.number().int().min(0).max(3).optional(),
|
|
3257
|
+
quality: z20.enum(["auto", "low", "medium", "high"]).optional(),
|
|
3258
|
+
size: z20.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
3259
|
+
}).strict()
|
|
3260
|
+
)
|
|
3261
|
+
);
|
|
3262
|
+
var imageGenerationInputSchema = lazySchema6(() => zodSchema18(z20.object({})));
|
|
3263
|
+
var imageGenerationOutputSchema = lazySchema6(
|
|
3264
|
+
() => zodSchema18(z20.object({ result: z20.string() }))
|
|
3265
|
+
);
|
|
2540
3266
|
var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
2541
3267
|
id: "openai.image_generation",
|
|
2542
3268
|
name: "image_generation",
|
|
2543
|
-
inputSchema:
|
|
3269
|
+
inputSchema: imageGenerationInputSchema,
|
|
2544
3270
|
outputSchema: imageGenerationOutputSchema
|
|
2545
3271
|
});
|
|
2546
3272
|
var imageGeneration = (args = {}) => {
|
|
@@ -2548,7 +3274,8 @@ var imageGeneration = (args = {}) => {
|
|
|
2548
3274
|
};
|
|
2549
3275
|
|
|
2550
3276
|
// src/responses/openai-responses-prepare-tools.ts
|
|
2551
|
-
|
|
3277
|
+
import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
|
|
3278
|
+
async function prepareResponsesTools({
|
|
2552
3279
|
tools,
|
|
2553
3280
|
toolChoice,
|
|
2554
3281
|
strictJsonSchema
|
|
@@ -2573,7 +3300,10 @@ function prepareResponsesTools({
|
|
|
2573
3300
|
case "provider-defined": {
|
|
2574
3301
|
switch (tool.id) {
|
|
2575
3302
|
case "openai.file_search": {
|
|
2576
|
-
const args =
|
|
3303
|
+
const args = await validateTypes2({
|
|
3304
|
+
value: tool.args,
|
|
3305
|
+
schema: fileSearchArgsSchema
|
|
3306
|
+
});
|
|
2577
3307
|
openaiTools.push({
|
|
2578
3308
|
type: "file_search",
|
|
2579
3309
|
vector_store_ids: args.vectorStoreIds,
|
|
@@ -2593,7 +3323,10 @@ function prepareResponsesTools({
|
|
|
2593
3323
|
break;
|
|
2594
3324
|
}
|
|
2595
3325
|
case "openai.web_search_preview": {
|
|
2596
|
-
const args =
|
|
3326
|
+
const args = await validateTypes2({
|
|
3327
|
+
value: tool.args,
|
|
3328
|
+
schema: webSearchPreviewArgsSchema
|
|
3329
|
+
});
|
|
2597
3330
|
openaiTools.push({
|
|
2598
3331
|
type: "web_search_preview",
|
|
2599
3332
|
search_context_size: args.searchContextSize,
|
|
@@ -2602,7 +3335,10 @@ function prepareResponsesTools({
|
|
|
2602
3335
|
break;
|
|
2603
3336
|
}
|
|
2604
3337
|
case "openai.web_search": {
|
|
2605
|
-
const args =
|
|
3338
|
+
const args = await validateTypes2({
|
|
3339
|
+
value: tool.args,
|
|
3340
|
+
schema: webSearchArgsSchema
|
|
3341
|
+
});
|
|
2606
3342
|
openaiTools.push({
|
|
2607
3343
|
type: "web_search",
|
|
2608
3344
|
filters: args.filters != null ? { allowed_domains: args.filters.allowedDomains } : void 0,
|
|
@@ -2612,7 +3348,10 @@ function prepareResponsesTools({
|
|
|
2612
3348
|
break;
|
|
2613
3349
|
}
|
|
2614
3350
|
case "openai.code_interpreter": {
|
|
2615
|
-
const args =
|
|
3351
|
+
const args = await validateTypes2({
|
|
3352
|
+
value: tool.args,
|
|
3353
|
+
schema: codeInterpreterArgsSchema
|
|
3354
|
+
});
|
|
2616
3355
|
openaiTools.push({
|
|
2617
3356
|
type: "code_interpreter",
|
|
2618
3357
|
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 +3359,10 @@ function prepareResponsesTools({
|
|
|
2620
3359
|
break;
|
|
2621
3360
|
}
|
|
2622
3361
|
case "openai.image_generation": {
|
|
2623
|
-
const args =
|
|
3362
|
+
const args = await validateTypes2({
|
|
3363
|
+
value: tool.args,
|
|
3364
|
+
schema: imageGenerationArgsSchema
|
|
3365
|
+
});
|
|
2624
3366
|
openaiTools.push({
|
|
2625
3367
|
type: "image_generation",
|
|
2626
3368
|
background: args.background,
|
|
@@ -2672,83 +3414,6 @@ function prepareResponsesTools({
|
|
|
2672
3414
|
}
|
|
2673
3415
|
|
|
2674
3416
|
// 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
3417
|
var OpenAIResponsesLanguageModel = class {
|
|
2753
3418
|
constructor(modelId, config) {
|
|
2754
3419
|
this.specificationVersion = "v3";
|
|
@@ -2940,7 +3605,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2940
3605
|
tools: openaiTools,
|
|
2941
3606
|
toolChoice: openaiToolChoice,
|
|
2942
3607
|
toolWarnings
|
|
2943
|
-
} = prepareResponsesTools({
|
|
3608
|
+
} = await prepareResponsesTools({
|
|
2944
3609
|
tools,
|
|
2945
3610
|
toolChoice,
|
|
2946
3611
|
strictJsonSchema
|
|
@@ -2976,85 +3641,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2976
3641
|
body,
|
|
2977
3642
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2978
3643
|
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
|
-
})
|
|
3644
|
+
openaiResponsesResponseSchema
|
|
3058
3645
|
),
|
|
3059
3646
|
abortSignal: options.abortSignal,
|
|
3060
3647
|
fetch: this.config.fetch
|
|
@@ -3117,7 +3704,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3117
3704
|
type: "tool-call",
|
|
3118
3705
|
toolCallId: part.call_id,
|
|
3119
3706
|
toolName: "local_shell",
|
|
3120
|
-
input: JSON.stringify({
|
|
3707
|
+
input: JSON.stringify({
|
|
3708
|
+
action: part.action
|
|
3709
|
+
}),
|
|
3121
3710
|
providerMetadata: {
|
|
3122
3711
|
openai: {
|
|
3123
3712
|
itemId: part.id
|
|
@@ -3748,203 +4337,6 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3748
4337
|
};
|
|
3749
4338
|
}
|
|
3750
4339
|
};
|
|
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
4340
|
function isTextDeltaChunk(chunk) {
|
|
3949
4341
|
return chunk.type === "response.output_text.delta";
|
|
3950
4342
|
}
|
|
@@ -4024,47 +4416,6 @@ function getResponsesModelConfig(modelId) {
|
|
|
4024
4416
|
isReasoningModel: false
|
|
4025
4417
|
};
|
|
4026
4418
|
}
|
|
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
4419
|
export {
|
|
4069
4420
|
OpenAIChatLanguageModel,
|
|
4070
4421
|
OpenAICompletionLanguageModel,
|
|
@@ -4089,6 +4440,7 @@ export {
|
|
|
4089
4440
|
openAITranscriptionProviderOptions,
|
|
4090
4441
|
openaiChatLanguageModelOptions,
|
|
4091
4442
|
openaiCompletionProviderOptions,
|
|
4092
|
-
openaiEmbeddingProviderOptions
|
|
4443
|
+
openaiEmbeddingProviderOptions,
|
|
4444
|
+
openaiSpeechProviderOptionsSchema
|
|
4093
4445
|
};
|
|
4094
4446
|
//# sourceMappingURL=index.mjs.map
|