@ai-sdk/google
Advanced tools
Comparing version 1.0.0-canary.5 to 1.0.0-canary.6
# @ai-sdk/google | ||
## 1.0.0-canary.6 | ||
### Patch Changes | ||
- c38a0db: fix (provider/google): allow empty candidates array when streaming | ||
## 1.0.0-canary.5 | ||
@@ -4,0 +10,0 @@ |
@@ -527,3 +527,3 @@ "use strict"; | ||
transform(chunk, controller) { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
if (!chunk.success) { | ||
@@ -534,9 +534,2 @@ controller.enqueue({ type: "error", error: chunk.error }); | ||
const value = chunk.value; | ||
const candidate = value.candidates[0]; | ||
if ((candidate == null ? void 0 : candidate.finishReason) != null) { | ||
finishReason = mapGoogleGenerativeAIFinishReason({ | ||
finishReason: candidate.finishReason, | ||
hasToolCalls | ||
}); | ||
} | ||
const usageMetadata = value.usageMetadata; | ||
@@ -549,2 +542,12 @@ if (usageMetadata != null) { | ||
} | ||
const candidate = (_c = value.candidates) == null ? void 0 : _c[0]; | ||
if (candidate == null) { | ||
return; | ||
} | ||
if (candidate.finishReason != null) { | ||
finishReason = mapGoogleGenerativeAIFinishReason({ | ||
finishReason: candidate.finishReason, | ||
hasToolCalls | ||
}); | ||
} | ||
const content = candidate.content; | ||
@@ -650,3 +653,3 @@ if (content == null) { | ||
}) | ||
), | ||
).nullish(), | ||
usageMetadata: import_zod2.z.object({ | ||
@@ -656,3 +659,3 @@ promptTokenCount: import_zod2.z.number(), | ||
totalTokenCount: import_zod2.z.number() | ||
}).optional() | ||
}).nullish() | ||
}); | ||
@@ -659,0 +662,0 @@ |
{ | ||
"name": "@ai-sdk/google", | ||
"version": "1.0.0-canary.5", | ||
"version": "1.0.0-canary.6", | ||
"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
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
161001
1589