@openrouter/ai-sdk-provider 2.4.2 → 2.4.3
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 +30 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +29 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +29 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3863,6 +3863,13 @@ var OpenRouterChatLanguageModel = class {
|
|
|
3863
3863
|
id: toolCall.id,
|
|
3864
3864
|
toolName: toolCall.function.name
|
|
3865
3865
|
});
|
|
3866
|
+
if (toolCall.function.arguments) {
|
|
3867
|
+
controller.enqueue({
|
|
3868
|
+
type: "tool-input-delta",
|
|
3869
|
+
id: toolCall.id,
|
|
3870
|
+
delta: toolCall.function.arguments
|
|
3871
|
+
});
|
|
3872
|
+
}
|
|
3866
3873
|
}
|
|
3867
3874
|
if (((_o = toolCallDelta.function) == null ? void 0 : _o.arguments) != null) {
|
|
3868
3875
|
toolCall.function.arguments += (_q = (_p = toolCallDelta.function) == null ? void 0 : _p.arguments) != null ? _q : "";
|
|
@@ -3873,6 +3880,10 @@ var OpenRouterChatLanguageModel = class {
|
|
|
3873
3880
|
delta: (_r = toolCallDelta.function.arguments) != null ? _r : ""
|
|
3874
3881
|
});
|
|
3875
3882
|
if (((_s = toolCall.function) == null ? void 0 : _s.name) != null && ((_t = toolCall.function) == null ? void 0 : _t.arguments) != null && isParsableJson(toolCall.function.arguments)) {
|
|
3883
|
+
controller.enqueue({
|
|
3884
|
+
type: "tool-input-end",
|
|
3885
|
+
id: toolCall.id
|
|
3886
|
+
});
|
|
3876
3887
|
controller.enqueue({
|
|
3877
3888
|
type: "tool-call",
|
|
3878
3889
|
toolCallId: (_u = toolCall.id) != null ? _u : generateId(),
|
|
@@ -3918,12 +3929,28 @@ var OpenRouterChatLanguageModel = class {
|
|
|
3918
3929
|
if (finishReason.unified === "tool-calls") {
|
|
3919
3930
|
for (const toolCall of toolCalls) {
|
|
3920
3931
|
if (toolCall && !toolCall.sent) {
|
|
3932
|
+
const input = isParsableJson(toolCall.function.arguments) ? toolCall.function.arguments : "{}";
|
|
3933
|
+
if (!toolCall.inputStarted) {
|
|
3934
|
+
controller.enqueue({
|
|
3935
|
+
type: "tool-input-start",
|
|
3936
|
+
id: toolCall.id,
|
|
3937
|
+
toolName: toolCall.function.name
|
|
3938
|
+
});
|
|
3939
|
+
controller.enqueue({
|
|
3940
|
+
type: "tool-input-delta",
|
|
3941
|
+
id: toolCall.id,
|
|
3942
|
+
delta: input
|
|
3943
|
+
});
|
|
3944
|
+
}
|
|
3945
|
+
controller.enqueue({
|
|
3946
|
+
type: "tool-input-end",
|
|
3947
|
+
id: toolCall.id
|
|
3948
|
+
});
|
|
3921
3949
|
controller.enqueue({
|
|
3922
3950
|
type: "tool-call",
|
|
3923
3951
|
toolCallId: (_a17 = toolCall.id) != null ? _a17 : generateId(),
|
|
3924
3952
|
toolName: toolCall.function.name,
|
|
3925
|
-
|
|
3926
|
-
input: isParsableJson(toolCall.function.arguments) ? toolCall.function.arguments : "{}",
|
|
3953
|
+
input,
|
|
3927
3954
|
providerMetadata: !reasoningDetailsAttachedToToolCall ? {
|
|
3928
3955
|
openrouter: {
|
|
3929
3956
|
reasoning_details: accumulatedReasoningDetails
|
|
@@ -4753,7 +4780,7 @@ function withUserAgentSuffix2(headers, ...userAgentSuffixParts) {
|
|
|
4753
4780
|
}
|
|
4754
4781
|
|
|
4755
4782
|
// src/version.ts
|
|
4756
|
-
var VERSION2 = false ? "0.0.0-test" : "2.4.
|
|
4783
|
+
var VERSION2 = false ? "0.0.0-test" : "2.4.3";
|
|
4757
4784
|
|
|
4758
4785
|
// src/provider.ts
|
|
4759
4786
|
function createOpenRouter(options = {}) {
|