@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.mjs
CHANGED
|
@@ -412,28 +412,28 @@ var EventSourceParserStream = class extends TransformStream {
|
|
|
412
412
|
}
|
|
413
413
|
};
|
|
414
414
|
|
|
415
|
-
// node_modules/.pnpm/@ai-sdk+provider-utils@3.0.0-beta.5_zod@
|
|
415
|
+
// 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
|
|
416
416
|
import * as z4 from "zod/v4";
|
|
417
417
|
|
|
418
|
-
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@
|
|
418
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
419
419
|
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
420
420
|
|
|
421
|
-
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@
|
|
421
|
+
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
422
422
|
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod";
|
|
423
423
|
|
|
424
|
-
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@
|
|
424
|
+
// 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
|
|
425
425
|
import { ZodFirstPartyTypeKind } from "zod";
|
|
426
426
|
|
|
427
|
-
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@
|
|
427
|
+
// 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
|
|
428
428
|
import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod";
|
|
429
429
|
|
|
430
|
-
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@
|
|
430
|
+
// 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
|
|
431
431
|
var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
432
432
|
|
|
433
|
-
// node_modules/.pnpm/zod-to-json-schema@3.24.5_zod@
|
|
433
|
+
// 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
|
|
434
434
|
import { ZodOptional } from "zod";
|
|
435
435
|
|
|
436
|
-
// node_modules/.pnpm/@ai-sdk+provider-utils@3.0.0-beta.5_zod@
|
|
436
|
+
// 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
|
|
437
437
|
function combineHeaders(...headers) {
|
|
438
438
|
return headers.reduce(
|
|
439
439
|
(combinedHeaders, currentHeaders) => __spreadValues(__spreadValues({}, combinedHeaders), currentHeaders != null ? currentHeaders : {}),
|
|
@@ -1405,15 +1405,13 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1405
1405
|
cachedInputTokens: 0
|
|
1406
1406
|
};
|
|
1407
1407
|
const reasoningDetails = (_i = choice.message.reasoning_details) != null ? _i : [];
|
|
1408
|
-
reasoningDetails.length > 0 ? reasoningDetails.map((detail) => {
|
|
1409
|
-
var _a16;
|
|
1408
|
+
const reasoning = reasoningDetails.length > 0 ? reasoningDetails.map((detail) => {
|
|
1410
1409
|
switch (detail.type) {
|
|
1411
1410
|
case "reasoning.text" /* Text */: {
|
|
1412
1411
|
if (detail.text) {
|
|
1413
1412
|
return {
|
|
1414
|
-
type: "
|
|
1415
|
-
text: detail.text
|
|
1416
|
-
signature: (_a16 = detail.signature) != null ? _a16 : void 0
|
|
1413
|
+
type: "reasoning",
|
|
1414
|
+
text: detail.text
|
|
1417
1415
|
};
|
|
1418
1416
|
}
|
|
1419
1417
|
break;
|
|
@@ -1421,7 +1419,7 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1421
1419
|
case "reasoning.summary" /* Summary */: {
|
|
1422
1420
|
if (detail.summary) {
|
|
1423
1421
|
return {
|
|
1424
|
-
type: "
|
|
1422
|
+
type: "reasoning",
|
|
1425
1423
|
text: detail.summary
|
|
1426
1424
|
};
|
|
1427
1425
|
}
|
|
@@ -1430,8 +1428,8 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1430
1428
|
case "reasoning.encrypted" /* Encrypted */: {
|
|
1431
1429
|
if (detail.data) {
|
|
1432
1430
|
return {
|
|
1433
|
-
type: "
|
|
1434
|
-
|
|
1431
|
+
type: "reasoning",
|
|
1432
|
+
text: "[REDACTED]"
|
|
1435
1433
|
};
|
|
1436
1434
|
}
|
|
1437
1435
|
break;
|
|
@@ -1443,11 +1441,12 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1443
1441
|
return null;
|
|
1444
1442
|
}).filter((p) => p !== null) : choice.message.reasoning ? [
|
|
1445
1443
|
{
|
|
1446
|
-
type: "
|
|
1444
|
+
type: "reasoning",
|
|
1447
1445
|
text: choice.message.reasoning
|
|
1448
1446
|
}
|
|
1449
1447
|
] : [];
|
|
1450
1448
|
const content = [];
|
|
1449
|
+
content.push(...reasoning);
|
|
1451
1450
|
if (choice.message.content) {
|
|
1452
1451
|
content.push({
|
|
1453
1452
|
type: "text",
|
|
@@ -1596,21 +1595,6 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1596
1595
|
return;
|
|
1597
1596
|
}
|
|
1598
1597
|
const delta = choice.delta;
|
|
1599
|
-
if (delta.content != null) {
|
|
1600
|
-
if (!textStarted) {
|
|
1601
|
-
textId = openrouterResponseId || generateId();
|
|
1602
|
-
controller.enqueue({
|
|
1603
|
-
type: "text-start",
|
|
1604
|
-
id: textId
|
|
1605
|
-
});
|
|
1606
|
-
textStarted = true;
|
|
1607
|
-
}
|
|
1608
|
-
controller.enqueue({
|
|
1609
|
-
type: "text-delta",
|
|
1610
|
-
delta: delta.content,
|
|
1611
|
-
id: textId || generateId()
|
|
1612
|
-
});
|
|
1613
|
-
}
|
|
1614
1598
|
const emitReasoningChunk = (chunkText) => {
|
|
1615
1599
|
if (!reasoningStarted) {
|
|
1616
1600
|
reasoningId = openrouterResponseId || generateId();
|
|
@@ -1626,9 +1610,6 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1626
1610
|
id: reasoningId || generateId()
|
|
1627
1611
|
});
|
|
1628
1612
|
};
|
|
1629
|
-
if (delta.reasoning != null) {
|
|
1630
|
-
emitReasoningChunk(delta.reasoning);
|
|
1631
|
-
}
|
|
1632
1613
|
if (delta.reasoning_details && delta.reasoning_details.length > 0) {
|
|
1633
1614
|
for (const detail of delta.reasoning_details) {
|
|
1634
1615
|
switch (detail.type) {
|
|
@@ -1656,6 +1637,23 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1656
1637
|
}
|
|
1657
1638
|
}
|
|
1658
1639
|
}
|
|
1640
|
+
} else if (delta.reasoning != null) {
|
|
1641
|
+
emitReasoningChunk(delta.reasoning);
|
|
1642
|
+
}
|
|
1643
|
+
if (delta.content != null) {
|
|
1644
|
+
if (!textStarted) {
|
|
1645
|
+
textId = openrouterResponseId || generateId();
|
|
1646
|
+
controller.enqueue({
|
|
1647
|
+
type: "text-start",
|
|
1648
|
+
id: textId
|
|
1649
|
+
});
|
|
1650
|
+
textStarted = true;
|
|
1651
|
+
}
|
|
1652
|
+
controller.enqueue({
|
|
1653
|
+
type: "text-delta",
|
|
1654
|
+
delta: delta.content,
|
|
1655
|
+
id: textId || generateId()
|
|
1656
|
+
});
|
|
1659
1657
|
}
|
|
1660
1658
|
if (delta.tool_calls != null) {
|
|
1661
1659
|
for (const toolCallDelta of delta.tool_calls) {
|
|
@@ -1755,7 +1753,7 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1755
1753
|
var _a16;
|
|
1756
1754
|
if (finishReason === "tool-calls") {
|
|
1757
1755
|
for (const toolCall of toolCalls) {
|
|
1758
|
-
if (!toolCall.sent) {
|
|
1756
|
+
if (toolCall && !toolCall.sent) {
|
|
1759
1757
|
controller.enqueue({
|
|
1760
1758
|
type: "tool-call",
|
|
1761
1759
|
toolCallId: (_a16 = toolCall.id) != null ? _a16 : generateId(),
|