@ai-sdk/google 4.0.89 → 4.0.91
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/CHANGELOG.md +14 -0
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +10 -7
- package/dist/internal/index.js.map +1 -1
- package/package.json +3 -3
- package/src/convert-to-google-messages.ts +14 -4
package/dist/internal/index.js
CHANGED
|
@@ -358,14 +358,17 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
358
358
|
if (output.type === "content") {
|
|
359
359
|
if (supportsFunctionResponseParts) appendToolResultParts(parts, part.toolName, output.value, part.toolCallId, includeFunctionCallIds, supportedFunctionResponseUrls);
|
|
360
360
|
else appendLegacyToolResultParts(parts, part.toolName, output.value, part.toolCallId, includeFunctionCallIds);
|
|
361
|
-
} else
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
361
|
+
} else {
|
|
362
|
+
const isError = output.type === "error-text" || output.type === "error-json" || output.type === "execution-denied";
|
|
363
|
+
parts.push({ functionResponse: {
|
|
364
|
+
...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
365
365
|
name: part.toolName,
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
366
|
+
response: {
|
|
367
|
+
name: part.toolName,
|
|
368
|
+
...isError ? { error: output.type === "execution-denied" ? output.reason ?? "Tool call execution denied." : serializeFunctionResponseContent(output.value) } : { content: serializeFunctionResponseContent(output.value) }
|
|
369
|
+
}
|
|
370
|
+
} });
|
|
371
|
+
}
|
|
369
372
|
}
|
|
370
373
|
contents.push({
|
|
371
374
|
role: "user",
|