@xyd-js/ask-ai-edge 0.0.0-build-2acf05c-20251207022018 → 0.0.0-build-8a0317f-20251214165542
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/dist/index.js +313 -207
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -17102,7 +17102,7 @@ var optionalType = ZodOptional2.create;
|
|
|
17102
17102
|
var nullableType = ZodNullable2.create;
|
|
17103
17103
|
var preprocessType = ZodEffects.createWithPreprocess;
|
|
17104
17104
|
var pipelineType = ZodPipeline.create;
|
|
17105
|
-
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@3.0.
|
|
17105
|
+
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@3.0.19_zod@3.25.76/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
17106
17106
|
function combineHeaders(...headers) {
|
|
17107
17107
|
return headers.reduce((combinedHeaders, currentHeaders) => ({
|
|
17108
17108
|
...combinedHeaders,
|
|
@@ -17292,7 +17292,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
17292
17292
|
normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
|
|
17293
17293
|
return Object.fromEntries(normalizedHeaders.entries());
|
|
17294
17294
|
}
|
|
17295
|
-
var VERSION = "3.0.
|
|
17295
|
+
var VERSION = "3.0.19";
|
|
17296
17296
|
var getOriginalFetch = () => globalThis.fetch;
|
|
17297
17297
|
var getFromApi = async ({
|
|
17298
17298
|
url: url2,
|
|
@@ -17731,9 +17731,6 @@ var postToApi = async ({
|
|
|
17731
17731
|
function tool(tool2) {
|
|
17732
17732
|
return tool2;
|
|
17733
17733
|
}
|
|
17734
|
-
function dynamicTool(tool2) {
|
|
17735
|
-
return { ...tool2, type: "dynamic" };
|
|
17736
|
-
}
|
|
17737
17734
|
function createProviderDefinedToolFactory({
|
|
17738
17735
|
id,
|
|
17739
17736
|
name: name14,
|
|
@@ -17915,6 +17912,25 @@ var createBinaryResponseHandler = () => async ({ response, url: url2, requestBod
|
|
|
17915
17912
|
});
|
|
17916
17913
|
}
|
|
17917
17914
|
};
|
|
17915
|
+
function addAdditionalPropertiesToJsonSchema(jsonSchema2) {
|
|
17916
|
+
if (jsonSchema2.type === "object") {
|
|
17917
|
+
jsonSchema2.additionalProperties = false;
|
|
17918
|
+
const properties = jsonSchema2.properties;
|
|
17919
|
+
if (properties != null) {
|
|
17920
|
+
for (const property in properties) {
|
|
17921
|
+
properties[property] = addAdditionalPropertiesToJsonSchema(properties[property]);
|
|
17922
|
+
}
|
|
17923
|
+
}
|
|
17924
|
+
}
|
|
17925
|
+
if (jsonSchema2.type === "array" && jsonSchema2.items != null) {
|
|
17926
|
+
if (Array.isArray(jsonSchema2.items)) {
|
|
17927
|
+
jsonSchema2.items = jsonSchema2.items.map((item) => addAdditionalPropertiesToJsonSchema(item));
|
|
17928
|
+
} else {
|
|
17929
|
+
jsonSchema2.items = addAdditionalPropertiesToJsonSchema(jsonSchema2.items);
|
|
17930
|
+
}
|
|
17931
|
+
}
|
|
17932
|
+
return jsonSchema2;
|
|
17933
|
+
}
|
|
17918
17934
|
var getRelativePath = (pathA, pathB) => {
|
|
17919
17935
|
let i = 0;
|
|
17920
17936
|
for (;i < pathA.length && i < pathB.length; i++) {
|
|
@@ -18924,11 +18940,11 @@ function zod3Schema(zodSchema2, options) {
|
|
|
18924
18940
|
function zod4Schema(zodSchema2, options) {
|
|
18925
18941
|
var _a15;
|
|
18926
18942
|
const useReferences = (_a15 = options == null ? undefined : options.useReferences) != null ? _a15 : false;
|
|
18927
|
-
return jsonSchema(() => toJSONSchema(zodSchema2, {
|
|
18943
|
+
return jsonSchema(() => addAdditionalPropertiesToJsonSchema(toJSONSchema(zodSchema2, {
|
|
18928
18944
|
target: "draft-7",
|
|
18929
|
-
io: "
|
|
18945
|
+
io: "input",
|
|
18930
18946
|
reused: useReferences ? "ref" : "inline"
|
|
18931
|
-
}), {
|
|
18947
|
+
})), {
|
|
18932
18948
|
validate: async (value) => {
|
|
18933
18949
|
const result = await safeParseAsync2(zodSchema2, value);
|
|
18934
18950
|
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
@@ -19020,7 +19036,7 @@ async function* executeTool({
|
|
|
19020
19036
|
}
|
|
19021
19037
|
}
|
|
19022
19038
|
|
|
19023
|
-
// ../../node_modules/.pnpm/@ai-sdk+gateway@2.0.
|
|
19039
|
+
// ../../node_modules/.pnpm/@ai-sdk+gateway@2.0.21_zod@3.25.76/node_modules/@ai-sdk/gateway/dist/index.mjs
|
|
19024
19040
|
var import_oidc = __toESM(require_dist(), 1);
|
|
19025
19041
|
var import_oidc2 = __toESM(require_dist(), 1);
|
|
19026
19042
|
var marker15 = "vercel.ai.gateway.error";
|
|
@@ -19658,7 +19674,7 @@ async function getVercelRequestId() {
|
|
|
19658
19674
|
var _a82;
|
|
19659
19675
|
return (_a82 = import_oidc.getContext().headers) == null ? undefined : _a82["x-vercel-id"];
|
|
19660
19676
|
}
|
|
19661
|
-
var VERSION2 = "2.0.
|
|
19677
|
+
var VERSION2 = "2.0.21";
|
|
19662
19678
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
19663
19679
|
function createGatewayProvider(options = {}) {
|
|
19664
19680
|
var _a82, _b8;
|
|
@@ -19794,7 +19810,7 @@ async function getGatewayAuthToken(options) {
|
|
|
19794
19810
|
}
|
|
19795
19811
|
}
|
|
19796
19812
|
|
|
19797
|
-
// ../../node_modules/.pnpm/ai@5.0.
|
|
19813
|
+
// ../../node_modules/.pnpm/ai@5.0.113_zod@3.25.76/node_modules/ai/dist/index.mjs
|
|
19798
19814
|
var import_api2 = __toESM(require_src(), 1);
|
|
19799
19815
|
var import_api3 = __toESM(require_src(), 1);
|
|
19800
19816
|
var __defProp2 = Object.defineProperty;
|
|
@@ -20198,7 +20214,7 @@ function detectMediaType({
|
|
|
20198
20214
|
}
|
|
20199
20215
|
return;
|
|
20200
20216
|
}
|
|
20201
|
-
var VERSION3 = "5.0.
|
|
20217
|
+
var VERSION3 = "5.0.113";
|
|
20202
20218
|
var download = async ({ url: url2 }) => {
|
|
20203
20219
|
var _a16;
|
|
20204
20220
|
const urlText = url2.toString();
|
|
@@ -20790,14 +20806,25 @@ async function standardizePrompt(prompt) {
|
|
|
20790
20806
|
};
|
|
20791
20807
|
}
|
|
20792
20808
|
function wrapGatewayError(error40) {
|
|
20793
|
-
if (GatewayAuthenticationError.isInstance(error40)
|
|
20809
|
+
if (!GatewayAuthenticationError.isInstance(error40))
|
|
20810
|
+
return error40;
|
|
20811
|
+
const isProductionEnv = (process == null ? undefined : "development") === "production";
|
|
20812
|
+
const moreInfoURL = "https://ai-sdk.dev/unauthenticated-ai-gateway";
|
|
20813
|
+
if (isProductionEnv) {
|
|
20794
20814
|
return new AISDKError({
|
|
20795
20815
|
name: "GatewayError",
|
|
20796
|
-
message:
|
|
20797
|
-
cause: error40
|
|
20816
|
+
message: `Unauthenticated. Configure AI_GATEWAY_API_KEY or use a provider module. Learn more: ${moreInfoURL}`
|
|
20798
20817
|
});
|
|
20799
20818
|
}
|
|
20800
|
-
return
|
|
20819
|
+
return Object.assign(new Error(`\x1B[1m\x1B[31mUnauthenticated request to AI Gateway.\x1B[0m
|
|
20820
|
+
|
|
20821
|
+
To authenticate, set the \x1B[33mAI_GATEWAY_API_KEY\x1B[0m environment variable with your API key.
|
|
20822
|
+
|
|
20823
|
+
Alternatively, you can use a provider module instead of the AI Gateway.
|
|
20824
|
+
|
|
20825
|
+
Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
20826
|
+
|
|
20827
|
+
`), { name: "GatewayAuthenticationError" });
|
|
20801
20828
|
}
|
|
20802
20829
|
function assembleOperationName({
|
|
20803
20830
|
operationId,
|
|
@@ -24476,6 +24503,102 @@ var uiMessagesSchema = lazyValidator(() => zodSchema(exports_external.array(expo
|
|
|
24476
24503
|
})
|
|
24477
24504
|
])).nonempty("Message must contain at least one part")
|
|
24478
24505
|
})).nonempty("Messages array must not be empty")));
|
|
24506
|
+
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@3.0.18_zod@3.25.76/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
24507
|
+
var createIdGenerator2 = ({
|
|
24508
|
+
prefix,
|
|
24509
|
+
size = 16,
|
|
24510
|
+
alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
24511
|
+
separator = "-"
|
|
24512
|
+
} = {}) => {
|
|
24513
|
+
const generator = () => {
|
|
24514
|
+
const alphabetLength = alphabet.length;
|
|
24515
|
+
const chars = new Array(size);
|
|
24516
|
+
for (let i = 0;i < size; i++) {
|
|
24517
|
+
chars[i] = alphabet[Math.random() * alphabetLength | 0];
|
|
24518
|
+
}
|
|
24519
|
+
return chars.join("");
|
|
24520
|
+
};
|
|
24521
|
+
if (prefix == null) {
|
|
24522
|
+
return generator;
|
|
24523
|
+
}
|
|
24524
|
+
if (alphabet.includes(separator)) {
|
|
24525
|
+
throw new InvalidArgumentError({
|
|
24526
|
+
argument: "separator",
|
|
24527
|
+
message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
|
|
24528
|
+
});
|
|
24529
|
+
}
|
|
24530
|
+
return () => `${prefix}${separator}${generator()}`;
|
|
24531
|
+
};
|
|
24532
|
+
var generateId2 = createIdGenerator2();
|
|
24533
|
+
function getRuntimeEnvironmentUserAgent2(globalThisAny = globalThis) {
|
|
24534
|
+
var _a16, _b8, _c;
|
|
24535
|
+
if (globalThisAny.window) {
|
|
24536
|
+
return `runtime/browser`;
|
|
24537
|
+
}
|
|
24538
|
+
if ((_a16 = globalThisAny.navigator) == null ? undefined : _a16.userAgent) {
|
|
24539
|
+
return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
|
|
24540
|
+
}
|
|
24541
|
+
if ((_c = (_b8 = globalThisAny.process) == null ? undefined : _b8.versions) == null ? undefined : _c.node) {
|
|
24542
|
+
return `runtime/node.js/${globalThisAny.process.version.substring(0)}`;
|
|
24543
|
+
}
|
|
24544
|
+
if (globalThisAny.EdgeRuntime) {
|
|
24545
|
+
return `runtime/vercel-edge`;
|
|
24546
|
+
}
|
|
24547
|
+
return "runtime/unknown";
|
|
24548
|
+
}
|
|
24549
|
+
function normalizeHeaders2(headers) {
|
|
24550
|
+
if (headers == null) {
|
|
24551
|
+
return {};
|
|
24552
|
+
}
|
|
24553
|
+
const normalized = {};
|
|
24554
|
+
if (headers instanceof Headers) {
|
|
24555
|
+
headers.forEach((value, key) => {
|
|
24556
|
+
normalized[key.toLowerCase()] = value;
|
|
24557
|
+
});
|
|
24558
|
+
} else {
|
|
24559
|
+
if (!Array.isArray(headers)) {
|
|
24560
|
+
headers = Object.entries(headers);
|
|
24561
|
+
}
|
|
24562
|
+
for (const [key, value] of headers) {
|
|
24563
|
+
if (value != null) {
|
|
24564
|
+
normalized[key.toLowerCase()] = value;
|
|
24565
|
+
}
|
|
24566
|
+
}
|
|
24567
|
+
}
|
|
24568
|
+
return normalized;
|
|
24569
|
+
}
|
|
24570
|
+
function withUserAgentSuffix2(headers, ...userAgentSuffixParts) {
|
|
24571
|
+
const normalizedHeaders = new Headers(normalizeHeaders2(headers));
|
|
24572
|
+
const currentUserAgentHeader = normalizedHeaders.get("user-agent") || "";
|
|
24573
|
+
normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
|
|
24574
|
+
return Object.fromEntries(normalizedHeaders.entries());
|
|
24575
|
+
}
|
|
24576
|
+
var validatorSymbol2 = Symbol.for("vercel.ai.validator");
|
|
24577
|
+
function tool2(tool22) {
|
|
24578
|
+
return tool22;
|
|
24579
|
+
}
|
|
24580
|
+
function dynamicTool(tool22) {
|
|
24581
|
+
return { ...tool22, type: "dynamic" };
|
|
24582
|
+
}
|
|
24583
|
+
var ignoreOverride2 = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
24584
|
+
var ALPHA_NUMERIC2 = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
24585
|
+
var schemaSymbol2 = Symbol.for("vercel.ai.schema");
|
|
24586
|
+
function jsonSchema2(jsonSchema22, {
|
|
24587
|
+
validate
|
|
24588
|
+
} = {}) {
|
|
24589
|
+
return {
|
|
24590
|
+
[schemaSymbol2]: true,
|
|
24591
|
+
_type: undefined,
|
|
24592
|
+
[validatorSymbol2]: true,
|
|
24593
|
+
get jsonSchema() {
|
|
24594
|
+
if (typeof jsonSchema22 === "function") {
|
|
24595
|
+
jsonSchema22 = jsonSchema22();
|
|
24596
|
+
}
|
|
24597
|
+
return jsonSchema22;
|
|
24598
|
+
},
|
|
24599
|
+
validate
|
|
24600
|
+
};
|
|
24601
|
+
}
|
|
24479
24602
|
|
|
24480
24603
|
// ../../node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.node.js
|
|
24481
24604
|
var crypto;
|
|
@@ -25406,7 +25529,7 @@ var SseMCPTransport = class {
|
|
|
25406
25529
|
headers["Authorization"] = `Bearer ${tokens.access_token}`;
|
|
25407
25530
|
}
|
|
25408
25531
|
}
|
|
25409
|
-
return
|
|
25532
|
+
return withUserAgentSuffix2(headers, `ai-sdk/${VERSION4}`, getRuntimeEnvironmentUserAgent2());
|
|
25410
25533
|
}
|
|
25411
25534
|
async start() {
|
|
25412
25535
|
return new Promise((resolve2, reject) => {
|
|
@@ -25608,7 +25731,7 @@ var HttpMCPTransport = class {
|
|
|
25608
25731
|
headers["Authorization"] = `Bearer ${tokens.access_token}`;
|
|
25609
25732
|
}
|
|
25610
25733
|
}
|
|
25611
|
-
return
|
|
25734
|
+
return withUserAgentSuffix2(headers, `ai-sdk/${VERSION4}`, getRuntimeEnvironmentUserAgent2());
|
|
25612
25735
|
}
|
|
25613
25736
|
async start() {
|
|
25614
25737
|
if (this.abortController) {
|
|
@@ -26190,13 +26313,13 @@ var DefaultMCPClient = class {
|
|
|
26190
26313
|
};
|
|
26191
26314
|
const toolWithExecute = schemas3 === "automatic" ? dynamicTool({
|
|
26192
26315
|
description,
|
|
26193
|
-
inputSchema:
|
|
26316
|
+
inputSchema: jsonSchema2({
|
|
26194
26317
|
...inputSchema,
|
|
26195
26318
|
properties: (_a34 = inputSchema.properties) != null ? _a34 : {},
|
|
26196
26319
|
additionalProperties: false
|
|
26197
26320
|
}),
|
|
26198
26321
|
execute
|
|
26199
|
-
}) :
|
|
26322
|
+
}) : tool2({
|
|
26200
26323
|
description,
|
|
26201
26324
|
inputSchema: schemas3[name34].inputSchema,
|
|
26202
26325
|
execute
|
|
@@ -26669,8 +26792,8 @@ function S(t2) {
|
|
|
26669
26792
|
}, S(t2);
|
|
26670
26793
|
}
|
|
26671
26794
|
|
|
26672
|
-
// ../../node_modules/.pnpm/@ai-sdk+anthropic@2.0.
|
|
26673
|
-
var VERSION5 = "2.0.
|
|
26795
|
+
// ../../node_modules/.pnpm/@ai-sdk+anthropic@2.0.56_zod@3.25.76/node_modules/@ai-sdk/anthropic/dist/index.mjs
|
|
26796
|
+
var VERSION5 = "2.0.56";
|
|
26674
26797
|
var anthropicErrorDataSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
26675
26798
|
type: exports_external.literal("error"),
|
|
26676
26799
|
error: exports_external.object({
|
|
@@ -26749,11 +26872,18 @@ var anthropicMessagesResponseSchema = lazySchema(() => zodSchema(exports_externa
|
|
|
26749
26872
|
type: exports_external.literal("document"),
|
|
26750
26873
|
title: exports_external.string().nullable(),
|
|
26751
26874
|
citations: exports_external.object({ enabled: exports_external.boolean() }).optional(),
|
|
26752
|
-
source: exports_external.
|
|
26753
|
-
|
|
26754
|
-
|
|
26755
|
-
|
|
26756
|
-
|
|
26875
|
+
source: exports_external.union([
|
|
26876
|
+
exports_external.object({
|
|
26877
|
+
type: exports_external.literal("base64"),
|
|
26878
|
+
media_type: exports_external.literal("application/pdf"),
|
|
26879
|
+
data: exports_external.string()
|
|
26880
|
+
}),
|
|
26881
|
+
exports_external.object({
|
|
26882
|
+
type: exports_external.literal("text"),
|
|
26883
|
+
media_type: exports_external.literal("text/plain"),
|
|
26884
|
+
data: exports_external.string()
|
|
26885
|
+
})
|
|
26886
|
+
])
|
|
26757
26887
|
})
|
|
26758
26888
|
}),
|
|
26759
26889
|
exports_external.object({
|
|
@@ -26916,11 +27046,18 @@ var anthropicMessagesChunkSchema = lazySchema(() => zodSchema(exports_external.d
|
|
|
26916
27046
|
type: exports_external.literal("document"),
|
|
26917
27047
|
title: exports_external.string().nullable(),
|
|
26918
27048
|
citations: exports_external.object({ enabled: exports_external.boolean() }).optional(),
|
|
26919
|
-
source: exports_external.
|
|
26920
|
-
|
|
26921
|
-
|
|
26922
|
-
|
|
26923
|
-
|
|
27049
|
+
source: exports_external.union([
|
|
27050
|
+
exports_external.object({
|
|
27051
|
+
type: exports_external.literal("base64"),
|
|
27052
|
+
media_type: exports_external.literal("application/pdf"),
|
|
27053
|
+
data: exports_external.string()
|
|
27054
|
+
}),
|
|
27055
|
+
exports_external.object({
|
|
27056
|
+
type: exports_external.literal("text"),
|
|
27057
|
+
media_type: exports_external.literal("text/plain"),
|
|
27058
|
+
data: exports_external.string()
|
|
27059
|
+
})
|
|
27060
|
+
])
|
|
26924
27061
|
})
|
|
26925
27062
|
}),
|
|
26926
27063
|
exports_external.object({
|
|
@@ -27212,7 +27349,7 @@ var webSearch_20250305ArgsSchema = lazySchema(() => zodSchema(exports_external.o
|
|
|
27212
27349
|
})));
|
|
27213
27350
|
var webSearch_20250305OutputSchema = lazySchema(() => zodSchema(exports_external.array(exports_external.object({
|
|
27214
27351
|
url: exports_external.string(),
|
|
27215
|
-
title: exports_external.string(),
|
|
27352
|
+
title: exports_external.string().nullable(),
|
|
27216
27353
|
pageAge: exports_external.string().nullable(),
|
|
27217
27354
|
encryptedContent: exports_external.string(),
|
|
27218
27355
|
type: exports_external.literal("web_search_result")
|
|
@@ -27241,7 +27378,7 @@ var webFetch_20250910OutputSchema = lazySchema(() => zodSchema(exports_external.
|
|
|
27241
27378
|
url: exports_external.string(),
|
|
27242
27379
|
content: exports_external.object({
|
|
27243
27380
|
type: exports_external.literal("document"),
|
|
27244
|
-
title: exports_external.string(),
|
|
27381
|
+
title: exports_external.string().nullable(),
|
|
27245
27382
|
citations: exports_external.object({ enabled: exports_external.boolean() }).optional(),
|
|
27246
27383
|
source: exports_external.union([
|
|
27247
27384
|
exports_external.object({
|
|
@@ -27284,23 +27421,23 @@ async function prepareTools({
|
|
|
27284
27421
|
return { tools: undefined, toolChoice: undefined, toolWarnings, betas };
|
|
27285
27422
|
}
|
|
27286
27423
|
const anthropicTools2 = [];
|
|
27287
|
-
for (const
|
|
27288
|
-
switch (
|
|
27424
|
+
for (const tool3 of tools) {
|
|
27425
|
+
switch (tool3.type) {
|
|
27289
27426
|
case "function": {
|
|
27290
|
-
const cacheControl = validator2.getCacheControl(
|
|
27427
|
+
const cacheControl = validator2.getCacheControl(tool3.providerOptions, {
|
|
27291
27428
|
type: "tool definition",
|
|
27292
27429
|
canCache: true
|
|
27293
27430
|
});
|
|
27294
27431
|
anthropicTools2.push({
|
|
27295
|
-
name:
|
|
27296
|
-
description:
|
|
27297
|
-
input_schema:
|
|
27432
|
+
name: tool3.name,
|
|
27433
|
+
description: tool3.description,
|
|
27434
|
+
input_schema: tool3.inputSchema,
|
|
27298
27435
|
cache_control: cacheControl
|
|
27299
27436
|
});
|
|
27300
27437
|
break;
|
|
27301
27438
|
}
|
|
27302
27439
|
case "provider-defined": {
|
|
27303
|
-
switch (
|
|
27440
|
+
switch (tool3.id) {
|
|
27304
27441
|
case "anthropic.code_execution_20250522": {
|
|
27305
27442
|
betas.add("code-execution-2025-05-22");
|
|
27306
27443
|
anthropicTools2.push({
|
|
@@ -27323,9 +27460,9 @@ async function prepareTools({
|
|
|
27323
27460
|
anthropicTools2.push({
|
|
27324
27461
|
name: "computer",
|
|
27325
27462
|
type: "computer_20250124",
|
|
27326
|
-
display_width_px:
|
|
27327
|
-
display_height_px:
|
|
27328
|
-
display_number:
|
|
27463
|
+
display_width_px: tool3.args.displayWidthPx,
|
|
27464
|
+
display_height_px: tool3.args.displayHeightPx,
|
|
27465
|
+
display_number: tool3.args.displayNumber,
|
|
27329
27466
|
cache_control: undefined
|
|
27330
27467
|
});
|
|
27331
27468
|
break;
|
|
@@ -27335,9 +27472,9 @@ async function prepareTools({
|
|
|
27335
27472
|
anthropicTools2.push({
|
|
27336
27473
|
name: "computer",
|
|
27337
27474
|
type: "computer_20241022",
|
|
27338
|
-
display_width_px:
|
|
27339
|
-
display_height_px:
|
|
27340
|
-
display_number:
|
|
27475
|
+
display_width_px: tool3.args.displayWidthPx,
|
|
27476
|
+
display_height_px: tool3.args.displayHeightPx,
|
|
27477
|
+
display_number: tool3.args.displayNumber,
|
|
27341
27478
|
cache_control: undefined
|
|
27342
27479
|
});
|
|
27343
27480
|
break;
|
|
@@ -27371,7 +27508,7 @@ async function prepareTools({
|
|
|
27371
27508
|
}
|
|
27372
27509
|
case "anthropic.text_editor_20250728": {
|
|
27373
27510
|
const args = await validateTypes({
|
|
27374
|
-
value:
|
|
27511
|
+
value: tool3.args,
|
|
27375
27512
|
schema: textEditor_20250728ArgsSchema
|
|
27376
27513
|
});
|
|
27377
27514
|
anthropicTools2.push({
|
|
@@ -27411,7 +27548,7 @@ async function prepareTools({
|
|
|
27411
27548
|
case "anthropic.web_fetch_20250910": {
|
|
27412
27549
|
betas.add("web-fetch-2025-09-10");
|
|
27413
27550
|
const args = await validateTypes({
|
|
27414
|
-
value:
|
|
27551
|
+
value: tool3.args,
|
|
27415
27552
|
schema: webFetch_20250910ArgsSchema
|
|
27416
27553
|
});
|
|
27417
27554
|
anthropicTools2.push({
|
|
@@ -27428,7 +27565,7 @@ async function prepareTools({
|
|
|
27428
27565
|
}
|
|
27429
27566
|
case "anthropic.web_search_20250305": {
|
|
27430
27567
|
const args = await validateTypes({
|
|
27431
|
-
value:
|
|
27568
|
+
value: tool3.args,
|
|
27432
27569
|
schema: webSearch_20250305ArgsSchema
|
|
27433
27570
|
});
|
|
27434
27571
|
anthropicTools2.push({
|
|
@@ -27443,14 +27580,14 @@ async function prepareTools({
|
|
|
27443
27580
|
break;
|
|
27444
27581
|
}
|
|
27445
27582
|
default: {
|
|
27446
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
27583
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool3 });
|
|
27447
27584
|
break;
|
|
27448
27585
|
}
|
|
27449
27586
|
}
|
|
27450
27587
|
break;
|
|
27451
27588
|
}
|
|
27452
27589
|
default: {
|
|
27453
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
27590
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool3 });
|
|
27454
27591
|
break;
|
|
27455
27592
|
}
|
|
27456
27593
|
}
|
|
@@ -28367,7 +28504,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
28367
28504
|
betas.add("code-execution-2025-08-25");
|
|
28368
28505
|
betas.add("skills-2025-10-02");
|
|
28369
28506
|
betas.add("files-api-2025-04-14");
|
|
28370
|
-
if (!(tools == null ? undefined : tools.some((
|
|
28507
|
+
if (!(tools == null ? undefined : tools.some((tool3) => tool3.type === "provider-defined" && tool3.id === "anthropic.code_execution_20250825"))) {
|
|
28371
28508
|
warnings.push({
|
|
28372
28509
|
type: "other",
|
|
28373
28510
|
message: "code execution tool is required when using skills"
|
|
@@ -29448,7 +29585,7 @@ function createAnthropic(options = {}) {
|
|
|
29448
29585
|
}
|
|
29449
29586
|
var anthropic = createAnthropic();
|
|
29450
29587
|
|
|
29451
|
-
// ../../node_modules/.pnpm/@ai-sdk+openai@2.0.
|
|
29588
|
+
// ../../node_modules/.pnpm/@ai-sdk+openai@2.0.86_zod@3.25.76/node_modules/@ai-sdk/openai/dist/index.mjs
|
|
29452
29589
|
var openaiErrorDataSchema = exports_external.object({
|
|
29453
29590
|
error: exports_external.object({
|
|
29454
29591
|
message: exports_external.string(),
|
|
@@ -29461,6 +29598,20 @@ var openaiFailedResponseHandler = createJsonErrorResponseHandler({
|
|
|
29461
29598
|
errorSchema: openaiErrorDataSchema,
|
|
29462
29599
|
errorToMessage: (data) => data.error.message
|
|
29463
29600
|
});
|
|
29601
|
+
function getOpenAILanguageModelCapabilities(modelId) {
|
|
29602
|
+
const supportsFlexProcessing = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
29603
|
+
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
29604
|
+
const isReasoningModel = !(modelId.startsWith("gpt-3") || modelId.startsWith("gpt-4") || modelId.startsWith("chatgpt-4o") || modelId.startsWith("gpt-5-chat"));
|
|
29605
|
+
const supportsNonReasoningParameters = modelId.startsWith("gpt-5.1");
|
|
29606
|
+
const systemMessageMode = isReasoningModel ? "developer" : "system";
|
|
29607
|
+
return {
|
|
29608
|
+
supportsFlexProcessing,
|
|
29609
|
+
supportsPriorityProcessing,
|
|
29610
|
+
isReasoningModel,
|
|
29611
|
+
systemMessageMode,
|
|
29612
|
+
supportsNonReasoningParameters
|
|
29613
|
+
};
|
|
29614
|
+
}
|
|
29464
29615
|
function convertToOpenAIChatMessages({
|
|
29465
29616
|
prompt,
|
|
29466
29617
|
systemMessageMode = "system"
|
|
@@ -29676,10 +29827,12 @@ var openaiChatResponseSchema = lazyValidator(() => zodSchema(exports_external.ob
|
|
|
29676
29827
|
})).nullish(),
|
|
29677
29828
|
annotations: exports_external.array(exports_external.object({
|
|
29678
29829
|
type: exports_external.literal("url_citation"),
|
|
29679
|
-
|
|
29680
|
-
|
|
29681
|
-
|
|
29682
|
-
|
|
29830
|
+
url_citation: exports_external.object({
|
|
29831
|
+
start_index: exports_external.number(),
|
|
29832
|
+
end_index: exports_external.number(),
|
|
29833
|
+
url: exports_external.string(),
|
|
29834
|
+
title: exports_external.string()
|
|
29835
|
+
})
|
|
29683
29836
|
})).nullish()
|
|
29684
29837
|
}),
|
|
29685
29838
|
index: exports_external.number(),
|
|
@@ -29729,10 +29882,12 @@ var openaiChatChunkSchema = lazyValidator(() => zodSchema(exports_external.union
|
|
|
29729
29882
|
})).nullish(),
|
|
29730
29883
|
annotations: exports_external.array(exports_external.object({
|
|
29731
29884
|
type: exports_external.literal("url_citation"),
|
|
29732
|
-
|
|
29733
|
-
|
|
29734
|
-
|
|
29735
|
-
|
|
29885
|
+
url_citation: exports_external.object({
|
|
29886
|
+
start_index: exports_external.number(),
|
|
29887
|
+
end_index: exports_external.number(),
|
|
29888
|
+
url: exports_external.string(),
|
|
29889
|
+
title: exports_external.string()
|
|
29890
|
+
})
|
|
29736
29891
|
})).nullish()
|
|
29737
29892
|
}).nullish(),
|
|
29738
29893
|
logprobs: exports_external.object({
|
|
@@ -29769,7 +29924,7 @@ var openaiChatLanguageModelOptions = lazyValidator(() => zodSchema(exports_exter
|
|
|
29769
29924
|
logprobs: exports_external.union([exports_external.boolean(), exports_external.number()]).optional(),
|
|
29770
29925
|
parallelToolCalls: exports_external.boolean().optional(),
|
|
29771
29926
|
user: exports_external.string().optional(),
|
|
29772
|
-
reasoningEffort: exports_external.enum(["none", "minimal", "low", "medium", "high"]).optional(),
|
|
29927
|
+
reasoningEffort: exports_external.enum(["none", "minimal", "low", "medium", "high", "xhigh"]).optional(),
|
|
29773
29928
|
maxCompletionTokens: exports_external.number().optional(),
|
|
29774
29929
|
store: exports_external.boolean().optional(),
|
|
29775
29930
|
metadata: exports_external.record(exports_external.string().max(64), exports_external.string().max(512)).optional(),
|
|
@@ -29794,21 +29949,21 @@ function prepareChatTools({
|
|
|
29794
29949
|
return { tools: undefined, toolChoice: undefined, toolWarnings };
|
|
29795
29950
|
}
|
|
29796
29951
|
const openaiTools2 = [];
|
|
29797
|
-
for (const
|
|
29798
|
-
switch (
|
|
29952
|
+
for (const tool3 of tools) {
|
|
29953
|
+
switch (tool3.type) {
|
|
29799
29954
|
case "function":
|
|
29800
29955
|
openaiTools2.push({
|
|
29801
29956
|
type: "function",
|
|
29802
29957
|
function: {
|
|
29803
|
-
name:
|
|
29804
|
-
description:
|
|
29805
|
-
parameters:
|
|
29958
|
+
name: tool3.name,
|
|
29959
|
+
description: tool3.description,
|
|
29960
|
+
parameters: tool3.inputSchema,
|
|
29806
29961
|
strict: structuredOutputs ? strictJsonSchema : undefined
|
|
29807
29962
|
}
|
|
29808
29963
|
});
|
|
29809
29964
|
break;
|
|
29810
29965
|
default:
|
|
29811
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
29966
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool3 });
|
|
29812
29967
|
break;
|
|
29813
29968
|
}
|
|
29814
29969
|
}
|
|
@@ -29875,6 +30030,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
29875
30030
|
schema: openaiChatLanguageModelOptions
|
|
29876
30031
|
})) != null ? _a16 : {};
|
|
29877
30032
|
const structuredOutputs = (_b9 = openaiOptions.structuredOutputs) != null ? _b9 : true;
|
|
30033
|
+
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
29878
30034
|
if (topK != null) {
|
|
29879
30035
|
warnings.push({
|
|
29880
30036
|
type: "unsupported-setting",
|
|
@@ -29890,7 +30046,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
29890
30046
|
}
|
|
29891
30047
|
const { messages, warnings: messageWarnings } = convertToOpenAIChatMessages({
|
|
29892
30048
|
prompt,
|
|
29893
|
-
systemMessageMode:
|
|
30049
|
+
systemMessageMode: modelCapabilities.systemMessageMode
|
|
29894
30050
|
});
|
|
29895
30051
|
warnings.push(...messageWarnings);
|
|
29896
30052
|
const strictJsonSchema = (_c = openaiOptions.strictJsonSchema) != null ? _c : false;
|
|
@@ -29929,22 +30085,31 @@ var OpenAIChatLanguageModel = class {
|
|
|
29929
30085
|
safety_identifier: openaiOptions.safetyIdentifier,
|
|
29930
30086
|
messages
|
|
29931
30087
|
};
|
|
29932
|
-
if (isReasoningModel
|
|
29933
|
-
if (
|
|
29934
|
-
baseArgs.temperature
|
|
29935
|
-
|
|
29936
|
-
|
|
29937
|
-
|
|
29938
|
-
|
|
29939
|
-
|
|
29940
|
-
|
|
29941
|
-
|
|
29942
|
-
baseArgs.top_p
|
|
29943
|
-
|
|
29944
|
-
|
|
29945
|
-
|
|
29946
|
-
|
|
29947
|
-
|
|
30088
|
+
if (modelCapabilities.isReasoningModel) {
|
|
30089
|
+
if (openaiOptions.reasoningEffort !== "none" || !modelCapabilities.supportsNonReasoningParameters) {
|
|
30090
|
+
if (baseArgs.temperature != null) {
|
|
30091
|
+
baseArgs.temperature = undefined;
|
|
30092
|
+
warnings.push({
|
|
30093
|
+
type: "unsupported-setting",
|
|
30094
|
+
setting: "temperature",
|
|
30095
|
+
details: "temperature is not supported for reasoning models"
|
|
30096
|
+
});
|
|
30097
|
+
}
|
|
30098
|
+
if (baseArgs.top_p != null) {
|
|
30099
|
+
baseArgs.top_p = undefined;
|
|
30100
|
+
warnings.push({
|
|
30101
|
+
type: "unsupported-setting",
|
|
30102
|
+
setting: "topP",
|
|
30103
|
+
details: "topP is not supported for reasoning models"
|
|
30104
|
+
});
|
|
30105
|
+
}
|
|
30106
|
+
if (baseArgs.logprobs != null) {
|
|
30107
|
+
baseArgs.logprobs = undefined;
|
|
30108
|
+
warnings.push({
|
|
30109
|
+
type: "other",
|
|
30110
|
+
message: "logprobs is not supported for reasoning models"
|
|
30111
|
+
});
|
|
30112
|
+
}
|
|
29948
30113
|
}
|
|
29949
30114
|
if (baseArgs.frequency_penalty != null) {
|
|
29950
30115
|
baseArgs.frequency_penalty = undefined;
|
|
@@ -29969,13 +30134,6 @@ var OpenAIChatLanguageModel = class {
|
|
|
29969
30134
|
message: "logitBias is not supported for reasoning models"
|
|
29970
30135
|
});
|
|
29971
30136
|
}
|
|
29972
|
-
if (baseArgs.logprobs != null) {
|
|
29973
|
-
baseArgs.logprobs = undefined;
|
|
29974
|
-
warnings.push({
|
|
29975
|
-
type: "other",
|
|
29976
|
-
message: "logprobs is not supported for reasoning models"
|
|
29977
|
-
});
|
|
29978
|
-
}
|
|
29979
30137
|
if (baseArgs.top_logprobs != null) {
|
|
29980
30138
|
baseArgs.top_logprobs = undefined;
|
|
29981
30139
|
warnings.push({
|
|
@@ -29999,7 +30157,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
29999
30157
|
});
|
|
30000
30158
|
}
|
|
30001
30159
|
}
|
|
30002
|
-
if (openaiOptions.serviceTier === "flex" && !supportsFlexProcessing
|
|
30160
|
+
if (openaiOptions.serviceTier === "flex" && !modelCapabilities.supportsFlexProcessing) {
|
|
30003
30161
|
warnings.push({
|
|
30004
30162
|
type: "unsupported-setting",
|
|
30005
30163
|
setting: "serviceTier",
|
|
@@ -30007,7 +30165,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
30007
30165
|
});
|
|
30008
30166
|
baseArgs.service_tier = undefined;
|
|
30009
30167
|
}
|
|
30010
|
-
if (openaiOptions.serviceTier === "priority" && !supportsPriorityProcessing
|
|
30168
|
+
if (openaiOptions.serviceTier === "priority" && !modelCapabilities.supportsPriorityProcessing) {
|
|
30011
30169
|
warnings.push({
|
|
30012
30170
|
type: "unsupported-setting",
|
|
30013
30171
|
setting: "serviceTier",
|
|
@@ -30072,8 +30230,8 @@ var OpenAIChatLanguageModel = class {
|
|
|
30072
30230
|
type: "source",
|
|
30073
30231
|
sourceType: "url",
|
|
30074
30232
|
id: generateId(),
|
|
30075
|
-
url: annotation.url,
|
|
30076
|
-
title: annotation.title
|
|
30233
|
+
url: annotation.url_citation.url,
|
|
30234
|
+
title: annotation.url_citation.title
|
|
30077
30235
|
});
|
|
30078
30236
|
}
|
|
30079
30237
|
const completionTokenDetails = (_d = response.usage) == null ? undefined : _d.completion_tokens_details;
|
|
@@ -30299,8 +30457,8 @@ var OpenAIChatLanguageModel = class {
|
|
|
30299
30457
|
type: "source",
|
|
30300
30458
|
sourceType: "url",
|
|
30301
30459
|
id: generateId(),
|
|
30302
|
-
url: annotation.url,
|
|
30303
|
-
title: annotation.title
|
|
30460
|
+
url: annotation.url_citation.url,
|
|
30461
|
+
title: annotation.url_citation.title
|
|
30304
30462
|
});
|
|
30305
30463
|
}
|
|
30306
30464
|
}
|
|
@@ -30322,42 +30480,6 @@ var OpenAIChatLanguageModel = class {
|
|
|
30322
30480
|
};
|
|
30323
30481
|
}
|
|
30324
30482
|
};
|
|
30325
|
-
function isReasoningModel(modelId) {
|
|
30326
|
-
return (modelId.startsWith("o") || modelId.startsWith("gpt-5")) && !modelId.startsWith("gpt-5-chat");
|
|
30327
|
-
}
|
|
30328
|
-
function supportsFlexProcessing(modelId) {
|
|
30329
|
-
return modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
30330
|
-
}
|
|
30331
|
-
function supportsPriorityProcessing(modelId) {
|
|
30332
|
-
return modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
30333
|
-
}
|
|
30334
|
-
function getSystemMessageMode(modelId) {
|
|
30335
|
-
var _a16, _b9;
|
|
30336
|
-
if (!isReasoningModel(modelId)) {
|
|
30337
|
-
return "system";
|
|
30338
|
-
}
|
|
30339
|
-
return (_b9 = (_a16 = reasoningModels[modelId]) == null ? undefined : _a16.systemMessageMode) != null ? _b9 : "developer";
|
|
30340
|
-
}
|
|
30341
|
-
var reasoningModels = {
|
|
30342
|
-
o3: {
|
|
30343
|
-
systemMessageMode: "developer"
|
|
30344
|
-
},
|
|
30345
|
-
"o3-2025-04-16": {
|
|
30346
|
-
systemMessageMode: "developer"
|
|
30347
|
-
},
|
|
30348
|
-
"o3-mini": {
|
|
30349
|
-
systemMessageMode: "developer"
|
|
30350
|
-
},
|
|
30351
|
-
"o3-mini-2025-01-31": {
|
|
30352
|
-
systemMessageMode: "developer"
|
|
30353
|
-
},
|
|
30354
|
-
"o4-mini": {
|
|
30355
|
-
systemMessageMode: "developer"
|
|
30356
|
-
},
|
|
30357
|
-
"o4-mini-2025-04-16": {
|
|
30358
|
-
systemMessageMode: "developer"
|
|
30359
|
-
}
|
|
30360
|
-
};
|
|
30361
30483
|
function convertToOpenAICompletionPrompt({
|
|
30362
30484
|
prompt,
|
|
30363
30485
|
user = "user",
|
|
@@ -30925,8 +31047,8 @@ var codeInterpreter = (args = {}) => {
|
|
|
30925
31047
|
};
|
|
30926
31048
|
var comparisonFilterSchema = exports_external.object({
|
|
30927
31049
|
key: exports_external.string(),
|
|
30928
|
-
type: exports_external.enum(["eq", "ne", "gt", "gte", "lt", "lte"]),
|
|
30929
|
-
value: exports_external.union([exports_external.string(), exports_external.number(), exports_external.boolean()])
|
|
31050
|
+
type: exports_external.enum(["eq", "ne", "gt", "gte", "lt", "lte", "in", "nin"]),
|
|
31051
|
+
value: exports_external.union([exports_external.string(), exports_external.number(), exports_external.boolean(), exports_external.array(exports_external.string())])
|
|
30930
31052
|
});
|
|
30931
31053
|
var compoundFilterSchema = exports_external.object({
|
|
30932
31054
|
type: exports_external.enum(["and", "or"]),
|
|
@@ -31024,7 +31146,7 @@ var webSearchOutputSchema = lazySchema(() => zodSchema(exports_external.object({
|
|
|
31024
31146
|
url: exports_external.string().nullish()
|
|
31025
31147
|
}),
|
|
31026
31148
|
exports_external.object({
|
|
31027
|
-
type: exports_external.literal("
|
|
31149
|
+
type: exports_external.literal("findInPage"),
|
|
31028
31150
|
url: exports_external.string().nullish(),
|
|
31029
31151
|
pattern: exports_external.string().nullish()
|
|
31030
31152
|
})
|
|
@@ -31063,7 +31185,7 @@ var webSearchPreviewOutputSchema = lazySchema(() => zodSchema(exports_external.o
|
|
|
31063
31185
|
url: exports_external.string().nullish()
|
|
31064
31186
|
}),
|
|
31065
31187
|
exports_external.object({
|
|
31066
|
-
type: exports_external.literal("
|
|
31188
|
+
type: exports_external.literal("findInPage"),
|
|
31067
31189
|
url: exports_external.string().nullish(),
|
|
31068
31190
|
pattern: exports_external.string().nullish()
|
|
31069
31191
|
})
|
|
@@ -31516,7 +31638,7 @@ var openaiResponsesChunkSchema = lazyValidator(() => zodSchema(exports_external.
|
|
|
31516
31638
|
url: exports_external.string().nullish()
|
|
31517
31639
|
}),
|
|
31518
31640
|
exports_external.object({
|
|
31519
|
-
type: exports_external.literal("
|
|
31641
|
+
type: exports_external.literal("find_in_page"),
|
|
31520
31642
|
url: exports_external.string().nullish(),
|
|
31521
31643
|
pattern: exports_external.string().nullish()
|
|
31522
31644
|
})
|
|
@@ -31708,7 +31830,7 @@ var openaiResponsesResponseSchema = lazyValidator(() => zodSchema(exports_extern
|
|
|
31708
31830
|
url: exports_external.string().nullish()
|
|
31709
31831
|
}),
|
|
31710
31832
|
exports_external.object({
|
|
31711
|
-
type: exports_external.literal("
|
|
31833
|
+
type: exports_external.literal("find_in_page"),
|
|
31712
31834
|
url: exports_external.string().nullish(),
|
|
31713
31835
|
pattern: exports_external.string().nullish()
|
|
31714
31836
|
})
|
|
@@ -31813,7 +31935,11 @@ var openaiResponsesReasoningModelIds = [
|
|
|
31813
31935
|
"gpt-5.1",
|
|
31814
31936
|
"gpt-5.1-chat-latest",
|
|
31815
31937
|
"gpt-5.1-codex-mini",
|
|
31816
|
-
"gpt-5.1-codex"
|
|
31938
|
+
"gpt-5.1-codex",
|
|
31939
|
+
"gpt-5.1-codex-max",
|
|
31940
|
+
"gpt-5.2",
|
|
31941
|
+
"gpt-5.2-chat-latest",
|
|
31942
|
+
"gpt-5.2-pro"
|
|
31817
31943
|
];
|
|
31818
31944
|
var openaiResponsesModelIds = [
|
|
31819
31945
|
"gpt-4.1",
|
|
@@ -31887,22 +32013,22 @@ async function prepareResponsesTools({
|
|
|
31887
32013
|
return { tools: undefined, toolChoice: undefined, toolWarnings };
|
|
31888
32014
|
}
|
|
31889
32015
|
const openaiTools2 = [];
|
|
31890
|
-
for (const
|
|
31891
|
-
switch (
|
|
32016
|
+
for (const tool3 of tools) {
|
|
32017
|
+
switch (tool3.type) {
|
|
31892
32018
|
case "function":
|
|
31893
32019
|
openaiTools2.push({
|
|
31894
32020
|
type: "function",
|
|
31895
|
-
name:
|
|
31896
|
-
description:
|
|
31897
|
-
parameters:
|
|
32021
|
+
name: tool3.name,
|
|
32022
|
+
description: tool3.description,
|
|
32023
|
+
parameters: tool3.inputSchema,
|
|
31898
32024
|
strict: strictJsonSchema
|
|
31899
32025
|
});
|
|
31900
32026
|
break;
|
|
31901
32027
|
case "provider-defined": {
|
|
31902
|
-
switch (
|
|
32028
|
+
switch (tool3.id) {
|
|
31903
32029
|
case "openai.file_search": {
|
|
31904
32030
|
const args = await validateTypes({
|
|
31905
|
-
value:
|
|
32031
|
+
value: tool3.args,
|
|
31906
32032
|
schema: fileSearchArgsSchema
|
|
31907
32033
|
});
|
|
31908
32034
|
openaiTools2.push({
|
|
@@ -31925,7 +32051,7 @@ async function prepareResponsesTools({
|
|
|
31925
32051
|
}
|
|
31926
32052
|
case "openai.web_search_preview": {
|
|
31927
32053
|
const args = await validateTypes({
|
|
31928
|
-
value:
|
|
32054
|
+
value: tool3.args,
|
|
31929
32055
|
schema: webSearchPreviewArgsSchema
|
|
31930
32056
|
});
|
|
31931
32057
|
openaiTools2.push({
|
|
@@ -31937,7 +32063,7 @@ async function prepareResponsesTools({
|
|
|
31937
32063
|
}
|
|
31938
32064
|
case "openai.web_search": {
|
|
31939
32065
|
const args = await validateTypes({
|
|
31940
|
-
value:
|
|
32066
|
+
value: tool3.args,
|
|
31941
32067
|
schema: webSearchArgsSchema
|
|
31942
32068
|
});
|
|
31943
32069
|
openaiTools2.push({
|
|
@@ -31951,7 +32077,7 @@ async function prepareResponsesTools({
|
|
|
31951
32077
|
}
|
|
31952
32078
|
case "openai.code_interpreter": {
|
|
31953
32079
|
const args = await validateTypes({
|
|
31954
|
-
value:
|
|
32080
|
+
value: tool3.args,
|
|
31955
32081
|
schema: codeInterpreterArgsSchema
|
|
31956
32082
|
});
|
|
31957
32083
|
openaiTools2.push({
|
|
@@ -31962,7 +32088,7 @@ async function prepareResponsesTools({
|
|
|
31962
32088
|
}
|
|
31963
32089
|
case "openai.image_generation": {
|
|
31964
32090
|
const args = await validateTypes({
|
|
31965
|
-
value:
|
|
32091
|
+
value: tool3.args,
|
|
31966
32092
|
schema: imageGenerationArgsSchema
|
|
31967
32093
|
});
|
|
31968
32094
|
openaiTools2.push({
|
|
@@ -31986,7 +32112,7 @@ async function prepareResponsesTools({
|
|
|
31986
32112
|
break;
|
|
31987
32113
|
}
|
|
31988
32114
|
default:
|
|
31989
|
-
toolWarnings.push({ type: "unsupported-tool", tool:
|
|
32115
|
+
toolWarnings.push({ type: "unsupported-tool", tool: tool3 });
|
|
31990
32116
|
break;
|
|
31991
32117
|
}
|
|
31992
32118
|
}
|
|
@@ -32043,7 +32169,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
32043
32169
|
}) {
|
|
32044
32170
|
var _a16, _b9, _c, _d;
|
|
32045
32171
|
const warnings = [];
|
|
32046
|
-
const
|
|
32172
|
+
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
32047
32173
|
if (topK != null) {
|
|
32048
32174
|
warnings.push({ type: "unsupported-setting", setting: "topK" });
|
|
32049
32175
|
}
|
|
@@ -32079,7 +32205,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
32079
32205
|
}
|
|
32080
32206
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
32081
32207
|
prompt,
|
|
32082
|
-
systemMessageMode:
|
|
32208
|
+
systemMessageMode: modelCapabilities.systemMessageMode,
|
|
32083
32209
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
32084
32210
|
store: (_a16 = openaiOptions == null ? undefined : openaiOptions.store) != null ? _a16 : true,
|
|
32085
32211
|
hasLocalShellTool: hasOpenAITool("openai.local_shell")
|
|
@@ -32095,13 +32221,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
32095
32221
|
}
|
|
32096
32222
|
}
|
|
32097
32223
|
function hasOpenAITool(id) {
|
|
32098
|
-
return (tools == null ? undefined : tools.find((
|
|
32224
|
+
return (tools == null ? undefined : tools.find((tool3) => tool3.type === "provider-defined" && tool3.id === id)) != null;
|
|
32099
32225
|
}
|
|
32100
32226
|
const topLogprobs = typeof (openaiOptions == null ? undefined : openaiOptions.logprobs) === "number" ? openaiOptions == null ? undefined : openaiOptions.logprobs : (openaiOptions == null ? undefined : openaiOptions.logprobs) === true ? TOP_LOGPROBS_MAX : undefined;
|
|
32101
32227
|
if (topLogprobs) {
|
|
32102
32228
|
addInclude("message.output_text.logprobs");
|
|
32103
32229
|
}
|
|
32104
|
-
const webSearchToolName = (_c = tools == null ? undefined : tools.find((
|
|
32230
|
+
const webSearchToolName = (_c = tools == null ? undefined : tools.find((tool3) => tool3.type === "provider-defined" && (tool3.id === "openai.web_search" || tool3.id === "openai.web_search_preview"))) == null ? undefined : _c.name;
|
|
32105
32231
|
if (webSearchToolName) {
|
|
32106
32232
|
addInclude("web_search_call.action.sources");
|
|
32107
32233
|
}
|
|
@@ -32109,7 +32235,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
32109
32235
|
addInclude("code_interpreter_call.outputs");
|
|
32110
32236
|
}
|
|
32111
32237
|
const store = openaiOptions == null ? undefined : openaiOptions.store;
|
|
32112
|
-
if (store === false &&
|
|
32238
|
+
if (store === false && modelCapabilities.isReasoningModel) {
|
|
32113
32239
|
addInclude("reasoning.encrypted_content");
|
|
32114
32240
|
}
|
|
32115
32241
|
const baseArgs = {
|
|
@@ -32149,7 +32275,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
32149
32275
|
safety_identifier: openaiOptions == null ? undefined : openaiOptions.safetyIdentifier,
|
|
32150
32276
|
top_logprobs: topLogprobs,
|
|
32151
32277
|
truncation: openaiOptions == null ? undefined : openaiOptions.truncation,
|
|
32152
|
-
...
|
|
32278
|
+
...modelCapabilities.isReasoningModel && ((openaiOptions == null ? undefined : openaiOptions.reasoningEffort) != null || (openaiOptions == null ? undefined : openaiOptions.reasoningSummary) != null) && {
|
|
32153
32279
|
reasoning: {
|
|
32154
32280
|
...(openaiOptions == null ? undefined : openaiOptions.reasoningEffort) != null && {
|
|
32155
32281
|
effort: openaiOptions.reasoningEffort
|
|
@@ -32160,22 +32286,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
32160
32286
|
}
|
|
32161
32287
|
}
|
|
32162
32288
|
};
|
|
32163
|
-
if (
|
|
32164
|
-
if (
|
|
32165
|
-
baseArgs.temperature
|
|
32166
|
-
|
|
32167
|
-
|
|
32168
|
-
|
|
32169
|
-
|
|
32170
|
-
|
|
32171
|
-
|
|
32172
|
-
|
|
32173
|
-
baseArgs.top_p
|
|
32174
|
-
|
|
32175
|
-
|
|
32176
|
-
|
|
32177
|
-
|
|
32178
|
-
|
|
32289
|
+
if (modelCapabilities.isReasoningModel) {
|
|
32290
|
+
if (!((openaiOptions == null ? undefined : openaiOptions.reasoningEffort) === "none" && modelCapabilities.supportsNonReasoningParameters)) {
|
|
32291
|
+
if (baseArgs.temperature != null) {
|
|
32292
|
+
baseArgs.temperature = undefined;
|
|
32293
|
+
warnings.push({
|
|
32294
|
+
type: "unsupported-setting",
|
|
32295
|
+
setting: "temperature",
|
|
32296
|
+
details: "temperature is not supported for reasoning models"
|
|
32297
|
+
});
|
|
32298
|
+
}
|
|
32299
|
+
if (baseArgs.top_p != null) {
|
|
32300
|
+
baseArgs.top_p = undefined;
|
|
32301
|
+
warnings.push({
|
|
32302
|
+
type: "unsupported-setting",
|
|
32303
|
+
setting: "topP",
|
|
32304
|
+
details: "topP is not supported for reasoning models"
|
|
32305
|
+
});
|
|
32306
|
+
}
|
|
32179
32307
|
}
|
|
32180
32308
|
} else {
|
|
32181
32309
|
if ((openaiOptions == null ? undefined : openaiOptions.reasoningEffort) != null) {
|
|
@@ -32193,7 +32321,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
32193
32321
|
});
|
|
32194
32322
|
}
|
|
32195
32323
|
}
|
|
32196
|
-
if ((openaiOptions == null ? undefined : openaiOptions.serviceTier) === "flex" && !
|
|
32324
|
+
if ((openaiOptions == null ? undefined : openaiOptions.serviceTier) === "flex" && !modelCapabilities.supportsFlexProcessing) {
|
|
32197
32325
|
warnings.push({
|
|
32198
32326
|
type: "unsupported-setting",
|
|
32199
32327
|
setting: "serviceTier",
|
|
@@ -32201,7 +32329,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
32201
32329
|
});
|
|
32202
32330
|
delete baseArgs.service_tier;
|
|
32203
32331
|
}
|
|
32204
|
-
if ((openaiOptions == null ? undefined : openaiOptions.serviceTier) === "priority" && !
|
|
32332
|
+
if ((openaiOptions == null ? undefined : openaiOptions.serviceTier) === "priority" && !modelCapabilities.supportsPriorityProcessing) {
|
|
32205
32333
|
warnings.push({
|
|
32206
32334
|
type: "unsupported-setting",
|
|
32207
32335
|
setting: "serviceTier",
|
|
@@ -33044,32 +33172,6 @@ function isResponseAnnotationAddedChunk(chunk) {
|
|
|
33044
33172
|
function isErrorChunk(chunk) {
|
|
33045
33173
|
return chunk.type === "error";
|
|
33046
33174
|
}
|
|
33047
|
-
function getResponsesModelConfig(modelId) {
|
|
33048
|
-
const supportsFlexProcessing2 = modelId.startsWith("o3") || modelId.startsWith("o4-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-chat");
|
|
33049
|
-
const supportsPriorityProcessing2 = modelId.startsWith("gpt-4") || modelId.startsWith("gpt-5-mini") || modelId.startsWith("gpt-5") && !modelId.startsWith("gpt-5-nano") && !modelId.startsWith("gpt-5-chat") || modelId.startsWith("o3") || modelId.startsWith("o4-mini");
|
|
33050
|
-
const defaults = {
|
|
33051
|
-
systemMessageMode: "system",
|
|
33052
|
-
supportsFlexProcessing: supportsFlexProcessing2,
|
|
33053
|
-
supportsPriorityProcessing: supportsPriorityProcessing2
|
|
33054
|
-
};
|
|
33055
|
-
if (modelId.startsWith("gpt-5-chat")) {
|
|
33056
|
-
return {
|
|
33057
|
-
...defaults,
|
|
33058
|
-
isReasoningModel: false
|
|
33059
|
-
};
|
|
33060
|
-
}
|
|
33061
|
-
if (modelId.startsWith("o") || modelId.startsWith("gpt-5") || modelId.startsWith("codex-") || modelId.startsWith("computer-use")) {
|
|
33062
|
-
return {
|
|
33063
|
-
...defaults,
|
|
33064
|
-
isReasoningModel: true,
|
|
33065
|
-
systemMessageMode: "developer"
|
|
33066
|
-
};
|
|
33067
|
-
}
|
|
33068
|
-
return {
|
|
33069
|
-
...defaults,
|
|
33070
|
-
isReasoningModel: false
|
|
33071
|
-
};
|
|
33072
|
-
}
|
|
33073
33175
|
function mapWebSearchOutput(action) {
|
|
33074
33176
|
var _a16;
|
|
33075
33177
|
switch (action.type) {
|
|
@@ -33080,9 +33182,13 @@ function mapWebSearchOutput(action) {
|
|
|
33080
33182
|
};
|
|
33081
33183
|
case "open_page":
|
|
33082
33184
|
return { action: { type: "openPage", url: action.url } };
|
|
33083
|
-
case "
|
|
33185
|
+
case "find_in_page":
|
|
33084
33186
|
return {
|
|
33085
|
-
action: {
|
|
33187
|
+
action: {
|
|
33188
|
+
type: "findInPage",
|
|
33189
|
+
url: action.url,
|
|
33190
|
+
pattern: action.pattern
|
|
33191
|
+
}
|
|
33086
33192
|
};
|
|
33087
33193
|
}
|
|
33088
33194
|
}
|
|
@@ -33375,7 +33481,7 @@ var OpenAITranscriptionModel = class {
|
|
|
33375
33481
|
};
|
|
33376
33482
|
}
|
|
33377
33483
|
};
|
|
33378
|
-
var VERSION6 = "2.0.
|
|
33484
|
+
var VERSION6 = "2.0.86";
|
|
33379
33485
|
function createOpenAI(options = {}) {
|
|
33380
33486
|
var _a16, _b9;
|
|
33381
33487
|
const baseURL = (_a16 = withoutTrailingSlash(loadOptionalSetting({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyd-js/ask-ai-edge",
|
|
3
|
-
"version": "0.0.0-build-
|
|
3
|
+
"version": "0.0.0-build-8a0317f-20251214165542",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xyd-js/ask-ai": "0.0.0-build-
|
|
13
|
+
"@xyd-js/ask-ai": "0.0.0-build-8a0317f-20251214165542"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "bun build index.ts --outdir dist --target node --format esm"
|