@ai-sdk/google 3.0.137 → 3.0.139
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 +40 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +39 -3
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +39 -3
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/convert-json-schema-to-openapi-schema.ts +11 -1
- package/src/google-json-accumulator.ts +52 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 3.0.139
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 08c1a86: fix(google): keep empty arrays and objects in tool-call input streamed with `streamFunctionCallArguments`
|
|
8
|
+
|
|
9
|
+
Vertex sends a value-less `partialArgs` entry for an empty container (e.g. `$.tags[]`), which was dropped, so `[]` and `{}` arguments went missing from the streamed tool-call input.
|
|
10
|
+
|
|
11
|
+
## 3.0.138
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 2b59d8a: fix(google): convert `type: [X, "null"]` to a plain nullable node so `items` and `format` beside it stay valid for Gemini
|
|
16
|
+
|
|
3
17
|
## 3.0.137
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -244,7 +244,7 @@ var googleInteractionsTranscriptionResponseSchema = (0, import_provider_utils3.l
|
|
|
244
244
|
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
245
245
|
|
|
246
246
|
// src/version.ts
|
|
247
|
-
var VERSION = true ? "3.0.
|
|
247
|
+
var VERSION = true ? "3.0.139" : "0.0.0-test";
|
|
248
248
|
|
|
249
249
|
// src/google-generative-ai-embedding-model.ts
|
|
250
250
|
var import_provider2 = require("@ai-sdk/provider");
|
|
@@ -674,6 +674,11 @@ function convertJSONSchemaDefinition(jsonSchema, isRoot, referenceContext) {
|
|
|
674
674
|
const nonNullTypes = type.filter((t) => t !== "null");
|
|
675
675
|
if (nonNullTypes.length === 0) {
|
|
676
676
|
result.type = "null";
|
|
677
|
+
} else if (nonNullTypes.length === 1) {
|
|
678
|
+
result.type = nonNullTypes[0];
|
|
679
|
+
if (hasNull) {
|
|
680
|
+
result.nullable = true;
|
|
681
|
+
}
|
|
677
682
|
} else {
|
|
678
683
|
result.anyOf = nonNullTypes.map((t) => ({ type: t }));
|
|
679
684
|
if (hasNull) {
|
|
@@ -1836,8 +1841,10 @@ var GoogleJSONAccumulator = class {
|
|
|
1836
1841
|
processPartialArgs(partialArgs) {
|
|
1837
1842
|
let delta = "";
|
|
1838
1843
|
for (const arg of partialArgs) {
|
|
1839
|
-
const
|
|
1840
|
-
|
|
1844
|
+
const isArrayTerminator = arg.jsonPath.endsWith("[]");
|
|
1845
|
+
const jsonPath = isArrayTerminator ? arg.jsonPath.slice(0, -2) : arg.jsonPath;
|
|
1846
|
+
const rawPath = jsonPath.replace(/^\$\./, "");
|
|
1847
|
+
if (!rawPath || rawPath === "$") continue;
|
|
1841
1848
|
const segments = parsePath(rawPath);
|
|
1842
1849
|
const existingValue = getNestedValue(this.accumulatedArgs, segments);
|
|
1843
1850
|
const isStringContinuation = arg.stringValue != null && existingValue !== void 0;
|
|
@@ -1852,7 +1859,16 @@ var GoogleJSONAccumulator = class {
|
|
|
1852
1859
|
continue;
|
|
1853
1860
|
}
|
|
1854
1861
|
const resolved = resolvePartialArgValue(arg);
|
|
1855
|
-
if (resolved == null)
|
|
1862
|
+
if (resolved == null) {
|
|
1863
|
+
if (existingValue !== void 0 || arg.willContinue === true) continue;
|
|
1864
|
+
setNestedValue(
|
|
1865
|
+
this.accumulatedArgs,
|
|
1866
|
+
segments,
|
|
1867
|
+
isArrayTerminator ? [] : {}
|
|
1868
|
+
);
|
|
1869
|
+
delta += this.emitContainer(segments, isArrayTerminator);
|
|
1870
|
+
continue;
|
|
1871
|
+
}
|
|
1856
1872
|
setNestedValue(this.accumulatedArgs, segments, resolved.value);
|
|
1857
1873
|
delta += this.emitNavigationTo(segments, arg, resolved.json);
|
|
1858
1874
|
}
|
|
@@ -1904,6 +1920,26 @@ var GoogleJSONAccumulator = class {
|
|
|
1904
1920
|
fragment += this.emitLeaf(leafSegment, arg, valueJson);
|
|
1905
1921
|
return fragment;
|
|
1906
1922
|
}
|
|
1923
|
+
/**
|
|
1924
|
+
* Navigates to `targetSegments` and opens a container there. The container
|
|
1925
|
+
* stays open so later entries for its children continue inside it; it is
|
|
1926
|
+
* closed by subsequent navigation or by `finalize()`.
|
|
1927
|
+
*
|
|
1928
|
+
* Input: targetSegments=["nested","tags"], isArray=true
|
|
1929
|
+
* Output: '{"nested":{"tags":['
|
|
1930
|
+
*/
|
|
1931
|
+
emitContainer(targetSegments, isArray) {
|
|
1932
|
+
let fragment = "";
|
|
1933
|
+
if (this.stringOpen) {
|
|
1934
|
+
fragment += '"';
|
|
1935
|
+
this.stringOpen = false;
|
|
1936
|
+
}
|
|
1937
|
+
fragment += this.ensureRoot();
|
|
1938
|
+
const commonDepth = this.findCommonStackDepth(targetSegments);
|
|
1939
|
+
fragment += this.closeDownTo(commonDepth);
|
|
1940
|
+
fragment += this.openDownTo(targetSegments, isArray ? 0 : "");
|
|
1941
|
+
return fragment;
|
|
1942
|
+
}
|
|
1907
1943
|
/**
|
|
1908
1944
|
* Returns the stack depth to preserve when navigating to a new target
|
|
1909
1945
|
* container path. Always >= 1 (the root is never popped).
|