@openrouter/ai-sdk-provider 1.0.0-beta.5 → 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 +18 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -19
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +18 -19
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +18 -19
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1595,21 +1595,6 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1595
1595
|
return;
|
|
1596
1596
|
}
|
|
1597
1597
|
const delta = choice.delta;
|
|
1598
|
-
if (delta.content != null) {
|
|
1599
|
-
if (!textStarted) {
|
|
1600
|
-
textId = openrouterResponseId || generateId();
|
|
1601
|
-
controller.enqueue({
|
|
1602
|
-
type: "text-start",
|
|
1603
|
-
id: textId
|
|
1604
|
-
});
|
|
1605
|
-
textStarted = true;
|
|
1606
|
-
}
|
|
1607
|
-
controller.enqueue({
|
|
1608
|
-
type: "text-delta",
|
|
1609
|
-
delta: delta.content,
|
|
1610
|
-
id: textId || generateId()
|
|
1611
|
-
});
|
|
1612
|
-
}
|
|
1613
1598
|
const emitReasoningChunk = (chunkText) => {
|
|
1614
1599
|
if (!reasoningStarted) {
|
|
1615
1600
|
reasoningId = openrouterResponseId || generateId();
|
|
@@ -1625,9 +1610,6 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1625
1610
|
id: reasoningId || generateId()
|
|
1626
1611
|
});
|
|
1627
1612
|
};
|
|
1628
|
-
if (delta.reasoning != null) {
|
|
1629
|
-
emitReasoningChunk(delta.reasoning);
|
|
1630
|
-
}
|
|
1631
1613
|
if (delta.reasoning_details && delta.reasoning_details.length > 0) {
|
|
1632
1614
|
for (const detail of delta.reasoning_details) {
|
|
1633
1615
|
switch (detail.type) {
|
|
@@ -1655,6 +1637,23 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1655
1637
|
}
|
|
1656
1638
|
}
|
|
1657
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
|
+
});
|
|
1658
1657
|
}
|
|
1659
1658
|
if (delta.tool_calls != null) {
|
|
1660
1659
|
for (const toolCallDelta of delta.tool_calls) {
|
|
@@ -1754,7 +1753,7 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1754
1753
|
var _a16;
|
|
1755
1754
|
if (finishReason === "tool-calls") {
|
|
1756
1755
|
for (const toolCall of toolCalls) {
|
|
1757
|
-
if (!toolCall.sent) {
|
|
1756
|
+
if (toolCall && !toolCall.sent) {
|
|
1758
1757
|
controller.enqueue({
|
|
1759
1758
|
type: "tool-call",
|
|
1760
1759
|
toolCallId: (_a16 = toolCall.id) != null ? _a16 : generateId(),
|