@ai-sdk/cohere
Advanced tools
Comparing version 0.0.22 to 0.0.23
@@ -225,2 +225,3 @@ "use strict"; | ||
async doGenerate(options) { | ||
var _a; | ||
const args = this.getArgs(options); | ||
@@ -260,2 +261,5 @@ const { responseHeaders, value: response } = await (0, import_provider_utils2.postJsonToApi)({ | ||
}, | ||
response: { | ||
id: (_a = response.generation_id) != null ? _a : void 0 | ||
}, | ||
rawResponse: { headers: responseHeaders }, | ||
@@ -293,2 +297,3 @@ warnings: void 0 | ||
transform(chunk, controller) { | ||
var _a; | ||
if (!chunk.success) { | ||
@@ -353,2 +358,9 @@ finishReason = "error"; | ||
} | ||
case "stream-start": { | ||
controller.enqueue({ | ||
type: "response-metadata", | ||
id: (_a = value.generation_id) != null ? _a : void 0 | ||
}); | ||
return; | ||
} | ||
case "stream-end": { | ||
@@ -389,2 +401,3 @@ finishReason = mapCohereFinishReason(value.finish_reason); | ||
var cohereChatResponseSchema = import_zod2.z.object({ | ||
generation_id: import_zod2.z.string().nullish(), | ||
text: import_zod2.z.string(), | ||
@@ -396,3 +409,3 @@ tool_calls: import_zod2.z.array( | ||
}) | ||
).optional(), | ||
).nullish(), | ||
finish_reason: import_zod2.z.string(), | ||
@@ -408,3 +421,4 @@ meta: import_zod2.z.object({ | ||
import_zod2.z.object({ | ||
event_type: import_zod2.z.literal("stream-start") | ||
event_type: import_zod2.z.literal("stream-start"), | ||
generation_id: import_zod2.z.string().nullish() | ||
}), | ||
@@ -411,0 +425,0 @@ import_zod2.z.object({ |
# @ai-sdk/cohere | ||
## 0.0.23 | ||
### Patch Changes | ||
- 03313cd: feat (ai): expose response id, response model, response timestamp in telemetry and api | ||
- Updated dependencies [03313cd] | ||
- Updated dependencies [3be7c1c] | ||
- @ai-sdk/provider-utils@1.0.18 | ||
- @ai-sdk/provider@0.0.23 | ||
## 0.0.22 | ||
@@ -4,0 +14,0 @@ |
@@ -225,2 +225,3 @@ "use strict"; | ||
async doGenerate(options) { | ||
var _a; | ||
const args = this.getArgs(options); | ||
@@ -260,2 +261,5 @@ const { responseHeaders, value: response } = await (0, import_provider_utils2.postJsonToApi)({ | ||
}, | ||
response: { | ||
id: (_a = response.generation_id) != null ? _a : void 0 | ||
}, | ||
rawResponse: { headers: responseHeaders }, | ||
@@ -293,2 +297,3 @@ warnings: void 0 | ||
transform(chunk, controller) { | ||
var _a; | ||
if (!chunk.success) { | ||
@@ -353,2 +358,9 @@ finishReason = "error"; | ||
} | ||
case "stream-start": { | ||
controller.enqueue({ | ||
type: "response-metadata", | ||
id: (_a = value.generation_id) != null ? _a : void 0 | ||
}); | ||
return; | ||
} | ||
case "stream-end": { | ||
@@ -389,2 +401,3 @@ finishReason = mapCohereFinishReason(value.finish_reason); | ||
var cohereChatResponseSchema = import_zod2.z.object({ | ||
generation_id: import_zod2.z.string().nullish(), | ||
text: import_zod2.z.string(), | ||
@@ -396,3 +409,3 @@ tool_calls: import_zod2.z.array( | ||
}) | ||
).optional(), | ||
).nullish(), | ||
finish_reason: import_zod2.z.string(), | ||
@@ -408,3 +421,4 @@ meta: import_zod2.z.object({ | ||
import_zod2.z.object({ | ||
event_type: import_zod2.z.literal("stream-start") | ||
event_type: import_zod2.z.literal("stream-start"), | ||
generation_id: import_zod2.z.string().nullish() | ||
}), | ||
@@ -411,0 +425,0 @@ import_zod2.z.object({ |
{ | ||
"name": "@ai-sdk/cohere", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"license": "Apache-2.0", | ||
@@ -22,4 +22,4 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@ai-sdk/provider": "0.0.22", | ||
"@ai-sdk/provider-utils": "1.0.17" | ||
"@ai-sdk/provider": "0.0.23", | ||
"@ai-sdk/provider-utils": "1.0.18" | ||
}, | ||
@@ -26,0 +26,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
149149
1970
+ Added@ai-sdk/provider@0.0.23(transitive)
+ Added@ai-sdk/provider-utils@1.0.18(transitive)
- Removed@ai-sdk/provider@0.0.22(transitive)
- Removed@ai-sdk/provider-utils@1.0.17(transitive)
Updated@ai-sdk/provider@0.0.23