@ai-sdk/cohere
Advanced tools
Comparing version 1.0.0-canary.3 to 1.0.0-canary.4
@@ -107,3 +107,4 @@ "use strict"; | ||
content: text !== "" ? text : "call tool", | ||
tool_calls: toolCalls.length > 0 ? toolCalls : void 0 | ||
tool_calls: toolCalls.length > 0 ? toolCalls : void 0, | ||
tool_plan: void 0 | ||
}); | ||
@@ -298,3 +299,3 @@ break; | ||
async doGenerate(options) { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c, _d, _e; | ||
const { warnings, ...args } = this.getArgs(options); | ||
@@ -314,4 +315,8 @@ args.tools = args.tools && this.removeJsonSchemaExtras(args.tools); | ||
const { messages, ...rawSettings } = args; | ||
let text = (_c = (_b = (_a = response.message.content) == null ? void 0 : _a[0]) == null ? void 0 : _b.text) != null ? _c : ""; | ||
if (!text) { | ||
text = (_d = response.message.tool_plan) != null ? _d : ""; | ||
} | ||
return { | ||
text: (_c = (_b = (_a = response.message.content) == null ? void 0 : _a[0]) == null ? void 0 : _b.text) != null ? _c : "", | ||
text, | ||
toolCalls: response.message.tool_calls ? response.message.tool_calls.map((toolCall) => ({ | ||
@@ -335,3 +340,3 @@ toolCallId: toolCall.id, | ||
response: { | ||
id: (_d = response.generation_id) != null ? _d : void 0 | ||
id: (_e = response.generation_id) != null ? _e : void 0 | ||
}, | ||
@@ -389,2 +394,9 @@ rawResponse: { headers: responseHeaders }, | ||
} | ||
case "tool-plan-delta": { | ||
controller.enqueue({ | ||
type: "text-delta", | ||
textDelta: value.delta.message.tool_plan | ||
}); | ||
return; | ||
} | ||
case "tool-call-start": { | ||
@@ -484,2 +496,3 @@ pendingToolCallDelta = { | ||
).nullish(), | ||
tool_plan: import_zod2.z.string().nullish(), | ||
tool_calls: import_zod2.z.array( | ||
@@ -486,0 +499,0 @@ import_zod2.z.object({ |
# @ai-sdk/cohere | ||
## 1.0.0-canary.4 | ||
### Patch Changes | ||
- 3fc69d6: feat (provider/cohere): Pass along tool-plan response content. | ||
## 1.0.0-canary.3 | ||
@@ -4,0 +10,0 @@ |
@@ -107,3 +107,4 @@ "use strict"; | ||
content: text !== "" ? text : "call tool", | ||
tool_calls: toolCalls.length > 0 ? toolCalls : void 0 | ||
tool_calls: toolCalls.length > 0 ? toolCalls : void 0, | ||
tool_plan: void 0 | ||
}); | ||
@@ -298,3 +299,3 @@ break; | ||
async doGenerate(options) { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c, _d, _e; | ||
const { warnings, ...args } = this.getArgs(options); | ||
@@ -314,4 +315,8 @@ args.tools = args.tools && this.removeJsonSchemaExtras(args.tools); | ||
const { messages, ...rawSettings } = args; | ||
let text = (_c = (_b = (_a = response.message.content) == null ? void 0 : _a[0]) == null ? void 0 : _b.text) != null ? _c : ""; | ||
if (!text) { | ||
text = (_d = response.message.tool_plan) != null ? _d : ""; | ||
} | ||
return { | ||
text: (_c = (_b = (_a = response.message.content) == null ? void 0 : _a[0]) == null ? void 0 : _b.text) != null ? _c : "", | ||
text, | ||
toolCalls: response.message.tool_calls ? response.message.tool_calls.map((toolCall) => ({ | ||
@@ -335,3 +340,3 @@ toolCallId: toolCall.id, | ||
response: { | ||
id: (_d = response.generation_id) != null ? _d : void 0 | ||
id: (_e = response.generation_id) != null ? _e : void 0 | ||
}, | ||
@@ -389,2 +394,9 @@ rawResponse: { headers: responseHeaders }, | ||
} | ||
case "tool-plan-delta": { | ||
controller.enqueue({ | ||
type: "text-delta", | ||
textDelta: value.delta.message.tool_plan | ||
}); | ||
return; | ||
} | ||
case "tool-call-start": { | ||
@@ -484,2 +496,3 @@ pendingToolCallDelta = { | ||
).nullish(), | ||
tool_plan: import_zod2.z.string().nullish(), | ||
tool_calls: import_zod2.z.array( | ||
@@ -486,0 +499,0 @@ import_zod2.z.object({ |
{ | ||
"name": "@ai-sdk/cohere", | ||
"version": "1.0.0-canary.3", | ||
"version": "1.0.0-canary.4", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
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
165513
2156