@openrouter/ai-sdk-provider 1.0.0-beta.4 → 1.0.0-beta.6
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 +34 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -36
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +60 -62
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +60 -62
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -447,28 +447,28 @@ var EventSourceParserStream = class extends TransformStream {
|
|
|
447
447
|
}
|
|
448
448
|
};
|
|
449
449
|
|
|
450
|
-
// node_modules/.pnpm/@ai-sdk+provider-utils@3.0.0-beta.5_zod@
|
|
450
|
+
// node_modules/.pnpm/@ai-sdk+provider-utils@3.0.0-beta.5_zod@3.25.76/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
451
451
|
var z4 = __toESM(require("zod/v4"), 1);
|
|
452
452
|
|
|
453
|
-
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@
|
|
453
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
454
454
|
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
455
455
|
|
|
456
|
-
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@
|
|
456
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
457
457
|
var import_zod4 = require("zod");
|
|
458
458
|
|
|
459
|
-
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@
|
|
459
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
|
|
460
460
|
var import_zod = require("zod");
|
|
461
461
|
|
|
462
|
-
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@
|
|
462
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
463
463
|
var import_zod2 = require("zod");
|
|
464
464
|
|
|
465
|
-
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@
|
|
465
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
466
466
|
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
467
467
|
|
|
468
|
-
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@
|
|
468
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
469
469
|
var import_zod3 = require("zod");
|
|
470
470
|
|
|
471
|
-
// node_modules/.pnpm/@ai-sdk+provider-utils@3.0.0-beta.5_zod@
|
|
471
|
+
// node_modules/.pnpm/@ai-sdk+provider-utils@3.0.0-beta.5_zod@3.25.76/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
472
472
|
function combineHeaders(...headers) {
|
|
473
473
|
return headers.reduce(
|
|
474
474
|
(combinedHeaders, currentHeaders) => __spreadValues(__spreadValues({}, combinedHeaders), currentHeaders != null ? currentHeaders : {}),
|
|
@@ -1440,15 +1440,13 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1440
1440
|
cachedInputTokens: 0
|
|
1441
1441
|
};
|
|
1442
1442
|
const reasoningDetails = (_i = choice.message.reasoning_details) != null ? _i : [];
|
|
1443
|
-
reasoningDetails.length > 0 ? reasoningDetails.map((detail) => {
|
|
1444
|
-
var _a16;
|
|
1443
|
+
const reasoning = reasoningDetails.length > 0 ? reasoningDetails.map((detail) => {
|
|
1445
1444
|
switch (detail.type) {
|
|
1446
1445
|
case "reasoning.text" /* Text */: {
|
|
1447
1446
|
if (detail.text) {
|
|
1448
1447
|
return {
|
|
1449
|
-
type: "
|
|
1450
|
-
text: detail.text
|
|
1451
|
-
signature: (_a16 = detail.signature) != null ? _a16 : void 0
|
|
1448
|
+
type: "reasoning",
|
|
1449
|
+
text: detail.text
|
|
1452
1450
|
};
|
|
1453
1451
|
}
|
|
1454
1452
|
break;
|
|
@@ -1456,7 +1454,7 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1456
1454
|
case "reasoning.summary" /* Summary */: {
|
|
1457
1455
|
if (detail.summary) {
|
|
1458
1456
|
return {
|
|
1459
|
-
type: "
|
|
1457
|
+
type: "reasoning",
|
|
1460
1458
|
text: detail.summary
|
|
1461
1459
|
};
|
|
1462
1460
|
}
|
|
@@ -1465,8 +1463,8 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1465
1463
|
case "reasoning.encrypted" /* Encrypted */: {
|
|
1466
1464
|
if (detail.data) {
|
|
1467
1465
|
return {
|
|
1468
|
-
type: "
|
|
1469
|
-
|
|
1466
|
+
type: "reasoning",
|
|
1467
|
+
text: "[REDACTED]"
|
|
1470
1468
|
};
|
|
1471
1469
|
}
|
|
1472
1470
|
break;
|
|
@@ -1478,11 +1476,12 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1478
1476
|
return null;
|
|
1479
1477
|
}).filter((p) => p !== null) : choice.message.reasoning ? [
|
|
1480
1478
|
{
|
|
1481
|
-
type: "
|
|
1479
|
+
type: "reasoning",
|
|
1482
1480
|
text: choice.message.reasoning
|
|
1483
1481
|
}
|
|
1484
1482
|
] : [];
|
|
1485
1483
|
const content = [];
|
|
1484
|
+
content.push(...reasoning);
|
|
1486
1485
|
if (choice.message.content) {
|
|
1487
1486
|
content.push({
|
|
1488
1487
|
type: "text",
|
|
@@ -1631,21 +1630,6 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1631
1630
|
return;
|
|
1632
1631
|
}
|
|
1633
1632
|
const delta = choice.delta;
|
|
1634
|
-
if (delta.content != null) {
|
|
1635
|
-
if (!textStarted) {
|
|
1636
|
-
textId = openrouterResponseId || generateId();
|
|
1637
|
-
controller.enqueue({
|
|
1638
|
-
type: "text-start",
|
|
1639
|
-
id: textId
|
|
1640
|
-
});
|
|
1641
|
-
textStarted = true;
|
|
1642
|
-
}
|
|
1643
|
-
controller.enqueue({
|
|
1644
|
-
type: "text-delta",
|
|
1645
|
-
delta: delta.content,
|
|
1646
|
-
id: textId || generateId()
|
|
1647
|
-
});
|
|
1648
|
-
}
|
|
1649
1633
|
const emitReasoningChunk = (chunkText) => {
|
|
1650
1634
|
if (!reasoningStarted) {
|
|
1651
1635
|
reasoningId = openrouterResponseId || generateId();
|
|
@@ -1661,9 +1645,6 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1661
1645
|
id: reasoningId || generateId()
|
|
1662
1646
|
});
|
|
1663
1647
|
};
|
|
1664
|
-
if (delta.reasoning != null) {
|
|
1665
|
-
emitReasoningChunk(delta.reasoning);
|
|
1666
|
-
}
|
|
1667
1648
|
if (delta.reasoning_details && delta.reasoning_details.length > 0) {
|
|
1668
1649
|
for (const detail of delta.reasoning_details) {
|
|
1669
1650
|
switch (detail.type) {
|
|
@@ -1691,6 +1672,23 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1691
1672
|
}
|
|
1692
1673
|
}
|
|
1693
1674
|
}
|
|
1675
|
+
} else if (delta.reasoning != null) {
|
|
1676
|
+
emitReasoningChunk(delta.reasoning);
|
|
1677
|
+
}
|
|
1678
|
+
if (delta.content != null) {
|
|
1679
|
+
if (!textStarted) {
|
|
1680
|
+
textId = openrouterResponseId || generateId();
|
|
1681
|
+
controller.enqueue({
|
|
1682
|
+
type: "text-start",
|
|
1683
|
+
id: textId
|
|
1684
|
+
});
|
|
1685
|
+
textStarted = true;
|
|
1686
|
+
}
|
|
1687
|
+
controller.enqueue({
|
|
1688
|
+
type: "text-delta",
|
|
1689
|
+
delta: delta.content,
|
|
1690
|
+
id: textId || generateId()
|
|
1691
|
+
});
|
|
1694
1692
|
}
|
|
1695
1693
|
if (delta.tool_calls != null) {
|
|
1696
1694
|
for (const toolCallDelta of delta.tool_calls) {
|
|
@@ -1790,7 +1788,7 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1790
1788
|
var _a16;
|
|
1791
1789
|
if (finishReason === "tool-calls") {
|
|
1792
1790
|
for (const toolCall of toolCalls) {
|
|
1793
|
-
if (!toolCall.sent) {
|
|
1791
|
+
if (toolCall && !toolCall.sent) {
|
|
1794
1792
|
controller.enqueue({
|
|
1795
1793
|
type: "tool-call",
|
|
1796
1794
|
toolCallId: (_a16 = toolCall.id) != null ? _a16 : generateId(),
|