@openrouter/ai-sdk-provider 1.5.0 → 1.5.2
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 +15 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -2
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +14 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +14 -1
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1849,9 +1849,15 @@ var OpenRouterChatLanguageModel = class {
|
|
|
1849
1849
|
const fileAnnotations = (_k = choice.message.annotations) == null ? void 0 : _k.filter(
|
|
1850
1850
|
(a) => a.type === "file"
|
|
1851
1851
|
);
|
|
1852
|
+
const hasToolCalls = choice.message.tool_calls && choice.message.tool_calls.length > 0;
|
|
1853
|
+
const hasEncryptedReasoning = reasoningDetails.some(
|
|
1854
|
+
(d) => d.type === "reasoning.encrypted" /* Encrypted */ && d.data
|
|
1855
|
+
);
|
|
1856
|
+
const shouldOverrideFinishReason = hasToolCalls && hasEncryptedReasoning && choice.finish_reason === "stop";
|
|
1857
|
+
const effectiveFinishReason = shouldOverrideFinishReason ? "tool-calls" : mapOpenRouterFinishReason(choice.finish_reason);
|
|
1852
1858
|
return {
|
|
1853
1859
|
content,
|
|
1854
|
-
finishReason:
|
|
1860
|
+
finishReason: effectiveFinishReason,
|
|
1855
1861
|
usage: usageInfo,
|
|
1856
1862
|
warnings: [],
|
|
1857
1863
|
providerMetadata: {
|
|
@@ -2229,6 +2235,13 @@ var OpenRouterChatLanguageModel = class {
|
|
|
2229
2235
|
},
|
|
2230
2236
|
flush(controller) {
|
|
2231
2237
|
var _a16;
|
|
2238
|
+
const hasToolCalls = toolCalls.length > 0;
|
|
2239
|
+
const hasEncryptedReasoning = accumulatedReasoningDetails.some(
|
|
2240
|
+
(d) => d.type === "reasoning.encrypted" /* Encrypted */ && d.data
|
|
2241
|
+
);
|
|
2242
|
+
if (hasToolCalls && hasEncryptedReasoning && finishReason === "stop") {
|
|
2243
|
+
finishReason = "tool-calls";
|
|
2244
|
+
}
|
|
2232
2245
|
if (finishReason === "tool-calls") {
|
|
2233
2246
|
for (const toolCall of toolCalls) {
|
|
2234
2247
|
if (toolCall && !toolCall.sent) {
|
|
@@ -2820,7 +2833,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
2820
2833
|
}
|
|
2821
2834
|
|
|
2822
2835
|
// src/version.ts
|
|
2823
|
-
var VERSION = false ? "0.0.0-test" : "1.5.
|
|
2836
|
+
var VERSION = false ? "0.0.0-test" : "1.5.2";
|
|
2824
2837
|
|
|
2825
2838
|
// src/provider.ts
|
|
2826
2839
|
function createOpenRouter(options = {}) {
|