@ai-sdk/openai 2.0.30 → 2.0.32
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 +15 -0
- package/dist/index.d.mts +85 -23
- package/dist/index.d.ts +85 -23
- package/dist/index.js +773 -690
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +712 -629
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +13 -12
- package/dist/internal/index.d.ts +13 -12
- package/dist/internal/index.js +760 -694
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +701 -635
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
parseProviderOptions,
|
|
18
18
|
postJsonToApi
|
|
19
19
|
} from "@ai-sdk/provider-utils";
|
|
20
|
-
import { z as
|
|
20
|
+
import { z as z3 } from "zod/v4";
|
|
21
21
|
|
|
22
22
|
// src/openai-error.ts
|
|
23
23
|
import { z } from "zod/v4";
|
|
@@ -342,98 +342,6 @@ var openaiProviderOptions = z2.object({
|
|
|
342
342
|
import {
|
|
343
343
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
344
344
|
} from "@ai-sdk/provider";
|
|
345
|
-
|
|
346
|
-
// src/tool/file-search.ts
|
|
347
|
-
import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
|
|
348
|
-
import { z as z3 } from "zod/v4";
|
|
349
|
-
var comparisonFilterSchema = z3.object({
|
|
350
|
-
key: z3.string(),
|
|
351
|
-
type: z3.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
|
|
352
|
-
value: z3.union([z3.string(), z3.number(), z3.boolean()])
|
|
353
|
-
});
|
|
354
|
-
var compoundFilterSchema = z3.object({
|
|
355
|
-
type: z3.enum(["and", "or"]),
|
|
356
|
-
filters: z3.array(
|
|
357
|
-
z3.union([comparisonFilterSchema, z3.lazy(() => compoundFilterSchema)])
|
|
358
|
-
)
|
|
359
|
-
});
|
|
360
|
-
var filtersSchema = z3.union([comparisonFilterSchema, compoundFilterSchema]);
|
|
361
|
-
var fileSearchArgsSchema = z3.object({
|
|
362
|
-
vectorStoreIds: z3.array(z3.string()).optional(),
|
|
363
|
-
maxNumResults: z3.number().optional(),
|
|
364
|
-
ranking: z3.object({
|
|
365
|
-
ranker: z3.enum(["auto", "default-2024-08-21"]).optional()
|
|
366
|
-
}).optional(),
|
|
367
|
-
filters: filtersSchema.optional()
|
|
368
|
-
});
|
|
369
|
-
var fileSearch = createProviderDefinedToolFactory({
|
|
370
|
-
id: "openai.file_search",
|
|
371
|
-
name: "file_search",
|
|
372
|
-
inputSchema: z3.object({
|
|
373
|
-
query: z3.string()
|
|
374
|
-
})
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
// src/tool/web-search-preview.ts
|
|
378
|
-
import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
|
|
379
|
-
import { z as z4 } from "zod/v4";
|
|
380
|
-
var webSearchPreviewArgsSchema = z4.object({
|
|
381
|
-
/**
|
|
382
|
-
* Search context size to use for the web search.
|
|
383
|
-
* - high: Most comprehensive context, highest cost, slower response
|
|
384
|
-
* - medium: Balanced context, cost, and latency (default)
|
|
385
|
-
* - low: Least context, lowest cost, fastest response
|
|
386
|
-
*/
|
|
387
|
-
searchContextSize: z4.enum(["low", "medium", "high"]).optional(),
|
|
388
|
-
/**
|
|
389
|
-
* User location information to provide geographically relevant search results.
|
|
390
|
-
*/
|
|
391
|
-
userLocation: z4.object({
|
|
392
|
-
/**
|
|
393
|
-
* Type of location (always 'approximate')
|
|
394
|
-
*/
|
|
395
|
-
type: z4.literal("approximate"),
|
|
396
|
-
/**
|
|
397
|
-
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
398
|
-
*/
|
|
399
|
-
country: z4.string().optional(),
|
|
400
|
-
/**
|
|
401
|
-
* City name (free text, e.g., 'Minneapolis')
|
|
402
|
-
*/
|
|
403
|
-
city: z4.string().optional(),
|
|
404
|
-
/**
|
|
405
|
-
* Region name (free text, e.g., 'Minnesota')
|
|
406
|
-
*/
|
|
407
|
-
region: z4.string().optional(),
|
|
408
|
-
/**
|
|
409
|
-
* IANA timezone (e.g., 'America/Chicago')
|
|
410
|
-
*/
|
|
411
|
-
timezone: z4.string().optional()
|
|
412
|
-
}).optional()
|
|
413
|
-
});
|
|
414
|
-
var webSearchPreview = createProviderDefinedToolFactory2({
|
|
415
|
-
id: "openai.web_search_preview",
|
|
416
|
-
name: "web_search_preview",
|
|
417
|
-
inputSchema: z4.object({
|
|
418
|
-
action: z4.discriminatedUnion("type", [
|
|
419
|
-
z4.object({
|
|
420
|
-
type: z4.literal("search"),
|
|
421
|
-
query: z4.string().nullish()
|
|
422
|
-
}),
|
|
423
|
-
z4.object({
|
|
424
|
-
type: z4.literal("open_page"),
|
|
425
|
-
url: z4.string()
|
|
426
|
-
}),
|
|
427
|
-
z4.object({
|
|
428
|
-
type: z4.literal("find"),
|
|
429
|
-
url: z4.string(),
|
|
430
|
-
pattern: z4.string()
|
|
431
|
-
})
|
|
432
|
-
]).nullish()
|
|
433
|
-
})
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
// src/chat/openai-chat-prepare-tools.ts
|
|
437
345
|
function prepareChatTools({
|
|
438
346
|
tools,
|
|
439
347
|
toolChoice,
|
|
@@ -459,33 +367,6 @@ function prepareChatTools({
|
|
|
459
367
|
}
|
|
460
368
|
});
|
|
461
369
|
break;
|
|
462
|
-
case "provider-defined":
|
|
463
|
-
switch (tool.id) {
|
|
464
|
-
case "openai.file_search": {
|
|
465
|
-
const args = fileSearchArgsSchema.parse(tool.args);
|
|
466
|
-
openaiTools2.push({
|
|
467
|
-
type: "file_search",
|
|
468
|
-
vector_store_ids: args.vectorStoreIds,
|
|
469
|
-
max_num_results: args.maxNumResults,
|
|
470
|
-
ranking_options: args.ranking ? { ranker: args.ranking.ranker } : void 0,
|
|
471
|
-
filters: args.filters
|
|
472
|
-
});
|
|
473
|
-
break;
|
|
474
|
-
}
|
|
475
|
-
case "openai.web_search_preview": {
|
|
476
|
-
const args = webSearchPreviewArgsSchema.parse(tool.args);
|
|
477
|
-
openaiTools2.push({
|
|
478
|
-
type: "web_search_preview",
|
|
479
|
-
search_context_size: args.searchContextSize,
|
|
480
|
-
user_location: args.userLocation
|
|
481
|
-
});
|
|
482
|
-
break;
|
|
483
|
-
}
|
|
484
|
-
default:
|
|
485
|
-
toolWarnings.push({ type: "unsupported-tool", tool });
|
|
486
|
-
break;
|
|
487
|
-
}
|
|
488
|
-
break;
|
|
489
370
|
default:
|
|
490
371
|
toolWarnings.push({ type: "unsupported-tool", tool });
|
|
491
372
|
break;
|
|
@@ -1013,115 +894,115 @@ var OpenAIChatLanguageModel = class {
|
|
|
1013
894
|
};
|
|
1014
895
|
}
|
|
1015
896
|
};
|
|
1016
|
-
var openaiTokenUsageSchema =
|
|
1017
|
-
prompt_tokens:
|
|
1018
|
-
completion_tokens:
|
|
1019
|
-
total_tokens:
|
|
1020
|
-
prompt_tokens_details:
|
|
1021
|
-
cached_tokens:
|
|
897
|
+
var openaiTokenUsageSchema = z3.object({
|
|
898
|
+
prompt_tokens: z3.number().nullish(),
|
|
899
|
+
completion_tokens: z3.number().nullish(),
|
|
900
|
+
total_tokens: z3.number().nullish(),
|
|
901
|
+
prompt_tokens_details: z3.object({
|
|
902
|
+
cached_tokens: z3.number().nullish()
|
|
1022
903
|
}).nullish(),
|
|
1023
|
-
completion_tokens_details:
|
|
1024
|
-
reasoning_tokens:
|
|
1025
|
-
accepted_prediction_tokens:
|
|
1026
|
-
rejected_prediction_tokens:
|
|
904
|
+
completion_tokens_details: z3.object({
|
|
905
|
+
reasoning_tokens: z3.number().nullish(),
|
|
906
|
+
accepted_prediction_tokens: z3.number().nullish(),
|
|
907
|
+
rejected_prediction_tokens: z3.number().nullish()
|
|
1027
908
|
}).nullish()
|
|
1028
909
|
}).nullish();
|
|
1029
|
-
var openaiChatResponseSchema =
|
|
1030
|
-
id:
|
|
1031
|
-
created:
|
|
1032
|
-
model:
|
|
1033
|
-
choices:
|
|
1034
|
-
|
|
1035
|
-
message:
|
|
1036
|
-
role:
|
|
1037
|
-
content:
|
|
1038
|
-
tool_calls:
|
|
1039
|
-
|
|
1040
|
-
id:
|
|
1041
|
-
type:
|
|
1042
|
-
function:
|
|
1043
|
-
name:
|
|
1044
|
-
arguments:
|
|
910
|
+
var openaiChatResponseSchema = z3.object({
|
|
911
|
+
id: z3.string().nullish(),
|
|
912
|
+
created: z3.number().nullish(),
|
|
913
|
+
model: z3.string().nullish(),
|
|
914
|
+
choices: z3.array(
|
|
915
|
+
z3.object({
|
|
916
|
+
message: z3.object({
|
|
917
|
+
role: z3.literal("assistant").nullish(),
|
|
918
|
+
content: z3.string().nullish(),
|
|
919
|
+
tool_calls: z3.array(
|
|
920
|
+
z3.object({
|
|
921
|
+
id: z3.string().nullish(),
|
|
922
|
+
type: z3.literal("function"),
|
|
923
|
+
function: z3.object({
|
|
924
|
+
name: z3.string(),
|
|
925
|
+
arguments: z3.string()
|
|
1045
926
|
})
|
|
1046
927
|
})
|
|
1047
928
|
).nullish(),
|
|
1048
|
-
annotations:
|
|
1049
|
-
|
|
1050
|
-
type:
|
|
1051
|
-
start_index:
|
|
1052
|
-
end_index:
|
|
1053
|
-
url:
|
|
1054
|
-
title:
|
|
929
|
+
annotations: z3.array(
|
|
930
|
+
z3.object({
|
|
931
|
+
type: z3.literal("url_citation"),
|
|
932
|
+
start_index: z3.number(),
|
|
933
|
+
end_index: z3.number(),
|
|
934
|
+
url: z3.string(),
|
|
935
|
+
title: z3.string()
|
|
1055
936
|
})
|
|
1056
937
|
).nullish()
|
|
1057
938
|
}),
|
|
1058
|
-
index:
|
|
1059
|
-
logprobs:
|
|
1060
|
-
content:
|
|
1061
|
-
|
|
1062
|
-
token:
|
|
1063
|
-
logprob:
|
|
1064
|
-
top_logprobs:
|
|
1065
|
-
|
|
1066
|
-
token:
|
|
1067
|
-
logprob:
|
|
939
|
+
index: z3.number(),
|
|
940
|
+
logprobs: z3.object({
|
|
941
|
+
content: z3.array(
|
|
942
|
+
z3.object({
|
|
943
|
+
token: z3.string(),
|
|
944
|
+
logprob: z3.number(),
|
|
945
|
+
top_logprobs: z3.array(
|
|
946
|
+
z3.object({
|
|
947
|
+
token: z3.string(),
|
|
948
|
+
logprob: z3.number()
|
|
1068
949
|
})
|
|
1069
950
|
)
|
|
1070
951
|
})
|
|
1071
952
|
).nullish()
|
|
1072
953
|
}).nullish(),
|
|
1073
|
-
finish_reason:
|
|
954
|
+
finish_reason: z3.string().nullish()
|
|
1074
955
|
})
|
|
1075
956
|
),
|
|
1076
957
|
usage: openaiTokenUsageSchema
|
|
1077
958
|
});
|
|
1078
|
-
var openaiChatChunkSchema =
|
|
1079
|
-
|
|
1080
|
-
id:
|
|
1081
|
-
created:
|
|
1082
|
-
model:
|
|
1083
|
-
choices:
|
|
1084
|
-
|
|
1085
|
-
delta:
|
|
1086
|
-
role:
|
|
1087
|
-
content:
|
|
1088
|
-
tool_calls:
|
|
1089
|
-
|
|
1090
|
-
index:
|
|
1091
|
-
id:
|
|
1092
|
-
type:
|
|
1093
|
-
function:
|
|
1094
|
-
name:
|
|
1095
|
-
arguments:
|
|
959
|
+
var openaiChatChunkSchema = z3.union([
|
|
960
|
+
z3.object({
|
|
961
|
+
id: z3.string().nullish(),
|
|
962
|
+
created: z3.number().nullish(),
|
|
963
|
+
model: z3.string().nullish(),
|
|
964
|
+
choices: z3.array(
|
|
965
|
+
z3.object({
|
|
966
|
+
delta: z3.object({
|
|
967
|
+
role: z3.enum(["assistant"]).nullish(),
|
|
968
|
+
content: z3.string().nullish(),
|
|
969
|
+
tool_calls: z3.array(
|
|
970
|
+
z3.object({
|
|
971
|
+
index: z3.number(),
|
|
972
|
+
id: z3.string().nullish(),
|
|
973
|
+
type: z3.literal("function").nullish(),
|
|
974
|
+
function: z3.object({
|
|
975
|
+
name: z3.string().nullish(),
|
|
976
|
+
arguments: z3.string().nullish()
|
|
1096
977
|
})
|
|
1097
978
|
})
|
|
1098
979
|
).nullish(),
|
|
1099
|
-
annotations:
|
|
1100
|
-
|
|
1101
|
-
type:
|
|
1102
|
-
start_index:
|
|
1103
|
-
end_index:
|
|
1104
|
-
url:
|
|
1105
|
-
title:
|
|
980
|
+
annotations: z3.array(
|
|
981
|
+
z3.object({
|
|
982
|
+
type: z3.literal("url_citation"),
|
|
983
|
+
start_index: z3.number(),
|
|
984
|
+
end_index: z3.number(),
|
|
985
|
+
url: z3.string(),
|
|
986
|
+
title: z3.string()
|
|
1106
987
|
})
|
|
1107
988
|
).nullish()
|
|
1108
989
|
}).nullish(),
|
|
1109
|
-
logprobs:
|
|
1110
|
-
content:
|
|
1111
|
-
|
|
1112
|
-
token:
|
|
1113
|
-
logprob:
|
|
1114
|
-
top_logprobs:
|
|
1115
|
-
|
|
1116
|
-
token:
|
|
1117
|
-
logprob:
|
|
990
|
+
logprobs: z3.object({
|
|
991
|
+
content: z3.array(
|
|
992
|
+
z3.object({
|
|
993
|
+
token: z3.string(),
|
|
994
|
+
logprob: z3.number(),
|
|
995
|
+
top_logprobs: z3.array(
|
|
996
|
+
z3.object({
|
|
997
|
+
token: z3.string(),
|
|
998
|
+
logprob: z3.number()
|
|
1118
999
|
})
|
|
1119
1000
|
)
|
|
1120
1001
|
})
|
|
1121
1002
|
).nullish()
|
|
1122
1003
|
}).nullish(),
|
|
1123
|
-
finish_reason:
|
|
1124
|
-
index:
|
|
1004
|
+
finish_reason: z3.string().nullish(),
|
|
1005
|
+
index: z3.number()
|
|
1125
1006
|
})
|
|
1126
1007
|
),
|
|
1127
1008
|
usage: openaiTokenUsageSchema
|
|
@@ -1185,7 +1066,7 @@ import {
|
|
|
1185
1066
|
parseProviderOptions as parseProviderOptions2,
|
|
1186
1067
|
postJsonToApi as postJsonToApi2
|
|
1187
1068
|
} from "@ai-sdk/provider-utils";
|
|
1188
|
-
import { z as
|
|
1069
|
+
import { z as z5 } from "zod/v4";
|
|
1189
1070
|
|
|
1190
1071
|
// src/completion/convert-to-openai-completion-prompt.ts
|
|
1191
1072
|
import {
|
|
@@ -1296,12 +1177,12 @@ function mapOpenAIFinishReason2(finishReason) {
|
|
|
1296
1177
|
}
|
|
1297
1178
|
|
|
1298
1179
|
// src/completion/openai-completion-options.ts
|
|
1299
|
-
import { z as
|
|
1300
|
-
var openaiCompletionProviderOptions =
|
|
1180
|
+
import { z as z4 } from "zod/v4";
|
|
1181
|
+
var openaiCompletionProviderOptions = z4.object({
|
|
1301
1182
|
/**
|
|
1302
1183
|
Echo back the prompt in addition to the completion.
|
|
1303
1184
|
*/
|
|
1304
|
-
echo:
|
|
1185
|
+
echo: z4.boolean().optional(),
|
|
1305
1186
|
/**
|
|
1306
1187
|
Modify the likelihood of specified tokens appearing in the completion.
|
|
1307
1188
|
|
|
@@ -1316,16 +1197,16 @@ var openaiCompletionProviderOptions = z6.object({
|
|
|
1316
1197
|
As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
|
|
1317
1198
|
token from being generated.
|
|
1318
1199
|
*/
|
|
1319
|
-
logitBias:
|
|
1200
|
+
logitBias: z4.record(z4.string(), z4.number()).optional(),
|
|
1320
1201
|
/**
|
|
1321
1202
|
The suffix that comes after a completion of inserted text.
|
|
1322
1203
|
*/
|
|
1323
|
-
suffix:
|
|
1204
|
+
suffix: z4.string().optional(),
|
|
1324
1205
|
/**
|
|
1325
1206
|
A unique identifier representing your end-user, which can help OpenAI to
|
|
1326
1207
|
monitor and detect abuse. Learn more.
|
|
1327
1208
|
*/
|
|
1328
|
-
user:
|
|
1209
|
+
user: z4.string().optional(),
|
|
1329
1210
|
/**
|
|
1330
1211
|
Return the log probabilities of the tokens. Including logprobs will increase
|
|
1331
1212
|
the response size and can slow down response times. However, it can
|
|
@@ -1335,7 +1216,7 @@ var openaiCompletionProviderOptions = z6.object({
|
|
|
1335
1216
|
Setting to a number will return the log probabilities of the top n
|
|
1336
1217
|
tokens that were generated.
|
|
1337
1218
|
*/
|
|
1338
|
-
logprobs:
|
|
1219
|
+
logprobs: z4.union([z4.boolean(), z4.number()]).optional()
|
|
1339
1220
|
});
|
|
1340
1221
|
|
|
1341
1222
|
// src/completion/openai-completion-language-model.ts
|
|
@@ -1567,42 +1448,42 @@ var OpenAICompletionLanguageModel = class {
|
|
|
1567
1448
|
};
|
|
1568
1449
|
}
|
|
1569
1450
|
};
|
|
1570
|
-
var usageSchema =
|
|
1571
|
-
prompt_tokens:
|
|
1572
|
-
completion_tokens:
|
|
1573
|
-
total_tokens:
|
|
1451
|
+
var usageSchema = z5.object({
|
|
1452
|
+
prompt_tokens: z5.number(),
|
|
1453
|
+
completion_tokens: z5.number(),
|
|
1454
|
+
total_tokens: z5.number()
|
|
1574
1455
|
});
|
|
1575
|
-
var openaiCompletionResponseSchema =
|
|
1576
|
-
id:
|
|
1577
|
-
created:
|
|
1578
|
-
model:
|
|
1579
|
-
choices:
|
|
1580
|
-
|
|
1581
|
-
text:
|
|
1582
|
-
finish_reason:
|
|
1583
|
-
logprobs:
|
|
1584
|
-
tokens:
|
|
1585
|
-
token_logprobs:
|
|
1586
|
-
top_logprobs:
|
|
1456
|
+
var openaiCompletionResponseSchema = z5.object({
|
|
1457
|
+
id: z5.string().nullish(),
|
|
1458
|
+
created: z5.number().nullish(),
|
|
1459
|
+
model: z5.string().nullish(),
|
|
1460
|
+
choices: z5.array(
|
|
1461
|
+
z5.object({
|
|
1462
|
+
text: z5.string(),
|
|
1463
|
+
finish_reason: z5.string(),
|
|
1464
|
+
logprobs: z5.object({
|
|
1465
|
+
tokens: z5.array(z5.string()),
|
|
1466
|
+
token_logprobs: z5.array(z5.number()),
|
|
1467
|
+
top_logprobs: z5.array(z5.record(z5.string(), z5.number())).nullish()
|
|
1587
1468
|
}).nullish()
|
|
1588
1469
|
})
|
|
1589
1470
|
),
|
|
1590
1471
|
usage: usageSchema.nullish()
|
|
1591
1472
|
});
|
|
1592
|
-
var openaiCompletionChunkSchema =
|
|
1593
|
-
|
|
1594
|
-
id:
|
|
1595
|
-
created:
|
|
1596
|
-
model:
|
|
1597
|
-
choices:
|
|
1598
|
-
|
|
1599
|
-
text:
|
|
1600
|
-
finish_reason:
|
|
1601
|
-
index:
|
|
1602
|
-
logprobs:
|
|
1603
|
-
tokens:
|
|
1604
|
-
token_logprobs:
|
|
1605
|
-
top_logprobs:
|
|
1473
|
+
var openaiCompletionChunkSchema = z5.union([
|
|
1474
|
+
z5.object({
|
|
1475
|
+
id: z5.string().nullish(),
|
|
1476
|
+
created: z5.number().nullish(),
|
|
1477
|
+
model: z5.string().nullish(),
|
|
1478
|
+
choices: z5.array(
|
|
1479
|
+
z5.object({
|
|
1480
|
+
text: z5.string(),
|
|
1481
|
+
finish_reason: z5.string().nullish(),
|
|
1482
|
+
index: z5.number(),
|
|
1483
|
+
logprobs: z5.object({
|
|
1484
|
+
tokens: z5.array(z5.string()),
|
|
1485
|
+
token_logprobs: z5.array(z5.number()),
|
|
1486
|
+
top_logprobs: z5.array(z5.record(z5.string(), z5.number())).nullish()
|
|
1606
1487
|
}).nullish()
|
|
1607
1488
|
})
|
|
1608
1489
|
),
|
|
@@ -1621,21 +1502,21 @@ import {
|
|
|
1621
1502
|
parseProviderOptions as parseProviderOptions3,
|
|
1622
1503
|
postJsonToApi as postJsonToApi3
|
|
1623
1504
|
} from "@ai-sdk/provider-utils";
|
|
1624
|
-
import { z as
|
|
1505
|
+
import { z as z7 } from "zod/v4";
|
|
1625
1506
|
|
|
1626
1507
|
// src/embedding/openai-embedding-options.ts
|
|
1627
|
-
import { z as
|
|
1628
|
-
var openaiEmbeddingProviderOptions =
|
|
1508
|
+
import { z as z6 } from "zod/v4";
|
|
1509
|
+
var openaiEmbeddingProviderOptions = z6.object({
|
|
1629
1510
|
/**
|
|
1630
1511
|
The number of dimensions the resulting output embeddings should have.
|
|
1631
1512
|
Only supported in text-embedding-3 and later models.
|
|
1632
1513
|
*/
|
|
1633
|
-
dimensions:
|
|
1514
|
+
dimensions: z6.number().optional(),
|
|
1634
1515
|
/**
|
|
1635
1516
|
A unique identifier representing your end-user, which can help OpenAI to
|
|
1636
1517
|
monitor and detect abuse. Learn more.
|
|
1637
1518
|
*/
|
|
1638
|
-
user:
|
|
1519
|
+
user: z6.string().optional()
|
|
1639
1520
|
});
|
|
1640
1521
|
|
|
1641
1522
|
// src/embedding/openai-embedding-model.ts
|
|
@@ -1701,9 +1582,9 @@ var OpenAIEmbeddingModel = class {
|
|
|
1701
1582
|
};
|
|
1702
1583
|
}
|
|
1703
1584
|
};
|
|
1704
|
-
var openaiTextEmbeddingResponseSchema =
|
|
1705
|
-
data:
|
|
1706
|
-
usage:
|
|
1585
|
+
var openaiTextEmbeddingResponseSchema = z7.object({
|
|
1586
|
+
data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
|
|
1587
|
+
usage: z7.object({ prompt_tokens: z7.number() }).nullish()
|
|
1707
1588
|
});
|
|
1708
1589
|
|
|
1709
1590
|
// src/image/openai-image-model.ts
|
|
@@ -1712,7 +1593,7 @@ import {
|
|
|
1712
1593
|
createJsonResponseHandler as createJsonResponseHandler4,
|
|
1713
1594
|
postJsonToApi as postJsonToApi4
|
|
1714
1595
|
} from "@ai-sdk/provider-utils";
|
|
1715
|
-
import { z as
|
|
1596
|
+
import { z as z8 } from "zod/v4";
|
|
1716
1597
|
|
|
1717
1598
|
// src/image/openai-image-options.ts
|
|
1718
1599
|
var modelMaxImagesPerCall = {
|
|
@@ -1800,32 +1681,32 @@ var OpenAIImageModel = class {
|
|
|
1800
1681
|
};
|
|
1801
1682
|
}
|
|
1802
1683
|
};
|
|
1803
|
-
var openaiImageResponseSchema =
|
|
1804
|
-
data:
|
|
1805
|
-
|
|
1684
|
+
var openaiImageResponseSchema = z8.object({
|
|
1685
|
+
data: z8.array(
|
|
1686
|
+
z8.object({ b64_json: z8.string(), revised_prompt: z8.string().optional() })
|
|
1806
1687
|
)
|
|
1807
1688
|
});
|
|
1808
1689
|
|
|
1809
1690
|
// src/tool/code-interpreter.ts
|
|
1810
1691
|
import { createProviderDefinedToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
|
|
1811
|
-
import { z as
|
|
1812
|
-
var codeInterpreterInputSchema =
|
|
1813
|
-
code:
|
|
1814
|
-
containerId:
|
|
1692
|
+
import { z as z9 } from "zod/v4";
|
|
1693
|
+
var codeInterpreterInputSchema = z9.object({
|
|
1694
|
+
code: z9.string().nullish(),
|
|
1695
|
+
containerId: z9.string()
|
|
1815
1696
|
});
|
|
1816
|
-
var codeInterpreterOutputSchema =
|
|
1817
|
-
outputs:
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1697
|
+
var codeInterpreterOutputSchema = z9.object({
|
|
1698
|
+
outputs: z9.array(
|
|
1699
|
+
z9.discriminatedUnion("type", [
|
|
1700
|
+
z9.object({ type: z9.literal("logs"), logs: z9.string() }),
|
|
1701
|
+
z9.object({ type: z9.literal("image"), url: z9.string() })
|
|
1821
1702
|
])
|
|
1822
1703
|
).nullish()
|
|
1823
1704
|
});
|
|
1824
|
-
var codeInterpreterArgsSchema =
|
|
1825
|
-
container:
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
fileIds:
|
|
1705
|
+
var codeInterpreterArgsSchema = z9.object({
|
|
1706
|
+
container: z9.union([
|
|
1707
|
+
z9.string(),
|
|
1708
|
+
z9.object({
|
|
1709
|
+
fileIds: z9.array(z9.string()).optional()
|
|
1829
1710
|
})
|
|
1830
1711
|
]).optional()
|
|
1831
1712
|
});
|
|
@@ -1839,8 +1720,80 @@ var codeInterpreter = (args = {}) => {
|
|
|
1839
1720
|
return codeInterpreterToolFactory(args);
|
|
1840
1721
|
};
|
|
1841
1722
|
|
|
1723
|
+
// src/tool/file-search.ts
|
|
1724
|
+
import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2 } from "@ai-sdk/provider-utils";
|
|
1725
|
+
import { z as z10 } from "zod/v4";
|
|
1726
|
+
var comparisonFilterSchema = z10.object({
|
|
1727
|
+
key: z10.string(),
|
|
1728
|
+
type: z10.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
|
|
1729
|
+
value: z10.union([z10.string(), z10.number(), z10.boolean()])
|
|
1730
|
+
});
|
|
1731
|
+
var compoundFilterSchema = z10.object({
|
|
1732
|
+
type: z10.enum(["and", "or"]),
|
|
1733
|
+
filters: z10.array(
|
|
1734
|
+
z10.union([comparisonFilterSchema, z10.lazy(() => compoundFilterSchema)])
|
|
1735
|
+
)
|
|
1736
|
+
});
|
|
1737
|
+
var fileSearchArgsSchema = z10.object({
|
|
1738
|
+
vectorStoreIds: z10.array(z10.string()),
|
|
1739
|
+
maxNumResults: z10.number().optional(),
|
|
1740
|
+
ranking: z10.object({
|
|
1741
|
+
ranker: z10.string().optional(),
|
|
1742
|
+
scoreThreshold: z10.number().optional()
|
|
1743
|
+
}).optional(),
|
|
1744
|
+
filters: z10.union([comparisonFilterSchema, compoundFilterSchema]).optional()
|
|
1745
|
+
});
|
|
1746
|
+
var fileSearchOutputSchema = z10.object({
|
|
1747
|
+
queries: z10.array(z10.string()),
|
|
1748
|
+
results: z10.array(
|
|
1749
|
+
z10.object({
|
|
1750
|
+
attributes: z10.record(z10.string(), z10.unknown()),
|
|
1751
|
+
fileId: z10.string(),
|
|
1752
|
+
filename: z10.string(),
|
|
1753
|
+
score: z10.number(),
|
|
1754
|
+
text: z10.string()
|
|
1755
|
+
})
|
|
1756
|
+
).nullable()
|
|
1757
|
+
});
|
|
1758
|
+
var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
|
|
1759
|
+
id: "openai.file_search",
|
|
1760
|
+
name: "file_search",
|
|
1761
|
+
inputSchema: z10.object({}),
|
|
1762
|
+
outputSchema: fileSearchOutputSchema
|
|
1763
|
+
});
|
|
1764
|
+
|
|
1765
|
+
// src/tool/image-generation.ts
|
|
1766
|
+
import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema3 } from "@ai-sdk/provider-utils";
|
|
1767
|
+
import { z as z11 } from "zod/v4";
|
|
1768
|
+
var imageGenerationArgsSchema = z11.object({
|
|
1769
|
+
background: z11.enum(["auto", "opaque", "transparent"]).optional(),
|
|
1770
|
+
inputFidelity: z11.enum(["low", "high"]).optional(),
|
|
1771
|
+
inputImageMask: z11.object({
|
|
1772
|
+
fileId: z11.string().optional(),
|
|
1773
|
+
imageUrl: z11.string().optional()
|
|
1774
|
+
}).optional(),
|
|
1775
|
+
model: z11.string().optional(),
|
|
1776
|
+
moderation: z11.enum(["auto"]).optional(),
|
|
1777
|
+
outputCompression: z11.number().int().min(0).max(100).optional(),
|
|
1778
|
+
outputFormat: z11.enum(["png", "jpeg", "webp"]).optional(),
|
|
1779
|
+
quality: z11.enum(["auto", "low", "medium", "high"]).optional(),
|
|
1780
|
+
size: z11.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
1781
|
+
}).strict();
|
|
1782
|
+
var imageGenerationOutputSchema = z11.object({
|
|
1783
|
+
result: z11.string()
|
|
1784
|
+
});
|
|
1785
|
+
var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
|
|
1786
|
+
id: "openai.image_generation",
|
|
1787
|
+
name: "image_generation",
|
|
1788
|
+
inputSchema: z11.object({}),
|
|
1789
|
+
outputSchema: imageGenerationOutputSchema
|
|
1790
|
+
});
|
|
1791
|
+
var imageGeneration = (args = {}) => {
|
|
1792
|
+
return imageGenerationToolFactory(args);
|
|
1793
|
+
};
|
|
1794
|
+
|
|
1842
1795
|
// src/tool/web-search.ts
|
|
1843
|
-
import { createProviderDefinedToolFactory
|
|
1796
|
+
import { createProviderDefinedToolFactory } from "@ai-sdk/provider-utils";
|
|
1844
1797
|
import { z as z12 } from "zod/v4";
|
|
1845
1798
|
var webSearchArgsSchema = z12.object({
|
|
1846
1799
|
filters: z12.object({
|
|
@@ -1855,7 +1808,7 @@ var webSearchArgsSchema = z12.object({
|
|
|
1855
1808
|
timezone: z12.string().optional()
|
|
1856
1809
|
}).optional()
|
|
1857
1810
|
});
|
|
1858
|
-
var webSearchToolFactory =
|
|
1811
|
+
var webSearchToolFactory = createProviderDefinedToolFactory({
|
|
1859
1812
|
id: "openai.web_search",
|
|
1860
1813
|
name: "web_search",
|
|
1861
1814
|
inputSchema: z12.object({
|
|
@@ -1880,6 +1833,65 @@ var webSearch = (args = {}) => {
|
|
|
1880
1833
|
return webSearchToolFactory(args);
|
|
1881
1834
|
};
|
|
1882
1835
|
|
|
1836
|
+
// src/tool/web-search-preview.ts
|
|
1837
|
+
import { createProviderDefinedToolFactory as createProviderDefinedToolFactory2 } from "@ai-sdk/provider-utils";
|
|
1838
|
+
import { z as z13 } from "zod/v4";
|
|
1839
|
+
var webSearchPreviewArgsSchema = z13.object({
|
|
1840
|
+
/**
|
|
1841
|
+
* Search context size to use for the web search.
|
|
1842
|
+
* - high: Most comprehensive context, highest cost, slower response
|
|
1843
|
+
* - medium: Balanced context, cost, and latency (default)
|
|
1844
|
+
* - low: Least context, lowest cost, fastest response
|
|
1845
|
+
*/
|
|
1846
|
+
searchContextSize: z13.enum(["low", "medium", "high"]).optional(),
|
|
1847
|
+
/**
|
|
1848
|
+
* User location information to provide geographically relevant search results.
|
|
1849
|
+
*/
|
|
1850
|
+
userLocation: z13.object({
|
|
1851
|
+
/**
|
|
1852
|
+
* Type of location (always 'approximate')
|
|
1853
|
+
*/
|
|
1854
|
+
type: z13.literal("approximate"),
|
|
1855
|
+
/**
|
|
1856
|
+
* Two-letter ISO country code (e.g., 'US', 'GB')
|
|
1857
|
+
*/
|
|
1858
|
+
country: z13.string().optional(),
|
|
1859
|
+
/**
|
|
1860
|
+
* City name (free text, e.g., 'Minneapolis')
|
|
1861
|
+
*/
|
|
1862
|
+
city: z13.string().optional(),
|
|
1863
|
+
/**
|
|
1864
|
+
* Region name (free text, e.g., 'Minnesota')
|
|
1865
|
+
*/
|
|
1866
|
+
region: z13.string().optional(),
|
|
1867
|
+
/**
|
|
1868
|
+
* IANA timezone (e.g., 'America/Chicago')
|
|
1869
|
+
*/
|
|
1870
|
+
timezone: z13.string().optional()
|
|
1871
|
+
}).optional()
|
|
1872
|
+
});
|
|
1873
|
+
var webSearchPreview = createProviderDefinedToolFactory2({
|
|
1874
|
+
id: "openai.web_search_preview",
|
|
1875
|
+
name: "web_search_preview",
|
|
1876
|
+
inputSchema: z13.object({
|
|
1877
|
+
action: z13.discriminatedUnion("type", [
|
|
1878
|
+
z13.object({
|
|
1879
|
+
type: z13.literal("search"),
|
|
1880
|
+
query: z13.string().nullish()
|
|
1881
|
+
}),
|
|
1882
|
+
z13.object({
|
|
1883
|
+
type: z13.literal("open_page"),
|
|
1884
|
+
url: z13.string()
|
|
1885
|
+
}),
|
|
1886
|
+
z13.object({
|
|
1887
|
+
type: z13.literal("find"),
|
|
1888
|
+
url: z13.string(),
|
|
1889
|
+
pattern: z13.string()
|
|
1890
|
+
})
|
|
1891
|
+
]).nullish()
|
|
1892
|
+
})
|
|
1893
|
+
});
|
|
1894
|
+
|
|
1883
1895
|
// src/openai-tools.ts
|
|
1884
1896
|
var openaiTools = {
|
|
1885
1897
|
/**
|
|
@@ -1905,6 +1917,20 @@ var openaiTools = {
|
|
|
1905
1917
|
* @param filters - The filters to use for the file search.
|
|
1906
1918
|
*/
|
|
1907
1919
|
fileSearch,
|
|
1920
|
+
/**
|
|
1921
|
+
* The image generation tool allows you to generate images using a text prompt,
|
|
1922
|
+
* and optionally image inputs. It leverages the GPT Image model,
|
|
1923
|
+
* and automatically optimizes text inputs for improved performance.
|
|
1924
|
+
*
|
|
1925
|
+
* Must have name `image_generation`.
|
|
1926
|
+
*
|
|
1927
|
+
* @param size - Image dimensions (e.g., 1024x1024, 1024x1536)
|
|
1928
|
+
* @param quality - Rendering quality (e.g. low, medium, high)
|
|
1929
|
+
* @param format - File output format
|
|
1930
|
+
* @param compression - Compression level (0-100%) for JPEG and WebP formats
|
|
1931
|
+
* @param background - Transparent or opaque
|
|
1932
|
+
*/
|
|
1933
|
+
imageGeneration,
|
|
1908
1934
|
/**
|
|
1909
1935
|
* Web search allows models to access up-to-date information from the internet
|
|
1910
1936
|
* and provide answers with sourced citations.
|
|
@@ -1942,14 +1968,14 @@ import {
|
|
|
1942
1968
|
parseProviderOptions as parseProviderOptions5,
|
|
1943
1969
|
postJsonToApi as postJsonToApi5
|
|
1944
1970
|
} from "@ai-sdk/provider-utils";
|
|
1945
|
-
import { z as
|
|
1971
|
+
import { z as z15 } from "zod/v4";
|
|
1946
1972
|
|
|
1947
1973
|
// src/responses/convert-to-openai-responses-input.ts
|
|
1948
1974
|
import {
|
|
1949
1975
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError4
|
|
1950
1976
|
} from "@ai-sdk/provider";
|
|
1951
1977
|
import { convertToBase64 as convertToBase642, parseProviderOptions as parseProviderOptions4 } from "@ai-sdk/provider-utils";
|
|
1952
|
-
import { z as
|
|
1978
|
+
import { z as z14 } from "zod/v4";
|
|
1953
1979
|
function isFileId(data, prefixes) {
|
|
1954
1980
|
if (!prefixes) return false;
|
|
1955
1981
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -1957,7 +1983,8 @@ function isFileId(data, prefixes) {
|
|
|
1957
1983
|
async function convertToOpenAIResponsesInput({
|
|
1958
1984
|
prompt,
|
|
1959
1985
|
systemMessageMode,
|
|
1960
|
-
fileIdPrefixes
|
|
1986
|
+
fileIdPrefixes,
|
|
1987
|
+
store
|
|
1961
1988
|
}) {
|
|
1962
1989
|
var _a, _b, _c, _d, _e, _f;
|
|
1963
1990
|
const input = [];
|
|
@@ -2062,10 +2089,14 @@ async function convertToOpenAIResponsesInput({
|
|
|
2062
2089
|
break;
|
|
2063
2090
|
}
|
|
2064
2091
|
case "tool-result": {
|
|
2065
|
-
|
|
2066
|
-
type: "
|
|
2067
|
-
|
|
2068
|
-
|
|
2092
|
+
if (store) {
|
|
2093
|
+
input.push({ type: "item_reference", id: part.toolCallId });
|
|
2094
|
+
} else {
|
|
2095
|
+
warnings.push({
|
|
2096
|
+
type: "other",
|
|
2097
|
+
message: `Results for OpenAI tool ${part.toolName} are not sent to the API when store is false`
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2069
2100
|
break;
|
|
2070
2101
|
}
|
|
2071
2102
|
case "reasoning": {
|
|
@@ -2140,9 +2171,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2140
2171
|
}
|
|
2141
2172
|
return { input, warnings };
|
|
2142
2173
|
}
|
|
2143
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2144
|
-
itemId:
|
|
2145
|
-
reasoningEncryptedContent:
|
|
2174
|
+
var openaiResponsesReasoningProviderOptionsSchema = z14.object({
|
|
2175
|
+
itemId: z14.string().nullish(),
|
|
2176
|
+
reasoningEncryptedContent: z14.string().nullish()
|
|
2146
2177
|
});
|
|
2147
2178
|
|
|
2148
2179
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2197,7 +2228,10 @@ function prepareResponsesTools({
|
|
|
2197
2228
|
type: "file_search",
|
|
2198
2229
|
vector_store_ids: args.vectorStoreIds,
|
|
2199
2230
|
max_num_results: args.maxNumResults,
|
|
2200
|
-
ranking_options: args.ranking ? {
|
|
2231
|
+
ranking_options: args.ranking ? {
|
|
2232
|
+
ranker: args.ranking.ranker,
|
|
2233
|
+
score_threshold: args.ranking.scoreThreshold
|
|
2234
|
+
} : void 0,
|
|
2201
2235
|
filters: args.filters
|
|
2202
2236
|
});
|
|
2203
2237
|
break;
|
|
@@ -2229,8 +2263,23 @@ function prepareResponsesTools({
|
|
|
2229
2263
|
});
|
|
2230
2264
|
break;
|
|
2231
2265
|
}
|
|
2232
|
-
|
|
2233
|
-
|
|
2266
|
+
case "openai.image_generation": {
|
|
2267
|
+
const args = imageGenerationArgsSchema.parse(tool.args);
|
|
2268
|
+
openaiTools2.push({
|
|
2269
|
+
type: "image_generation",
|
|
2270
|
+
background: args.background,
|
|
2271
|
+
input_fidelity: args.inputFidelity,
|
|
2272
|
+
input_image_mask: args.inputImageMask ? {
|
|
2273
|
+
file_id: args.inputImageMask.fileId,
|
|
2274
|
+
image_url: args.inputImageMask.imageUrl
|
|
2275
|
+
} : void 0,
|
|
2276
|
+
model: args.model,
|
|
2277
|
+
size: args.size,
|
|
2278
|
+
quality: args.quality,
|
|
2279
|
+
moderation: args.moderation,
|
|
2280
|
+
output_format: args.outputFormat,
|
|
2281
|
+
output_compression: args.outputCompression
|
|
2282
|
+
});
|
|
2234
2283
|
break;
|
|
2235
2284
|
}
|
|
2236
2285
|
}
|
|
@@ -2253,7 +2302,7 @@ function prepareResponsesTools({
|
|
|
2253
2302
|
case "tool":
|
|
2254
2303
|
return {
|
|
2255
2304
|
tools: openaiTools2,
|
|
2256
|
-
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
2305
|
+
toolChoice: toolChoice.toolName === "code_interpreter" || toolChoice.toolName === "file_search" || toolChoice.toolName === "image_generation" || toolChoice.toolName === "web_search_preview" || toolChoice.toolName === "web_search" ? { type: toolChoice.toolName } : { type: "function", name: toolChoice.toolName },
|
|
2257
2306
|
toolWarnings
|
|
2258
2307
|
};
|
|
2259
2308
|
default: {
|
|
@@ -2266,47 +2315,66 @@ function prepareResponsesTools({
|
|
|
2266
2315
|
}
|
|
2267
2316
|
|
|
2268
2317
|
// src/responses/openai-responses-language-model.ts
|
|
2269
|
-
var webSearchCallItem =
|
|
2270
|
-
type:
|
|
2271
|
-
id:
|
|
2272
|
-
status:
|
|
2273
|
-
action:
|
|
2274
|
-
|
|
2275
|
-
type:
|
|
2276
|
-
query:
|
|
2318
|
+
var webSearchCallItem = z15.object({
|
|
2319
|
+
type: z15.literal("web_search_call"),
|
|
2320
|
+
id: z15.string(),
|
|
2321
|
+
status: z15.string(),
|
|
2322
|
+
action: z15.discriminatedUnion("type", [
|
|
2323
|
+
z15.object({
|
|
2324
|
+
type: z15.literal("search"),
|
|
2325
|
+
query: z15.string().nullish()
|
|
2277
2326
|
}),
|
|
2278
|
-
|
|
2279
|
-
type:
|
|
2280
|
-
url:
|
|
2327
|
+
z15.object({
|
|
2328
|
+
type: z15.literal("open_page"),
|
|
2329
|
+
url: z15.string()
|
|
2281
2330
|
}),
|
|
2282
|
-
|
|
2283
|
-
type:
|
|
2284
|
-
url:
|
|
2285
|
-
pattern:
|
|
2331
|
+
z15.object({
|
|
2332
|
+
type: z15.literal("find"),
|
|
2333
|
+
url: z15.string(),
|
|
2334
|
+
pattern: z15.string()
|
|
2286
2335
|
})
|
|
2287
2336
|
]).nullish()
|
|
2288
2337
|
});
|
|
2289
|
-
var
|
|
2290
|
-
type:
|
|
2291
|
-
id:
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2338
|
+
var fileSearchCallItem = z15.object({
|
|
2339
|
+
type: z15.literal("file_search_call"),
|
|
2340
|
+
id: z15.string(),
|
|
2341
|
+
queries: z15.array(z15.string()),
|
|
2342
|
+
results: z15.array(
|
|
2343
|
+
z15.object({
|
|
2344
|
+
attributes: z15.record(z15.string(), z15.unknown()),
|
|
2345
|
+
file_id: z15.string(),
|
|
2346
|
+
filename: z15.string(),
|
|
2347
|
+
score: z15.number(),
|
|
2348
|
+
text: z15.string()
|
|
2349
|
+
})
|
|
2350
|
+
).nullish()
|
|
2351
|
+
});
|
|
2352
|
+
var codeInterpreterCallItem = z15.object({
|
|
2353
|
+
type: z15.literal("code_interpreter_call"),
|
|
2354
|
+
id: z15.string(),
|
|
2355
|
+
code: z15.string().nullable(),
|
|
2356
|
+
container_id: z15.string(),
|
|
2357
|
+
outputs: z15.array(
|
|
2358
|
+
z15.discriminatedUnion("type", [
|
|
2359
|
+
z15.object({ type: z15.literal("logs"), logs: z15.string() }),
|
|
2360
|
+
z15.object({ type: z15.literal("image"), url: z15.string() })
|
|
2298
2361
|
])
|
|
2299
2362
|
).nullable()
|
|
2300
2363
|
});
|
|
2364
|
+
var imageGenerationCallItem = z15.object({
|
|
2365
|
+
type: z15.literal("image_generation_call"),
|
|
2366
|
+
id: z15.string(),
|
|
2367
|
+
result: z15.string()
|
|
2368
|
+
});
|
|
2301
2369
|
var TOP_LOGPROBS_MAX = 20;
|
|
2302
|
-
var LOGPROBS_SCHEMA =
|
|
2303
|
-
|
|
2304
|
-
token:
|
|
2305
|
-
logprob:
|
|
2306
|
-
top_logprobs:
|
|
2307
|
-
|
|
2308
|
-
token:
|
|
2309
|
-
logprob:
|
|
2370
|
+
var LOGPROBS_SCHEMA = z15.array(
|
|
2371
|
+
z15.object({
|
|
2372
|
+
token: z15.string(),
|
|
2373
|
+
logprob: z15.number(),
|
|
2374
|
+
top_logprobs: z15.array(
|
|
2375
|
+
z15.object({
|
|
2376
|
+
token: z15.string(),
|
|
2377
|
+
logprob: z15.number()
|
|
2310
2378
|
})
|
|
2311
2379
|
)
|
|
2312
2380
|
})
|
|
@@ -2363,29 +2431,41 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2363
2431
|
if (stopSequences != null) {
|
|
2364
2432
|
warnings.push({ type: "unsupported-setting", setting: "stopSequences" });
|
|
2365
2433
|
}
|
|
2366
|
-
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
2367
|
-
prompt,
|
|
2368
|
-
systemMessageMode: modelConfig.systemMessageMode,
|
|
2369
|
-
fileIdPrefixes: this.config.fileIdPrefixes
|
|
2370
|
-
});
|
|
2371
|
-
warnings.push(...inputWarnings);
|
|
2372
2434
|
const openaiOptions = await parseProviderOptions5({
|
|
2373
2435
|
provider: "openai",
|
|
2374
2436
|
providerOptions,
|
|
2375
2437
|
schema: openaiResponsesProviderOptionsSchema
|
|
2376
2438
|
});
|
|
2377
|
-
const
|
|
2439
|
+
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
2440
|
+
prompt,
|
|
2441
|
+
systemMessageMode: modelConfig.systemMessageMode,
|
|
2442
|
+
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
2443
|
+
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true
|
|
2444
|
+
});
|
|
2445
|
+
warnings.push(...inputWarnings);
|
|
2446
|
+
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
2378
2447
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
2448
|
+
function addInclude(key) {
|
|
2449
|
+
include = include != null ? [...include, key] : [key];
|
|
2450
|
+
}
|
|
2451
|
+
function hasOpenAITool(id) {
|
|
2452
|
+
return (tools == null ? void 0 : tools.find(
|
|
2453
|
+
(tool) => tool.type === "provider-defined" && tool.id === id
|
|
2454
|
+
)) != null;
|
|
2455
|
+
}
|
|
2379
2456
|
const topLogprobs = typeof (openaiOptions == null ? void 0 : openaiOptions.logprobs) === "number" ? openaiOptions == null ? void 0 : openaiOptions.logprobs : (openaiOptions == null ? void 0 : openaiOptions.logprobs) === true ? TOP_LOGPROBS_MAX : void 0;
|
|
2380
|
-
|
|
2381
|
-
|
|
2457
|
+
if (topLogprobs) {
|
|
2458
|
+
addInclude("message.output_text.logprobs");
|
|
2459
|
+
}
|
|
2460
|
+
const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
|
|
2382
2461
|
(tool) => tool.type === "provider-defined" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
2383
|
-
)) == null ? void 0 : _b.name;
|
|
2384
|
-
include = webSearchToolName ? Array.isArray(include) ? [...include, "web_search_call.action.sources"] : ["web_search_call.action.sources"] : include;
|
|
2385
|
-
const codeInterpreterToolName = (_c = tools == null ? void 0 : tools.find(
|
|
2386
|
-
(tool) => tool.type === "provider-defined" && tool.id === "openai.code_interpreter"
|
|
2387
2462
|
)) == null ? void 0 : _c.name;
|
|
2388
|
-
|
|
2463
|
+
if (webSearchToolName) {
|
|
2464
|
+
addInclude("web_search_call.action.sources");
|
|
2465
|
+
}
|
|
2466
|
+
if (hasOpenAITool("openai.code_interpreter")) {
|
|
2467
|
+
addInclude("code_interpreter_call.outputs");
|
|
2468
|
+
}
|
|
2389
2469
|
const baseArgs = {
|
|
2390
2470
|
model: this.modelId,
|
|
2391
2471
|
input,
|
|
@@ -2409,6 +2489,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2409
2489
|
}
|
|
2410
2490
|
},
|
|
2411
2491
|
// provider options:
|
|
2492
|
+
max_tool_calls: openaiOptions == null ? void 0 : openaiOptions.maxToolCalls,
|
|
2412
2493
|
metadata: openaiOptions == null ? void 0 : openaiOptions.metadata,
|
|
2413
2494
|
parallel_tool_calls: openaiOptions == null ? void 0 : openaiOptions.parallelToolCalls,
|
|
2414
2495
|
previous_response_id: openaiOptions == null ? void 0 : openaiOptions.previousResponseId,
|
|
@@ -2504,7 +2585,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2504
2585
|
};
|
|
2505
2586
|
}
|
|
2506
2587
|
async doGenerate(options) {
|
|
2507
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2588
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
2508
2589
|
const {
|
|
2509
2590
|
args: body,
|
|
2510
2591
|
warnings,
|
|
@@ -2524,96 +2605,82 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2524
2605
|
body,
|
|
2525
2606
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
2526
2607
|
successfulResponseHandler: createJsonResponseHandler5(
|
|
2527
|
-
|
|
2528
|
-
id:
|
|
2529
|
-
created_at:
|
|
2530
|
-
error:
|
|
2531
|
-
code:
|
|
2532
|
-
message:
|
|
2608
|
+
z15.object({
|
|
2609
|
+
id: z15.string(),
|
|
2610
|
+
created_at: z15.number(),
|
|
2611
|
+
error: z15.object({
|
|
2612
|
+
code: z15.string(),
|
|
2613
|
+
message: z15.string()
|
|
2533
2614
|
}).nullish(),
|
|
2534
|
-
model:
|
|
2535
|
-
output:
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
type:
|
|
2539
|
-
role:
|
|
2540
|
-
id:
|
|
2541
|
-
content:
|
|
2542
|
-
|
|
2543
|
-
type:
|
|
2544
|
-
text:
|
|
2615
|
+
model: z15.string(),
|
|
2616
|
+
output: z15.array(
|
|
2617
|
+
z15.discriminatedUnion("type", [
|
|
2618
|
+
z15.object({
|
|
2619
|
+
type: z15.literal("message"),
|
|
2620
|
+
role: z15.literal("assistant"),
|
|
2621
|
+
id: z15.string(),
|
|
2622
|
+
content: z15.array(
|
|
2623
|
+
z15.object({
|
|
2624
|
+
type: z15.literal("output_text"),
|
|
2625
|
+
text: z15.string(),
|
|
2545
2626
|
logprobs: LOGPROBS_SCHEMA.nullish(),
|
|
2546
|
-
annotations:
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
type:
|
|
2550
|
-
start_index:
|
|
2551
|
-
end_index:
|
|
2552
|
-
url:
|
|
2553
|
-
title:
|
|
2627
|
+
annotations: z15.array(
|
|
2628
|
+
z15.discriminatedUnion("type", [
|
|
2629
|
+
z15.object({
|
|
2630
|
+
type: z15.literal("url_citation"),
|
|
2631
|
+
start_index: z15.number(),
|
|
2632
|
+
end_index: z15.number(),
|
|
2633
|
+
url: z15.string(),
|
|
2634
|
+
title: z15.string()
|
|
2554
2635
|
}),
|
|
2555
|
-
|
|
2556
|
-
type:
|
|
2557
|
-
file_id:
|
|
2558
|
-
filename:
|
|
2559
|
-
index:
|
|
2560
|
-
start_index:
|
|
2561
|
-
end_index:
|
|
2562
|
-
quote:
|
|
2636
|
+
z15.object({
|
|
2637
|
+
type: z15.literal("file_citation"),
|
|
2638
|
+
file_id: z15.string(),
|
|
2639
|
+
filename: z15.string().nullish(),
|
|
2640
|
+
index: z15.number().nullish(),
|
|
2641
|
+
start_index: z15.number().nullish(),
|
|
2642
|
+
end_index: z15.number().nullish(),
|
|
2643
|
+
quote: z15.string().nullish()
|
|
2563
2644
|
}),
|
|
2564
|
-
|
|
2565
|
-
type:
|
|
2645
|
+
z15.object({
|
|
2646
|
+
type: z15.literal("container_file_citation")
|
|
2566
2647
|
})
|
|
2567
2648
|
])
|
|
2568
2649
|
)
|
|
2569
2650
|
})
|
|
2570
2651
|
)
|
|
2571
2652
|
}),
|
|
2572
|
-
codeInterpreterCallItem,
|
|
2573
|
-
z14.object({
|
|
2574
|
-
type: z14.literal("function_call"),
|
|
2575
|
-
call_id: z14.string(),
|
|
2576
|
-
name: z14.string(),
|
|
2577
|
-
arguments: z14.string(),
|
|
2578
|
-
id: z14.string()
|
|
2579
|
-
}),
|
|
2580
2653
|
webSearchCallItem,
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2654
|
+
fileSearchCallItem,
|
|
2655
|
+
codeInterpreterCallItem,
|
|
2656
|
+
imageGenerationCallItem,
|
|
2657
|
+
z15.object({
|
|
2658
|
+
type: z15.literal("function_call"),
|
|
2659
|
+
call_id: z15.string(),
|
|
2660
|
+
name: z15.string(),
|
|
2661
|
+
arguments: z15.string(),
|
|
2662
|
+
id: z15.string()
|
|
2585
2663
|
}),
|
|
2586
|
-
|
|
2587
|
-
type:
|
|
2588
|
-
id:
|
|
2589
|
-
status:
|
|
2590
|
-
queries: z14.array(z14.string()).nullish(),
|
|
2591
|
-
results: z14.array(
|
|
2592
|
-
z14.object({
|
|
2593
|
-
attributes: z14.object({
|
|
2594
|
-
file_id: z14.string(),
|
|
2595
|
-
filename: z14.string(),
|
|
2596
|
-
score: z14.number(),
|
|
2597
|
-
text: z14.string()
|
|
2598
|
-
})
|
|
2599
|
-
})
|
|
2600
|
-
).nullish()
|
|
2664
|
+
z15.object({
|
|
2665
|
+
type: z15.literal("computer_call"),
|
|
2666
|
+
id: z15.string(),
|
|
2667
|
+
status: z15.string().optional()
|
|
2601
2668
|
}),
|
|
2602
|
-
|
|
2603
|
-
type:
|
|
2604
|
-
id:
|
|
2605
|
-
encrypted_content:
|
|
2606
|
-
summary:
|
|
2607
|
-
|
|
2608
|
-
type:
|
|
2609
|
-
text:
|
|
2669
|
+
z15.object({
|
|
2670
|
+
type: z15.literal("reasoning"),
|
|
2671
|
+
id: z15.string(),
|
|
2672
|
+
encrypted_content: z15.string().nullish(),
|
|
2673
|
+
summary: z15.array(
|
|
2674
|
+
z15.object({
|
|
2675
|
+
type: z15.literal("summary_text"),
|
|
2676
|
+
text: z15.string()
|
|
2610
2677
|
})
|
|
2611
2678
|
)
|
|
2612
2679
|
})
|
|
2613
2680
|
])
|
|
2614
2681
|
),
|
|
2615
|
-
service_tier:
|
|
2616
|
-
incomplete_details:
|
|
2682
|
+
service_tier: z15.string().nullish(),
|
|
2683
|
+
incomplete_details: z15.object({ reason: z15.string() }).nullable(),
|
|
2617
2684
|
usage: usageSchema2
|
|
2618
2685
|
})
|
|
2619
2686
|
),
|
|
@@ -2654,6 +2721,25 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2654
2721
|
}
|
|
2655
2722
|
break;
|
|
2656
2723
|
}
|
|
2724
|
+
case "image_generation_call": {
|
|
2725
|
+
content.push({
|
|
2726
|
+
type: "tool-call",
|
|
2727
|
+
toolCallId: part.id,
|
|
2728
|
+
toolName: "image_generation",
|
|
2729
|
+
input: "{}",
|
|
2730
|
+
providerExecuted: true
|
|
2731
|
+
});
|
|
2732
|
+
content.push({
|
|
2733
|
+
type: "tool-result",
|
|
2734
|
+
toolCallId: part.id,
|
|
2735
|
+
toolName: "image_generation",
|
|
2736
|
+
result: {
|
|
2737
|
+
result: part.result
|
|
2738
|
+
},
|
|
2739
|
+
providerExecuted: true
|
|
2740
|
+
});
|
|
2741
|
+
break;
|
|
2742
|
+
}
|
|
2657
2743
|
case "message": {
|
|
2658
2744
|
for (const contentPart of part.content) {
|
|
2659
2745
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b.openai) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -2748,7 +2834,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2748
2834
|
type: "tool-call",
|
|
2749
2835
|
toolCallId: part.id,
|
|
2750
2836
|
toolName: "file_search",
|
|
2751
|
-
input: "",
|
|
2837
|
+
input: "{}",
|
|
2752
2838
|
providerExecuted: true
|
|
2753
2839
|
});
|
|
2754
2840
|
content.push({
|
|
@@ -2756,10 +2842,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2756
2842
|
toolCallId: part.id,
|
|
2757
2843
|
toolName: "file_search",
|
|
2758
2844
|
result: {
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2845
|
+
queries: part.queries,
|
|
2846
|
+
results: (_n = (_m = part.results) == null ? void 0 : _m.map((result) => ({
|
|
2847
|
+
attributes: result.attributes,
|
|
2848
|
+
fileId: result.file_id,
|
|
2849
|
+
filename: result.filename,
|
|
2850
|
+
score: result.score,
|
|
2851
|
+
text: result.text
|
|
2852
|
+
}))) != null ? _n : null
|
|
2763
2853
|
},
|
|
2764
2854
|
providerExecuted: true
|
|
2765
2855
|
});
|
|
@@ -2801,15 +2891,15 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2801
2891
|
return {
|
|
2802
2892
|
content,
|
|
2803
2893
|
finishReason: mapOpenAIResponseFinishReason({
|
|
2804
|
-
finishReason: (
|
|
2894
|
+
finishReason: (_o = response.incomplete_details) == null ? void 0 : _o.reason,
|
|
2805
2895
|
hasFunctionCall
|
|
2806
2896
|
}),
|
|
2807
2897
|
usage: {
|
|
2808
2898
|
inputTokens: response.usage.input_tokens,
|
|
2809
2899
|
outputTokens: response.usage.output_tokens,
|
|
2810
2900
|
totalTokens: response.usage.input_tokens + response.usage.output_tokens,
|
|
2811
|
-
reasoningTokens: (
|
|
2812
|
-
cachedInputTokens: (
|
|
2901
|
+
reasoningTokens: (_q = (_p = response.usage.output_tokens_details) == null ? void 0 : _p.reasoning_tokens) != null ? _q : void 0,
|
|
2902
|
+
cachedInputTokens: (_s = (_r = response.usage.input_tokens_details) == null ? void 0 : _r.cached_tokens) != null ? _s : void 0
|
|
2813
2903
|
},
|
|
2814
2904
|
request: { body },
|
|
2815
2905
|
response: {
|
|
@@ -2866,7 +2956,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2866
2956
|
controller.enqueue({ type: "stream-start", warnings });
|
|
2867
2957
|
},
|
|
2868
2958
|
transform(chunk, controller) {
|
|
2869
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
2959
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
2870
2960
|
if (options.includeRawChunks) {
|
|
2871
2961
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
2872
2962
|
}
|
|
@@ -2908,14 +2998,20 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2908
2998
|
toolName: "computer_use"
|
|
2909
2999
|
});
|
|
2910
3000
|
} else if (value.item.type === "file_search_call") {
|
|
2911
|
-
|
|
3001
|
+
controller.enqueue({
|
|
3002
|
+
type: "tool-call",
|
|
3003
|
+
toolCallId: value.item.id,
|
|
2912
3004
|
toolName: "file_search",
|
|
2913
|
-
|
|
2914
|
-
|
|
3005
|
+
input: "{}",
|
|
3006
|
+
providerExecuted: true
|
|
3007
|
+
});
|
|
3008
|
+
} else if (value.item.type === "image_generation_call") {
|
|
2915
3009
|
controller.enqueue({
|
|
2916
|
-
type: "tool-
|
|
2917
|
-
|
|
2918
|
-
toolName: "
|
|
3010
|
+
type: "tool-call",
|
|
3011
|
+
toolCallId: value.item.id,
|
|
3012
|
+
toolName: "image_generation",
|
|
3013
|
+
input: "{}",
|
|
3014
|
+
providerExecuted: true
|
|
2919
3015
|
});
|
|
2920
3016
|
} else if (value.item.type === "message") {
|
|
2921
3017
|
controller.enqueue({
|
|
@@ -3007,26 +3103,19 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3007
3103
|
});
|
|
3008
3104
|
} else if (value.item.type === "file_search_call") {
|
|
3009
3105
|
ongoingToolCalls[value.output_index] = void 0;
|
|
3010
|
-
controller.enqueue({
|
|
3011
|
-
type: "tool-input-end",
|
|
3012
|
-
id: value.item.id
|
|
3013
|
-
});
|
|
3014
|
-
controller.enqueue({
|
|
3015
|
-
type: "tool-call",
|
|
3016
|
-
toolCallId: value.item.id,
|
|
3017
|
-
toolName: "file_search",
|
|
3018
|
-
input: "",
|
|
3019
|
-
providerExecuted: true
|
|
3020
|
-
});
|
|
3021
3106
|
controller.enqueue({
|
|
3022
3107
|
type: "tool-result",
|
|
3023
3108
|
toolCallId: value.item.id,
|
|
3024
3109
|
toolName: "file_search",
|
|
3025
3110
|
result: {
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3111
|
+
queries: value.item.queries,
|
|
3112
|
+
results: (_c = (_b = value.item.results) == null ? void 0 : _b.map((result) => ({
|
|
3113
|
+
attributes: result.attributes,
|
|
3114
|
+
fileId: result.file_id,
|
|
3115
|
+
filename: result.filename,
|
|
3116
|
+
score: result.score,
|
|
3117
|
+
text: result.text
|
|
3118
|
+
}))) != null ? _c : null
|
|
3030
3119
|
},
|
|
3031
3120
|
providerExecuted: true
|
|
3032
3121
|
});
|
|
@@ -3050,6 +3139,16 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3050
3139
|
},
|
|
3051
3140
|
providerExecuted: true
|
|
3052
3141
|
});
|
|
3142
|
+
} else if (value.item.type === "image_generation_call") {
|
|
3143
|
+
controller.enqueue({
|
|
3144
|
+
type: "tool-result",
|
|
3145
|
+
toolCallId: value.item.id,
|
|
3146
|
+
toolName: "image_generation",
|
|
3147
|
+
result: {
|
|
3148
|
+
result: value.item.result
|
|
3149
|
+
},
|
|
3150
|
+
providerExecuted: true
|
|
3151
|
+
});
|
|
3053
3152
|
} else if (value.item.type === "message") {
|
|
3054
3153
|
controller.enqueue({
|
|
3055
3154
|
type: "text-end",
|
|
@@ -3064,7 +3163,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3064
3163
|
providerMetadata: {
|
|
3065
3164
|
openai: {
|
|
3066
3165
|
itemId: value.item.id,
|
|
3067
|
-
reasoningEncryptedContent: (
|
|
3166
|
+
reasoningEncryptedContent: (_d = value.item.encrypted_content) != null ? _d : null
|
|
3068
3167
|
}
|
|
3069
3168
|
}
|
|
3070
3169
|
});
|
|
@@ -3094,12 +3193,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3094
3193
|
id: value.item_id,
|
|
3095
3194
|
delta: value.delta
|
|
3096
3195
|
});
|
|
3097
|
-
if (((
|
|
3196
|
+
if (((_f = (_e = options.providerOptions) == null ? void 0 : _e.openai) == null ? void 0 : _f.logprobs) && value.logprobs) {
|
|
3098
3197
|
logprobs.push(value.logprobs);
|
|
3099
3198
|
}
|
|
3100
3199
|
} else if (isResponseReasoningSummaryPartAddedChunk(value)) {
|
|
3101
3200
|
if (value.summary_index > 0) {
|
|
3102
|
-
(
|
|
3201
|
+
(_g = activeReasoning[value.item_id]) == null ? void 0 : _g.summaryParts.push(
|
|
3103
3202
|
value.summary_index
|
|
3104
3203
|
);
|
|
3105
3204
|
controller.enqueue({
|
|
@@ -3108,7 +3207,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3108
3207
|
providerMetadata: {
|
|
3109
3208
|
openai: {
|
|
3110
3209
|
itemId: value.item_id,
|
|
3111
|
-
reasoningEncryptedContent: (
|
|
3210
|
+
reasoningEncryptedContent: (_i = (_h = activeReasoning[value.item_id]) == null ? void 0 : _h.encryptedContent) != null ? _i : null
|
|
3112
3211
|
}
|
|
3113
3212
|
}
|
|
3114
3213
|
});
|
|
@@ -3126,14 +3225,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3126
3225
|
});
|
|
3127
3226
|
} else if (isResponseFinishedChunk(value)) {
|
|
3128
3227
|
finishReason = mapOpenAIResponseFinishReason({
|
|
3129
|
-
finishReason: (
|
|
3228
|
+
finishReason: (_j = value.response.incomplete_details) == null ? void 0 : _j.reason,
|
|
3130
3229
|
hasFunctionCall
|
|
3131
3230
|
});
|
|
3132
3231
|
usage.inputTokens = value.response.usage.input_tokens;
|
|
3133
3232
|
usage.outputTokens = value.response.usage.output_tokens;
|
|
3134
3233
|
usage.totalTokens = value.response.usage.input_tokens + value.response.usage.output_tokens;
|
|
3135
|
-
usage.reasoningTokens = (
|
|
3136
|
-
usage.cachedInputTokens = (
|
|
3234
|
+
usage.reasoningTokens = (_l = (_k = value.response.usage.output_tokens_details) == null ? void 0 : _k.reasoning_tokens) != null ? _l : void 0;
|
|
3235
|
+
usage.cachedInputTokens = (_n = (_m = value.response.usage.input_tokens_details) == null ? void 0 : _m.cached_tokens) != null ? _n : void 0;
|
|
3137
3236
|
if (typeof value.response.service_tier === "string") {
|
|
3138
3237
|
serviceTier = value.response.service_tier;
|
|
3139
3238
|
}
|
|
@@ -3142,7 +3241,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3142
3241
|
controller.enqueue({
|
|
3143
3242
|
type: "source",
|
|
3144
3243
|
sourceType: "url",
|
|
3145
|
-
id: (
|
|
3244
|
+
id: (_q = (_p = (_o = self.config).generateId) == null ? void 0 : _p.call(_o)) != null ? _q : generateId2(),
|
|
3146
3245
|
url: value.annotation.url,
|
|
3147
3246
|
title: value.annotation.title
|
|
3148
3247
|
});
|
|
@@ -3150,10 +3249,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3150
3249
|
controller.enqueue({
|
|
3151
3250
|
type: "source",
|
|
3152
3251
|
sourceType: "document",
|
|
3153
|
-
id: (
|
|
3252
|
+
id: (_t = (_s = (_r = self.config).generateId) == null ? void 0 : _s.call(_r)) != null ? _t : generateId2(),
|
|
3154
3253
|
mediaType: "text/plain",
|
|
3155
|
-
title: (
|
|
3156
|
-
filename: (
|
|
3254
|
+
title: (_v = (_u = value.annotation.quote) != null ? _u : value.annotation.filename) != null ? _v : "Document",
|
|
3255
|
+
filename: (_w = value.annotation.filename) != null ? _w : value.annotation.file_id
|
|
3157
3256
|
});
|
|
3158
3257
|
}
|
|
3159
3258
|
} else if (isErrorChunk(value)) {
|
|
@@ -3186,177 +3285,155 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3186
3285
|
};
|
|
3187
3286
|
}
|
|
3188
3287
|
};
|
|
3189
|
-
var usageSchema2 =
|
|
3190
|
-
input_tokens:
|
|
3191
|
-
input_tokens_details:
|
|
3192
|
-
output_tokens:
|
|
3193
|
-
output_tokens_details:
|
|
3288
|
+
var usageSchema2 = z15.object({
|
|
3289
|
+
input_tokens: z15.number(),
|
|
3290
|
+
input_tokens_details: z15.object({ cached_tokens: z15.number().nullish() }).nullish(),
|
|
3291
|
+
output_tokens: z15.number(),
|
|
3292
|
+
output_tokens_details: z15.object({ reasoning_tokens: z15.number().nullish() }).nullish()
|
|
3194
3293
|
});
|
|
3195
|
-
var textDeltaChunkSchema =
|
|
3196
|
-
type:
|
|
3197
|
-
item_id:
|
|
3198
|
-
delta:
|
|
3294
|
+
var textDeltaChunkSchema = z15.object({
|
|
3295
|
+
type: z15.literal("response.output_text.delta"),
|
|
3296
|
+
item_id: z15.string(),
|
|
3297
|
+
delta: z15.string(),
|
|
3199
3298
|
logprobs: LOGPROBS_SCHEMA.nullish()
|
|
3200
3299
|
});
|
|
3201
|
-
var errorChunkSchema =
|
|
3202
|
-
type:
|
|
3203
|
-
code:
|
|
3204
|
-
message:
|
|
3205
|
-
param:
|
|
3206
|
-
sequence_number:
|
|
3300
|
+
var errorChunkSchema = z15.object({
|
|
3301
|
+
type: z15.literal("error"),
|
|
3302
|
+
code: z15.string(),
|
|
3303
|
+
message: z15.string(),
|
|
3304
|
+
param: z15.string().nullish(),
|
|
3305
|
+
sequence_number: z15.number()
|
|
3207
3306
|
});
|
|
3208
|
-
var responseFinishedChunkSchema =
|
|
3209
|
-
type:
|
|
3210
|
-
response:
|
|
3211
|
-
incomplete_details:
|
|
3307
|
+
var responseFinishedChunkSchema = z15.object({
|
|
3308
|
+
type: z15.enum(["response.completed", "response.incomplete"]),
|
|
3309
|
+
response: z15.object({
|
|
3310
|
+
incomplete_details: z15.object({ reason: z15.string() }).nullish(),
|
|
3212
3311
|
usage: usageSchema2,
|
|
3213
|
-
service_tier:
|
|
3312
|
+
service_tier: z15.string().nullish()
|
|
3214
3313
|
})
|
|
3215
3314
|
});
|
|
3216
|
-
var responseCreatedChunkSchema =
|
|
3217
|
-
type:
|
|
3218
|
-
response:
|
|
3219
|
-
id:
|
|
3220
|
-
created_at:
|
|
3221
|
-
model:
|
|
3222
|
-
service_tier:
|
|
3315
|
+
var responseCreatedChunkSchema = z15.object({
|
|
3316
|
+
type: z15.literal("response.created"),
|
|
3317
|
+
response: z15.object({
|
|
3318
|
+
id: z15.string(),
|
|
3319
|
+
created_at: z15.number(),
|
|
3320
|
+
model: z15.string(),
|
|
3321
|
+
service_tier: z15.string().nullish()
|
|
3223
3322
|
})
|
|
3224
3323
|
});
|
|
3225
|
-
var responseOutputItemAddedSchema =
|
|
3226
|
-
type:
|
|
3227
|
-
output_index:
|
|
3228
|
-
item:
|
|
3229
|
-
|
|
3230
|
-
type:
|
|
3231
|
-
id:
|
|
3324
|
+
var responseOutputItemAddedSchema = z15.object({
|
|
3325
|
+
type: z15.literal("response.output_item.added"),
|
|
3326
|
+
output_index: z15.number(),
|
|
3327
|
+
item: z15.discriminatedUnion("type", [
|
|
3328
|
+
z15.object({
|
|
3329
|
+
type: z15.literal("message"),
|
|
3330
|
+
id: z15.string()
|
|
3232
3331
|
}),
|
|
3233
|
-
|
|
3234
|
-
type:
|
|
3235
|
-
id:
|
|
3236
|
-
encrypted_content:
|
|
3332
|
+
z15.object({
|
|
3333
|
+
type: z15.literal("reasoning"),
|
|
3334
|
+
id: z15.string(),
|
|
3335
|
+
encrypted_content: z15.string().nullish()
|
|
3237
3336
|
}),
|
|
3238
|
-
|
|
3239
|
-
type:
|
|
3240
|
-
id:
|
|
3241
|
-
call_id:
|
|
3242
|
-
name:
|
|
3243
|
-
arguments:
|
|
3337
|
+
z15.object({
|
|
3338
|
+
type: z15.literal("function_call"),
|
|
3339
|
+
id: z15.string(),
|
|
3340
|
+
call_id: z15.string(),
|
|
3341
|
+
name: z15.string(),
|
|
3342
|
+
arguments: z15.string()
|
|
3244
3343
|
}),
|
|
3245
|
-
|
|
3246
|
-
type:
|
|
3247
|
-
id:
|
|
3248
|
-
status:
|
|
3249
|
-
action:
|
|
3250
|
-
type:
|
|
3251
|
-
query:
|
|
3344
|
+
z15.object({
|
|
3345
|
+
type: z15.literal("web_search_call"),
|
|
3346
|
+
id: z15.string(),
|
|
3347
|
+
status: z15.string(),
|
|
3348
|
+
action: z15.object({
|
|
3349
|
+
type: z15.literal("search"),
|
|
3350
|
+
query: z15.string().optional()
|
|
3252
3351
|
}).nullish()
|
|
3253
3352
|
}),
|
|
3254
|
-
|
|
3255
|
-
type:
|
|
3256
|
-
id:
|
|
3257
|
-
status:
|
|
3353
|
+
z15.object({
|
|
3354
|
+
type: z15.literal("computer_call"),
|
|
3355
|
+
id: z15.string(),
|
|
3356
|
+
status: z15.string()
|
|
3258
3357
|
}),
|
|
3259
|
-
|
|
3260
|
-
type:
|
|
3261
|
-
id:
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
attributes: z14.object({
|
|
3267
|
-
file_id: z14.string(),
|
|
3268
|
-
filename: z14.string(),
|
|
3269
|
-
score: z14.number(),
|
|
3270
|
-
text: z14.string()
|
|
3271
|
-
})
|
|
3272
|
-
})
|
|
3273
|
-
).optional()
|
|
3358
|
+
z15.object({
|
|
3359
|
+
type: z15.literal("file_search_call"),
|
|
3360
|
+
id: z15.string()
|
|
3361
|
+
}),
|
|
3362
|
+
z15.object({
|
|
3363
|
+
type: z15.literal("image_generation_call"),
|
|
3364
|
+
id: z15.string()
|
|
3274
3365
|
})
|
|
3275
3366
|
])
|
|
3276
3367
|
});
|
|
3277
|
-
var responseOutputItemDoneSchema =
|
|
3278
|
-
type:
|
|
3279
|
-
output_index:
|
|
3280
|
-
item:
|
|
3281
|
-
|
|
3282
|
-
type:
|
|
3283
|
-
id:
|
|
3368
|
+
var responseOutputItemDoneSchema = z15.object({
|
|
3369
|
+
type: z15.literal("response.output_item.done"),
|
|
3370
|
+
output_index: z15.number(),
|
|
3371
|
+
item: z15.discriminatedUnion("type", [
|
|
3372
|
+
z15.object({
|
|
3373
|
+
type: z15.literal("message"),
|
|
3374
|
+
id: z15.string()
|
|
3284
3375
|
}),
|
|
3285
|
-
|
|
3286
|
-
type:
|
|
3287
|
-
id:
|
|
3288
|
-
encrypted_content:
|
|
3376
|
+
z15.object({
|
|
3377
|
+
type: z15.literal("reasoning"),
|
|
3378
|
+
id: z15.string(),
|
|
3379
|
+
encrypted_content: z15.string().nullish()
|
|
3289
3380
|
}),
|
|
3290
|
-
|
|
3291
|
-
type:
|
|
3292
|
-
id:
|
|
3293
|
-
call_id:
|
|
3294
|
-
name:
|
|
3295
|
-
arguments:
|
|
3296
|
-
status:
|
|
3381
|
+
z15.object({
|
|
3382
|
+
type: z15.literal("function_call"),
|
|
3383
|
+
id: z15.string(),
|
|
3384
|
+
call_id: z15.string(),
|
|
3385
|
+
name: z15.string(),
|
|
3386
|
+
arguments: z15.string(),
|
|
3387
|
+
status: z15.literal("completed")
|
|
3297
3388
|
}),
|
|
3298
3389
|
codeInterpreterCallItem,
|
|
3390
|
+
imageGenerationCallItem,
|
|
3299
3391
|
webSearchCallItem,
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
z14.object({
|
|
3306
|
-
type: z14.literal("file_search_call"),
|
|
3307
|
-
id: z14.string(),
|
|
3308
|
-
status: z14.literal("completed"),
|
|
3309
|
-
queries: z14.array(z14.string()).nullish(),
|
|
3310
|
-
results: z14.array(
|
|
3311
|
-
z14.object({
|
|
3312
|
-
attributes: z14.object({
|
|
3313
|
-
file_id: z14.string(),
|
|
3314
|
-
filename: z14.string(),
|
|
3315
|
-
score: z14.number(),
|
|
3316
|
-
text: z14.string()
|
|
3317
|
-
})
|
|
3318
|
-
})
|
|
3319
|
-
).nullish()
|
|
3392
|
+
fileSearchCallItem,
|
|
3393
|
+
z15.object({
|
|
3394
|
+
type: z15.literal("computer_call"),
|
|
3395
|
+
id: z15.string(),
|
|
3396
|
+
status: z15.literal("completed")
|
|
3320
3397
|
})
|
|
3321
3398
|
])
|
|
3322
3399
|
});
|
|
3323
|
-
var responseFunctionCallArgumentsDeltaSchema =
|
|
3324
|
-
type:
|
|
3325
|
-
item_id:
|
|
3326
|
-
output_index:
|
|
3327
|
-
delta:
|
|
3400
|
+
var responseFunctionCallArgumentsDeltaSchema = z15.object({
|
|
3401
|
+
type: z15.literal("response.function_call_arguments.delta"),
|
|
3402
|
+
item_id: z15.string(),
|
|
3403
|
+
output_index: z15.number(),
|
|
3404
|
+
delta: z15.string()
|
|
3328
3405
|
});
|
|
3329
|
-
var responseAnnotationAddedSchema =
|
|
3330
|
-
type:
|
|
3331
|
-
annotation:
|
|
3332
|
-
|
|
3333
|
-
type:
|
|
3334
|
-
url:
|
|
3335
|
-
title:
|
|
3406
|
+
var responseAnnotationAddedSchema = z15.object({
|
|
3407
|
+
type: z15.literal("response.output_text.annotation.added"),
|
|
3408
|
+
annotation: z15.discriminatedUnion("type", [
|
|
3409
|
+
z15.object({
|
|
3410
|
+
type: z15.literal("url_citation"),
|
|
3411
|
+
url: z15.string(),
|
|
3412
|
+
title: z15.string()
|
|
3336
3413
|
}),
|
|
3337
|
-
|
|
3338
|
-
type:
|
|
3339
|
-
file_id:
|
|
3340
|
-
filename:
|
|
3341
|
-
index:
|
|
3342
|
-
start_index:
|
|
3343
|
-
end_index:
|
|
3344
|
-
quote:
|
|
3414
|
+
z15.object({
|
|
3415
|
+
type: z15.literal("file_citation"),
|
|
3416
|
+
file_id: z15.string(),
|
|
3417
|
+
filename: z15.string().nullish(),
|
|
3418
|
+
index: z15.number().nullish(),
|
|
3419
|
+
start_index: z15.number().nullish(),
|
|
3420
|
+
end_index: z15.number().nullish(),
|
|
3421
|
+
quote: z15.string().nullish()
|
|
3345
3422
|
})
|
|
3346
3423
|
])
|
|
3347
3424
|
});
|
|
3348
|
-
var responseReasoningSummaryPartAddedSchema =
|
|
3349
|
-
type:
|
|
3350
|
-
item_id:
|
|
3351
|
-
summary_index:
|
|
3425
|
+
var responseReasoningSummaryPartAddedSchema = z15.object({
|
|
3426
|
+
type: z15.literal("response.reasoning_summary_part.added"),
|
|
3427
|
+
item_id: z15.string(),
|
|
3428
|
+
summary_index: z15.number()
|
|
3352
3429
|
});
|
|
3353
|
-
var responseReasoningSummaryTextDeltaSchema =
|
|
3354
|
-
type:
|
|
3355
|
-
item_id:
|
|
3356
|
-
summary_index:
|
|
3357
|
-
delta:
|
|
3430
|
+
var responseReasoningSummaryTextDeltaSchema = z15.object({
|
|
3431
|
+
type: z15.literal("response.reasoning_summary_text.delta"),
|
|
3432
|
+
item_id: z15.string(),
|
|
3433
|
+
summary_index: z15.number(),
|
|
3434
|
+
delta: z15.string()
|
|
3358
3435
|
});
|
|
3359
|
-
var openaiResponsesChunkSchema =
|
|
3436
|
+
var openaiResponsesChunkSchema = z15.union([
|
|
3360
3437
|
textDeltaChunkSchema,
|
|
3361
3438
|
responseFinishedChunkSchema,
|
|
3362
3439
|
responseCreatedChunkSchema,
|
|
@@ -3367,7 +3444,7 @@ var openaiResponsesChunkSchema = z14.union([
|
|
|
3367
3444
|
responseReasoningSummaryPartAddedSchema,
|
|
3368
3445
|
responseReasoningSummaryTextDeltaSchema,
|
|
3369
3446
|
errorChunkSchema,
|
|
3370
|
-
|
|
3447
|
+
z15.object({ type: z15.string() }).loose()
|
|
3371
3448
|
// fallback for unknown chunks
|
|
3372
3449
|
]);
|
|
3373
3450
|
function isTextDeltaChunk(chunk) {
|
|
@@ -3440,27 +3517,15 @@ function getResponsesModelConfig(modelId) {
|
|
|
3440
3517
|
isReasoningModel: false
|
|
3441
3518
|
};
|
|
3442
3519
|
}
|
|
3443
|
-
var openaiResponsesProviderOptionsSchema =
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
previousResponseId: z14.string().nullish(),
|
|
3447
|
-
store: z14.boolean().nullish(),
|
|
3448
|
-
user: z14.string().nullish(),
|
|
3449
|
-
reasoningEffort: z14.string().nullish(),
|
|
3450
|
-
strictJsonSchema: z14.boolean().nullish(),
|
|
3451
|
-
instructions: z14.string().nullish(),
|
|
3452
|
-
reasoningSummary: z14.string().nullish(),
|
|
3453
|
-
serviceTier: z14.enum(["auto", "flex", "priority"]).nullish(),
|
|
3454
|
-
include: z14.array(
|
|
3455
|
-
z14.enum([
|
|
3520
|
+
var openaiResponsesProviderOptionsSchema = z15.object({
|
|
3521
|
+
include: z15.array(
|
|
3522
|
+
z15.enum([
|
|
3456
3523
|
"reasoning.encrypted_content",
|
|
3457
3524
|
"file_search_call.results",
|
|
3458
3525
|
"message.output_text.logprobs"
|
|
3459
3526
|
])
|
|
3460
3527
|
).nullish(),
|
|
3461
|
-
|
|
3462
|
-
promptCacheKey: z14.string().nullish(),
|
|
3463
|
-
safetyIdentifier: z14.string().nullish(),
|
|
3528
|
+
instructions: z15.string().nullish(),
|
|
3464
3529
|
/**
|
|
3465
3530
|
* Return the log probabilities of the tokens.
|
|
3466
3531
|
*
|
|
@@ -3473,7 +3538,25 @@ var openaiResponsesProviderOptionsSchema = z14.object({
|
|
|
3473
3538
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3474
3539
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3475
3540
|
*/
|
|
3476
|
-
logprobs:
|
|
3541
|
+
logprobs: z15.union([z15.boolean(), z15.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3542
|
+
/**
|
|
3543
|
+
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3544
|
+
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3545
|
+
* Any further attempts to call a tool by the model will be ignored.
|
|
3546
|
+
*/
|
|
3547
|
+
maxToolCalls: z15.number().nullish(),
|
|
3548
|
+
metadata: z15.any().nullish(),
|
|
3549
|
+
parallelToolCalls: z15.boolean().nullish(),
|
|
3550
|
+
previousResponseId: z15.string().nullish(),
|
|
3551
|
+
promptCacheKey: z15.string().nullish(),
|
|
3552
|
+
reasoningEffort: z15.string().nullish(),
|
|
3553
|
+
reasoningSummary: z15.string().nullish(),
|
|
3554
|
+
safetyIdentifier: z15.string().nullish(),
|
|
3555
|
+
serviceTier: z15.enum(["auto", "flex", "priority"]).nullish(),
|
|
3556
|
+
store: z15.boolean().nullish(),
|
|
3557
|
+
strictJsonSchema: z15.boolean().nullish(),
|
|
3558
|
+
textVerbosity: z15.enum(["low", "medium", "high"]).nullish(),
|
|
3559
|
+
user: z15.string().nullish()
|
|
3477
3560
|
});
|
|
3478
3561
|
|
|
3479
3562
|
// src/speech/openai-speech-model.ts
|
|
@@ -3483,10 +3566,10 @@ import {
|
|
|
3483
3566
|
parseProviderOptions as parseProviderOptions6,
|
|
3484
3567
|
postJsonToApi as postJsonToApi6
|
|
3485
3568
|
} from "@ai-sdk/provider-utils";
|
|
3486
|
-
import { z as
|
|
3487
|
-
var OpenAIProviderOptionsSchema =
|
|
3488
|
-
instructions:
|
|
3489
|
-
speed:
|
|
3569
|
+
import { z as z16 } from "zod/v4";
|
|
3570
|
+
var OpenAIProviderOptionsSchema = z16.object({
|
|
3571
|
+
instructions: z16.string().nullish(),
|
|
3572
|
+
speed: z16.number().min(0.25).max(4).default(1).nullish()
|
|
3490
3573
|
});
|
|
3491
3574
|
var OpenAISpeechModel = class {
|
|
3492
3575
|
constructor(modelId, config) {
|
|
@@ -3597,33 +3680,33 @@ import {
|
|
|
3597
3680
|
parseProviderOptions as parseProviderOptions7,
|
|
3598
3681
|
postFormDataToApi
|
|
3599
3682
|
} from "@ai-sdk/provider-utils";
|
|
3600
|
-
import { z as
|
|
3683
|
+
import { z as z18 } from "zod/v4";
|
|
3601
3684
|
|
|
3602
3685
|
// src/transcription/openai-transcription-options.ts
|
|
3603
|
-
import { z as
|
|
3604
|
-
var openAITranscriptionProviderOptions =
|
|
3686
|
+
import { z as z17 } from "zod/v4";
|
|
3687
|
+
var openAITranscriptionProviderOptions = z17.object({
|
|
3605
3688
|
/**
|
|
3606
3689
|
* Additional information to include in the transcription response.
|
|
3607
3690
|
*/
|
|
3608
|
-
include:
|
|
3691
|
+
include: z17.array(z17.string()).optional(),
|
|
3609
3692
|
/**
|
|
3610
3693
|
* The language of the input audio in ISO-639-1 format.
|
|
3611
3694
|
*/
|
|
3612
|
-
language:
|
|
3695
|
+
language: z17.string().optional(),
|
|
3613
3696
|
/**
|
|
3614
3697
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
3615
3698
|
*/
|
|
3616
|
-
prompt:
|
|
3699
|
+
prompt: z17.string().optional(),
|
|
3617
3700
|
/**
|
|
3618
3701
|
* The sampling temperature, between 0 and 1.
|
|
3619
3702
|
* @default 0
|
|
3620
3703
|
*/
|
|
3621
|
-
temperature:
|
|
3704
|
+
temperature: z17.number().min(0).max(1).default(0).optional(),
|
|
3622
3705
|
/**
|
|
3623
3706
|
* The timestamp granularities to populate for this transcription.
|
|
3624
3707
|
* @default ['segment']
|
|
3625
3708
|
*/
|
|
3626
|
-
timestampGranularities:
|
|
3709
|
+
timestampGranularities: z17.array(z17.enum(["word", "segment"])).default(["segment"]).optional()
|
|
3627
3710
|
});
|
|
3628
3711
|
|
|
3629
3712
|
// src/transcription/openai-transcription-model.ts
|
|
@@ -3792,29 +3875,29 @@ var OpenAITranscriptionModel = class {
|
|
|
3792
3875
|
};
|
|
3793
3876
|
}
|
|
3794
3877
|
};
|
|
3795
|
-
var openaiTranscriptionResponseSchema =
|
|
3796
|
-
text:
|
|
3797
|
-
language:
|
|
3798
|
-
duration:
|
|
3799
|
-
words:
|
|
3800
|
-
|
|
3801
|
-
word:
|
|
3802
|
-
start:
|
|
3803
|
-
end:
|
|
3878
|
+
var openaiTranscriptionResponseSchema = z18.object({
|
|
3879
|
+
text: z18.string(),
|
|
3880
|
+
language: z18.string().nullish(),
|
|
3881
|
+
duration: z18.number().nullish(),
|
|
3882
|
+
words: z18.array(
|
|
3883
|
+
z18.object({
|
|
3884
|
+
word: z18.string(),
|
|
3885
|
+
start: z18.number(),
|
|
3886
|
+
end: z18.number()
|
|
3804
3887
|
})
|
|
3805
3888
|
).nullish(),
|
|
3806
|
-
segments:
|
|
3807
|
-
|
|
3808
|
-
id:
|
|
3809
|
-
seek:
|
|
3810
|
-
start:
|
|
3811
|
-
end:
|
|
3812
|
-
text:
|
|
3813
|
-
tokens:
|
|
3814
|
-
temperature:
|
|
3815
|
-
avg_logprob:
|
|
3816
|
-
compression_ratio:
|
|
3817
|
-
no_speech_prob:
|
|
3889
|
+
segments: z18.array(
|
|
3890
|
+
z18.object({
|
|
3891
|
+
id: z18.number(),
|
|
3892
|
+
seek: z18.number(),
|
|
3893
|
+
start: z18.number(),
|
|
3894
|
+
end: z18.number(),
|
|
3895
|
+
text: z18.string(),
|
|
3896
|
+
tokens: z18.array(z18.number()),
|
|
3897
|
+
temperature: z18.number(),
|
|
3898
|
+
avg_logprob: z18.number(),
|
|
3899
|
+
compression_ratio: z18.number(),
|
|
3900
|
+
no_speech_prob: z18.number()
|
|
3818
3901
|
})
|
|
3819
3902
|
).nullish()
|
|
3820
3903
|
});
|