@ai-sdk/google 4.0.79 → 4.0.80
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 +6 -0
- package/README.md +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +15 -1
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +11 -11
- package/package.json +1 -1
- package/src/convert-to-google-messages.ts +26 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ import { google } from '@ai-sdk/google';
|
|
|
35
35
|
import { generateText } from 'ai';
|
|
36
36
|
|
|
37
37
|
const { text } = await generateText({
|
|
38
|
-
model: google('gemini-
|
|
38
|
+
model: google('gemini-3.1-pro-preview'),
|
|
39
39
|
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
|
|
40
40
|
});
|
|
41
41
|
```
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { Experimental_EvaluationLanguageModel as EvaluationLanguageModel } from "@ai-sdk/provider-utils/experimental-evaluation";
|
|
9
9
|
|
|
10
10
|
// src/version.ts
|
|
11
|
-
var VERSION = true ? "4.0.
|
|
11
|
+
var VERSION = true ? "4.0.80" : "0.0.0-test";
|
|
12
12
|
|
|
13
13
|
// src/google-embedding-model.ts
|
|
14
14
|
import {
|
|
@@ -413,6 +413,20 @@ function convertUrlToolResultPart(url) {
|
|
|
413
413
|
}
|
|
414
414
|
};
|
|
415
415
|
}
|
|
416
|
+
function containsJSONSchemaReference(value) {
|
|
417
|
+
if (Array.isArray(value)) {
|
|
418
|
+
return value.some(containsJSONSchemaReference);
|
|
419
|
+
}
|
|
420
|
+
if (typeof value !== "object" || value === null) {
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
return Object.entries(value).some(
|
|
424
|
+
([key, nestedValue]) => key === "$ref" || containsJSONSchemaReference(nestedValue)
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
function serializeFunctionResponseContent(value) {
|
|
428
|
+
return containsJSONSchemaReference(value) ? JSON.stringify(value) : value;
|
|
429
|
+
}
|
|
416
430
|
function appendToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true) {
|
|
417
431
|
const functionResponseParts = [];
|
|
418
432
|
const responseTextParts = [];
|
|
@@ -821,7 +835,7 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
821
835
|
name: part.toolName,
|
|
822
836
|
response: {
|
|
823
837
|
name: part.toolName,
|
|
824
|
-
content: output.type === "execution-denied" ? (_f = output.reason) != null ? _f : "Tool call execution denied." : output.value
|
|
838
|
+
content: output.type === "execution-denied" ? (_f = output.reason) != null ? _f : "Tool call execution denied." : serializeFunctionResponseContent(output.value)
|
|
825
839
|
}
|
|
826
840
|
}
|
|
827
841
|
});
|