@ai-sdk/openai
Advanced tools
Comparing version 0.0.20 to 0.0.21
@@ -315,3 +315,3 @@ "use strict"; | ||
transform(chunk, controller) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _i; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l; | ||
if (!chunk.success) { | ||
@@ -386,7 +386,24 @@ finishReason = "error"; | ||
}; | ||
const toolCall2 = toolCalls[index]; | ||
if (((_c = toolCall2.function) == null ? void 0 : _c.name) != null && ((_d = toolCall2.function) == null ? void 0 : _d.arguments) != null && (0, import_provider_utils3.isParsableJson)(toolCall2.function.arguments)) { | ||
controller.enqueue({ | ||
type: "tool-call-delta", | ||
toolCallType: "function", | ||
toolCallId: toolCall2.id, | ||
toolName: toolCall2.function.name, | ||
argsTextDelta: toolCall2.function.arguments | ||
}); | ||
controller.enqueue({ | ||
type: "tool-call", | ||
toolCallType: "function", | ||
toolCallId: (_e = toolCall2.id) != null ? _e : (0, import_provider_utils3.generateId)(), | ||
toolName: toolCall2.function.name, | ||
args: toolCall2.function.arguments | ||
}); | ||
} | ||
continue; | ||
} | ||
const toolCall = toolCalls[index]; | ||
if (((_c = toolCallDelta.function) == null ? void 0 : _c.arguments) != null) { | ||
toolCall.function.arguments += (_e = (_d = toolCallDelta.function) == null ? void 0 : _d.arguments) != null ? _e : ""; | ||
if (((_f = toolCallDelta.function) == null ? void 0 : _f.arguments) != null) { | ||
toolCall.function.arguments += (_h = (_g = toolCallDelta.function) == null ? void 0 : _g.arguments) != null ? _h : ""; | ||
} | ||
@@ -398,14 +415,13 @@ controller.enqueue({ | ||
toolName: toolCall.function.name, | ||
argsTextDelta: (_f = toolCallDelta.function.arguments) != null ? _f : "" | ||
argsTextDelta: (_i = toolCallDelta.function.arguments) != null ? _i : "" | ||
}); | ||
if (((_g = toolCall.function) == null ? void 0 : _g.name) == null || ((_h = toolCall.function) == null ? void 0 : _h.arguments) == null || !(0, import_provider_utils3.isParseableJson)(toolCall.function.arguments)) { | ||
continue; | ||
if (((_j = toolCall.function) == null ? void 0 : _j.name) != null && ((_k = toolCall.function) == null ? void 0 : _k.arguments) != null && (0, import_provider_utils3.isParsableJson)(toolCall.function.arguments)) { | ||
controller.enqueue({ | ||
type: "tool-call", | ||
toolCallType: "function", | ||
toolCallId: (_l = toolCall.id) != null ? _l : (0, import_provider_utils3.generateId)(), | ||
toolName: toolCall.function.name, | ||
args: toolCall.function.arguments | ||
}); | ||
} | ||
controller.enqueue({ | ||
type: "tool-call", | ||
toolCallType: "function", | ||
toolCallId: (_i = toolCall.id) != null ? _i : (0, import_provider_utils3.generateId)(), | ||
toolName: toolCall.function.name, | ||
args: toolCall.function.arguments | ||
}); | ||
} | ||
@@ -412,0 +428,0 @@ } |
@@ -315,3 +315,3 @@ "use strict"; | ||
transform(chunk, controller) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _i; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l; | ||
if (!chunk.success) { | ||
@@ -386,7 +386,24 @@ finishReason = "error"; | ||
}; | ||
const toolCall2 = toolCalls[index]; | ||
if (((_c = toolCall2.function) == null ? void 0 : _c.name) != null && ((_d = toolCall2.function) == null ? void 0 : _d.arguments) != null && (0, import_provider_utils3.isParsableJson)(toolCall2.function.arguments)) { | ||
controller.enqueue({ | ||
type: "tool-call-delta", | ||
toolCallType: "function", | ||
toolCallId: toolCall2.id, | ||
toolName: toolCall2.function.name, | ||
argsTextDelta: toolCall2.function.arguments | ||
}); | ||
controller.enqueue({ | ||
type: "tool-call", | ||
toolCallType: "function", | ||
toolCallId: (_e = toolCall2.id) != null ? _e : (0, import_provider_utils3.generateId)(), | ||
toolName: toolCall2.function.name, | ||
args: toolCall2.function.arguments | ||
}); | ||
} | ||
continue; | ||
} | ||
const toolCall = toolCalls[index]; | ||
if (((_c = toolCallDelta.function) == null ? void 0 : _c.arguments) != null) { | ||
toolCall.function.arguments += (_e = (_d = toolCallDelta.function) == null ? void 0 : _d.arguments) != null ? _e : ""; | ||
if (((_f = toolCallDelta.function) == null ? void 0 : _f.arguments) != null) { | ||
toolCall.function.arguments += (_h = (_g = toolCallDelta.function) == null ? void 0 : _g.arguments) != null ? _h : ""; | ||
} | ||
@@ -398,14 +415,13 @@ controller.enqueue({ | ||
toolName: toolCall.function.name, | ||
argsTextDelta: (_f = toolCallDelta.function.arguments) != null ? _f : "" | ||
argsTextDelta: (_i = toolCallDelta.function.arguments) != null ? _i : "" | ||
}); | ||
if (((_g = toolCall.function) == null ? void 0 : _g.name) == null || ((_h = toolCall.function) == null ? void 0 : _h.arguments) == null || !(0, import_provider_utils3.isParseableJson)(toolCall.function.arguments)) { | ||
continue; | ||
if (((_j = toolCall.function) == null ? void 0 : _j.name) != null && ((_k = toolCall.function) == null ? void 0 : _k.arguments) != null && (0, import_provider_utils3.isParsableJson)(toolCall.function.arguments)) { | ||
controller.enqueue({ | ||
type: "tool-call", | ||
toolCallType: "function", | ||
toolCallId: (_l = toolCall.id) != null ? _l : (0, import_provider_utils3.generateId)(), | ||
toolName: toolCall.function.name, | ||
args: toolCall.function.arguments | ||
}); | ||
} | ||
controller.enqueue({ | ||
type: "tool-call", | ||
toolCallType: "function", | ||
toolCallId: (_i = toolCall.id) != null ? _i : (0, import_provider_utils3.generateId)(), | ||
toolName: toolCall.function.name, | ||
args: toolCall.function.arguments | ||
}); | ||
} | ||
@@ -412,0 +428,0 @@ } |
{ | ||
"name": "@ai-sdk/openai", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"license": "Apache-2.0", | ||
@@ -21,4 +21,4 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@ai-sdk/provider": "0.0.8", | ||
"@ai-sdk/provider-utils": "0.0.11" | ||
"@ai-sdk/provider": "0.0.9", | ||
"@ai-sdk/provider-utils": "0.0.12" | ||
}, | ||
@@ -25,0 +25,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
258954
3388
+ Added@ai-sdk/provider@0.0.9(transitive)
+ Added@ai-sdk/provider-utils@0.0.12(transitive)
- Removed@ai-sdk/provider@0.0.8(transitive)
- Removed@ai-sdk/provider-utils@0.0.11(transitive)
Updated@ai-sdk/provider@0.0.9