@ai-sdk/google 4.0.69 → 4.0.71
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 +28 -0
- package/dist/index.js +66 -314
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +2 -3
- package/dist/internal/index.js +52 -307
- package/dist/internal/index.js.map +1 -1
- package/package.json +3 -3
- package/src/google-language-model.ts +5 -5
- package/src/google-prepare-tools.ts +3 -23
- package/src/realtime/google-realtime-event-mapper.ts +24 -3
- package/src/sanitize-response-json-schema.ts +65 -0
- package/src/convert-json-schema-to-openapi-schema.ts +0 -456
package/dist/internal/index.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ declare class GoogleLanguageModel implements LanguageModelV4 {
|
|
|
137
137
|
stopSequences: string[] | undefined;
|
|
138
138
|
seed: number | undefined;
|
|
139
139
|
responseMimeType: string | undefined;
|
|
140
|
-
|
|
140
|
+
responseJsonSchema: _ai_sdk_provider.JSONSchema7 | undefined;
|
|
141
141
|
};
|
|
142
142
|
contents: GoogleContent[];
|
|
143
143
|
systemInstruction: GoogleSystemInstruction | undefined;
|
|
@@ -149,8 +149,7 @@ declare class GoogleLanguageModel implements LanguageModelV4 {
|
|
|
149
149
|
functionDeclarations: {
|
|
150
150
|
name: string;
|
|
151
151
|
description: string;
|
|
152
|
-
|
|
153
|
-
parametersJsonSchema?: unknown;
|
|
152
|
+
parametersJsonSchema: unknown;
|
|
154
153
|
}[];
|
|
155
154
|
} | Record<string, any>)[] | undefined;
|
|
156
155
|
toolConfig: {
|
package/dist/internal/index.js
CHANGED
|
@@ -46,289 +46,9 @@ function convertGoogleUsage(usage) {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
// src/convert-json-schema-to-openapi-schema.ts
|
|
50
|
-
import {
|
|
51
|
-
UnsupportedFunctionalityError
|
|
52
|
-
} from "@ai-sdk/provider";
|
|
53
|
-
var recursiveReferenceFunctionalityPrefix = "recursive JSON Schema reference:";
|
|
54
|
-
function isRecursiveJSONSchemaReferenceError(error) {
|
|
55
|
-
return UnsupportedFunctionalityError.isInstance(error) && error.functionality.startsWith(recursiveReferenceFunctionalityPrefix);
|
|
56
|
-
}
|
|
57
|
-
function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
|
|
58
|
-
const rootSchema = typeof jsonSchema === "object" ? jsonSchema : void 0;
|
|
59
|
-
return convertJSONSchemaDefinition(jsonSchema, isRoot, {
|
|
60
|
-
definitions: rootSchema == null ? void 0 : rootSchema.definitions,
|
|
61
|
-
dollarDefinitions: rootSchema == null ? void 0 : rootSchema.$defs,
|
|
62
|
-
resolvingReferences: /* @__PURE__ */ new Set()
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function convertJSONSchemaDefinition(jsonSchema, isRoot, referenceContext) {
|
|
66
|
-
if (jsonSchema == null) {
|
|
67
|
-
return void 0;
|
|
68
|
-
}
|
|
69
|
-
if (typeof jsonSchema === "boolean") {
|
|
70
|
-
return { type: "boolean", properties: {} };
|
|
71
|
-
}
|
|
72
|
-
if (jsonSchema.$ref != null) {
|
|
73
|
-
return convertJSONSchemaReference({
|
|
74
|
-
jsonSchema,
|
|
75
|
-
reference: jsonSchema.$ref,
|
|
76
|
-
isRoot,
|
|
77
|
-
referenceContext
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
if (isEmptyObjectSchema(jsonSchema)) {
|
|
81
|
-
if (isRoot) {
|
|
82
|
-
return void 0;
|
|
83
|
-
}
|
|
84
|
-
if (jsonSchema.description) {
|
|
85
|
-
return { type: "object", description: jsonSchema.description };
|
|
86
|
-
}
|
|
87
|
-
return { type: "object" };
|
|
88
|
-
}
|
|
89
|
-
const {
|
|
90
|
-
type,
|
|
91
|
-
description,
|
|
92
|
-
required,
|
|
93
|
-
properties,
|
|
94
|
-
items,
|
|
95
|
-
allOf,
|
|
96
|
-
anyOf,
|
|
97
|
-
oneOf,
|
|
98
|
-
format,
|
|
99
|
-
const: constValue,
|
|
100
|
-
minLength,
|
|
101
|
-
minItems,
|
|
102
|
-
maxItems,
|
|
103
|
-
enum: enumValues
|
|
104
|
-
} = jsonSchema;
|
|
105
|
-
const result = {};
|
|
106
|
-
if (description) result.description = description;
|
|
107
|
-
if (required) result.required = required;
|
|
108
|
-
if (format) result.format = format;
|
|
109
|
-
if (type) {
|
|
110
|
-
if (Array.isArray(type)) {
|
|
111
|
-
const hasNull = type.includes("null");
|
|
112
|
-
const nonNullTypes = type.filter((t) => t !== "null");
|
|
113
|
-
if (nonNullTypes.length === 0) {
|
|
114
|
-
result.type = "null";
|
|
115
|
-
} else {
|
|
116
|
-
result.anyOf = nonNullTypes.map((t) => ({ type: t }));
|
|
117
|
-
if (hasNull) {
|
|
118
|
-
result.nullable = true;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
result.type = type;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
const values = enumValues != null ? enumValues : constValue !== void 0 ? [constValue] : void 0;
|
|
126
|
-
if (values !== void 0) {
|
|
127
|
-
addEnumToSchema({ values, type, result });
|
|
128
|
-
}
|
|
129
|
-
if (properties != null) {
|
|
130
|
-
result.properties = Object.entries(properties).reduce(
|
|
131
|
-
(acc, [key, value]) => {
|
|
132
|
-
acc[key] = convertJSONSchemaDefinition(value, false, referenceContext);
|
|
133
|
-
return acc;
|
|
134
|
-
},
|
|
135
|
-
{}
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
if (items) {
|
|
139
|
-
result.items = Array.isArray(items) ? items.map(
|
|
140
|
-
(item) => convertJSONSchemaDefinition(item, false, referenceContext)
|
|
141
|
-
) : convertJSONSchemaDefinition(items, false, referenceContext);
|
|
142
|
-
}
|
|
143
|
-
if (allOf) {
|
|
144
|
-
result.allOf = allOf.map(
|
|
145
|
-
(item) => convertJSONSchemaDefinition(item, false, referenceContext)
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
if (anyOf) {
|
|
149
|
-
if (anyOf.some(
|
|
150
|
-
(schema) => typeof schema === "object" && (schema == null ? void 0 : schema.type) === "null"
|
|
151
|
-
)) {
|
|
152
|
-
const nonNullSchemas = anyOf.filter(
|
|
153
|
-
(schema) => !(typeof schema === "object" && (schema == null ? void 0 : schema.type) === "null")
|
|
154
|
-
);
|
|
155
|
-
if (nonNullSchemas.length === 1) {
|
|
156
|
-
const converted = convertJSONSchemaDefinition(
|
|
157
|
-
nonNullSchemas[0],
|
|
158
|
-
false,
|
|
159
|
-
referenceContext
|
|
160
|
-
);
|
|
161
|
-
if (typeof converted === "object") {
|
|
162
|
-
result.nullable = true;
|
|
163
|
-
Object.assign(result, converted);
|
|
164
|
-
}
|
|
165
|
-
} else {
|
|
166
|
-
result.anyOf = nonNullSchemas.map(
|
|
167
|
-
(item) => convertJSONSchemaDefinition(item, false, referenceContext)
|
|
168
|
-
);
|
|
169
|
-
result.nullable = true;
|
|
170
|
-
}
|
|
171
|
-
} else {
|
|
172
|
-
result.anyOf = anyOf.map(
|
|
173
|
-
(item) => convertJSONSchemaDefinition(item, false, referenceContext)
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
if (oneOf) {
|
|
178
|
-
result.oneOf = oneOf.map(
|
|
179
|
-
(item) => convertJSONSchemaDefinition(item, false, referenceContext)
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
if (minLength !== void 0) {
|
|
183
|
-
result.minLength = minLength;
|
|
184
|
-
}
|
|
185
|
-
if (minItems !== void 0) {
|
|
186
|
-
result.minItems = minItems;
|
|
187
|
-
}
|
|
188
|
-
if (maxItems !== void 0) {
|
|
189
|
-
result.maxItems = maxItems;
|
|
190
|
-
}
|
|
191
|
-
return result;
|
|
192
|
-
}
|
|
193
|
-
function convertJSONSchemaReference({
|
|
194
|
-
jsonSchema,
|
|
195
|
-
reference,
|
|
196
|
-
isRoot,
|
|
197
|
-
referenceContext
|
|
198
|
-
}) {
|
|
199
|
-
const { definition, referenceKey } = getReferencedDefinition(
|
|
200
|
-
reference,
|
|
201
|
-
referenceContext
|
|
202
|
-
);
|
|
203
|
-
if (referenceContext.resolvingReferences.has(referenceKey)) {
|
|
204
|
-
throw new UnsupportedFunctionalityError({
|
|
205
|
-
functionality: `${recursiveReferenceFunctionalityPrefix} ${reference}`,
|
|
206
|
-
message: "Google schema conversion does not support recursive JSON Schema references."
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
const resolvingReferences = new Set(referenceContext.resolvingReferences);
|
|
210
|
-
resolvingReferences.add(referenceKey);
|
|
211
|
-
const { $ref: _reference, ...siblingSchema } = jsonSchema;
|
|
212
|
-
const resolvedSchema = typeof definition === "boolean" ? definition ? siblingSchema : false : { ...definition, ...siblingSchema };
|
|
213
|
-
return convertJSONSchemaDefinition(resolvedSchema, isRoot, {
|
|
214
|
-
...referenceContext,
|
|
215
|
-
resolvingReferences
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
function getReferencedDefinition(reference, referenceContext) {
|
|
219
|
-
const definitionSources = [
|
|
220
|
-
{
|
|
221
|
-
prefix: "#/$defs/",
|
|
222
|
-
definitions: referenceContext.dollarDefinitions
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
prefix: "#/definitions/",
|
|
226
|
-
definitions: referenceContext.definitions
|
|
227
|
-
}
|
|
228
|
-
];
|
|
229
|
-
const source = definitionSources.find(
|
|
230
|
-
({ prefix }) => reference.startsWith(prefix)
|
|
231
|
-
);
|
|
232
|
-
const encodedDefinitionName = source ? reference.slice(source.prefix.length) : void 0;
|
|
233
|
-
if (source == null || encodedDefinitionName == null || encodedDefinitionName.length === 0 || encodedDefinitionName.includes("/")) {
|
|
234
|
-
throwUnsupportedReference(reference);
|
|
235
|
-
}
|
|
236
|
-
let decodedDefinitionName;
|
|
237
|
-
try {
|
|
238
|
-
decodedDefinitionName = decodeURIComponent(encodedDefinitionName);
|
|
239
|
-
} catch (e) {
|
|
240
|
-
throwUnsupportedReference(reference);
|
|
241
|
-
}
|
|
242
|
-
if (decodedDefinitionName.includes("/") || /~(?![01])/u.test(decodedDefinitionName) || source.definitions == null) {
|
|
243
|
-
throwUnsupportedReference(reference);
|
|
244
|
-
}
|
|
245
|
-
const definitionName = decodedDefinitionName.replace(
|
|
246
|
-
/~[01]/g,
|
|
247
|
-
(match) => match === "~1" ? "/" : "~"
|
|
248
|
-
);
|
|
249
|
-
if (!Object.prototype.hasOwnProperty.call(source.definitions, definitionName)) {
|
|
250
|
-
throwUnsupportedReference(reference);
|
|
251
|
-
}
|
|
252
|
-
return {
|
|
253
|
-
definition: source.definitions[definitionName],
|
|
254
|
-
referenceKey: `${source.prefix}${definitionName}`
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
function throwUnsupportedReference(reference) {
|
|
258
|
-
throw new UnsupportedFunctionalityError({
|
|
259
|
-
functionality: `JSON Schema reference: ${reference}`,
|
|
260
|
-
message: "Google schema conversion only supports references to direct children of root-level $defs or definitions."
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
function addEnumToSchema({
|
|
264
|
-
values,
|
|
265
|
-
type,
|
|
266
|
-
result
|
|
267
|
-
}) {
|
|
268
|
-
const nullable = Array.isArray(type) && type.includes("null") || type === void 0 && values.includes(null);
|
|
269
|
-
const enumValues = nullable ? values.filter((value) => value !== null) : values;
|
|
270
|
-
if (values.length > 0 && values.every((value) => value === null)) {
|
|
271
|
-
const typeAllowsNull = type === void 0 || type === "null" || Array.isArray(type) && type.includes("null");
|
|
272
|
-
if (typeAllowsNull) {
|
|
273
|
-
result.type = "null";
|
|
274
|
-
if (Array.isArray(type)) {
|
|
275
|
-
delete result.anyOf;
|
|
276
|
-
}
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
const enumType = getEnumType({ values: enumValues, type });
|
|
281
|
-
if (enumType === void 0) {
|
|
282
|
-
throw new UnsupportedFunctionalityError({
|
|
283
|
-
functionality: "JSON Schema enum with mixed or unsupported values",
|
|
284
|
-
message: "Google does not support this JSON Schema enum. Enum values must share one supported primitive type and match the schema type."
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
result.type = enumType;
|
|
288
|
-
if (Array.isArray(type)) {
|
|
289
|
-
delete result.anyOf;
|
|
290
|
-
}
|
|
291
|
-
if (nullable) {
|
|
292
|
-
result.nullable = true;
|
|
293
|
-
}
|
|
294
|
-
if (enumType === "string") {
|
|
295
|
-
result.enum = enumValues;
|
|
296
|
-
} else {
|
|
297
|
-
result.format = "enum";
|
|
298
|
-
result.enum = enumValues.map(String);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
function getEnumType({
|
|
302
|
-
values,
|
|
303
|
-
type
|
|
304
|
-
}) {
|
|
305
|
-
if (values.length === 0) {
|
|
306
|
-
return void 0;
|
|
307
|
-
}
|
|
308
|
-
const typeAllows = (enumType) => type === void 0 || type === enumType || Array.isArray(type) && type.includes(enumType);
|
|
309
|
-
if (typeAllows("string") && values.every((value) => typeof value === "string")) {
|
|
310
|
-
return "string";
|
|
311
|
-
}
|
|
312
|
-
if ((typeAllows("number") || typeAllows("integer")) && values.every((value) => typeof value === "number" && Number.isFinite(value))) {
|
|
313
|
-
if (typeAllows("number")) {
|
|
314
|
-
return "number";
|
|
315
|
-
}
|
|
316
|
-
if (values.every((value) => Number.isInteger(value))) {
|
|
317
|
-
return "integer";
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
if (typeAllows("boolean") && values.every((value) => typeof value === "boolean")) {
|
|
321
|
-
return "boolean";
|
|
322
|
-
}
|
|
323
|
-
return void 0;
|
|
324
|
-
}
|
|
325
|
-
function isEmptyObjectSchema(jsonSchema) {
|
|
326
|
-
return jsonSchema != null && typeof jsonSchema === "object" && jsonSchema.type === "object" && (jsonSchema.properties == null || Object.keys(jsonSchema.properties).length === 0) && !jsonSchema.additionalProperties;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
49
|
// src/convert-to-google-messages.ts
|
|
330
50
|
import {
|
|
331
|
-
UnsupportedFunctionalityError
|
|
51
|
+
UnsupportedFunctionalityError
|
|
332
52
|
} from "@ai-sdk/provider";
|
|
333
53
|
import {
|
|
334
54
|
convertToBase64,
|
|
@@ -485,7 +205,7 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
485
205
|
switch (role) {
|
|
486
206
|
case "system": {
|
|
487
207
|
if (!systemMessagesAllowed) {
|
|
488
|
-
throw new
|
|
208
|
+
throw new UnsupportedFunctionalityError({
|
|
489
209
|
functionality: "system messages are only supported at the beginning of the conversation"
|
|
490
210
|
});
|
|
491
211
|
}
|
|
@@ -514,7 +234,7 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
514
234
|
}
|
|
515
235
|
case "reference": {
|
|
516
236
|
if (isVertexLike) {
|
|
517
|
-
throw new
|
|
237
|
+
throw new UnsupportedFunctionalityError({
|
|
518
238
|
functionality: "file parts with provider references"
|
|
519
239
|
});
|
|
520
240
|
}
|
|
@@ -582,7 +302,7 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
582
302
|
case "reasoning-file": {
|
|
583
303
|
switch (part.data.type) {
|
|
584
304
|
case "url": {
|
|
585
|
-
throw new
|
|
305
|
+
throw new UnsupportedFunctionalityError({
|
|
586
306
|
functionality: "File data URLs in assistant messages are not supported"
|
|
587
307
|
});
|
|
588
308
|
}
|
|
@@ -602,13 +322,13 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
602
322
|
case "file": {
|
|
603
323
|
switch (part.data.type) {
|
|
604
324
|
case "url": {
|
|
605
|
-
throw new
|
|
325
|
+
throw new UnsupportedFunctionalityError({
|
|
606
326
|
functionality: "File data URLs in assistant messages are not supported"
|
|
607
327
|
});
|
|
608
328
|
}
|
|
609
329
|
case "reference": {
|
|
610
330
|
if (isVertexLike) {
|
|
611
|
-
throw new
|
|
331
|
+
throw new UnsupportedFunctionalityError({
|
|
612
332
|
functionality: "file parts with provider references"
|
|
613
333
|
});
|
|
614
334
|
}
|
|
@@ -900,6 +620,44 @@ var googleFailedResponseHandler = createJsonErrorResponseHandler({
|
|
|
900
620
|
errorToMessage: (data) => data.error.message
|
|
901
621
|
});
|
|
902
622
|
|
|
623
|
+
// src/sanitize-response-json-schema.ts
|
|
624
|
+
function sanitizeResponseJsonSchema(schema) {
|
|
625
|
+
const {
|
|
626
|
+
const: constValue,
|
|
627
|
+
properties,
|
|
628
|
+
items,
|
|
629
|
+
additionalProperties,
|
|
630
|
+
anyOf,
|
|
631
|
+
oneOf,
|
|
632
|
+
...result
|
|
633
|
+
} = schema;
|
|
634
|
+
return {
|
|
635
|
+
...result,
|
|
636
|
+
...constValue !== void 0 ? { enum: [constValue] } : {},
|
|
637
|
+
...properties != null ? { properties: sanitizeDefinitions(properties) } : {},
|
|
638
|
+
...items != null ? {
|
|
639
|
+
items: Array.isArray(items) ? items.map(sanitizeDefinition) : sanitizeDefinition(items)
|
|
640
|
+
} : {},
|
|
641
|
+
...additionalProperties != null ? {
|
|
642
|
+
additionalProperties: typeof additionalProperties === "boolean" ? additionalProperties : sanitizeDefinition(additionalProperties)
|
|
643
|
+
} : {},
|
|
644
|
+
...anyOf != null ? { anyOf: anyOf.map(sanitizeDefinition) } : {},
|
|
645
|
+
...oneOf != null ? { oneOf: oneOf.map(sanitizeDefinition) } : {},
|
|
646
|
+
...result.$defs != null ? { $defs: sanitizeDefinitions(result.$defs) } : {}
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
function sanitizeDefinitions(definitions) {
|
|
650
|
+
return Object.fromEntries(
|
|
651
|
+
Object.entries(definitions).map(([name, definition]) => [
|
|
652
|
+
name,
|
|
653
|
+
sanitizeDefinition(definition)
|
|
654
|
+
])
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
function sanitizeDefinition(definition) {
|
|
658
|
+
return typeof definition === "boolean" ? definition : sanitizeResponseJsonSchema(definition);
|
|
659
|
+
}
|
|
660
|
+
|
|
903
661
|
// src/google-language-model-options.ts
|
|
904
662
|
import {
|
|
905
663
|
lazySchema as lazySchema2,
|
|
@@ -1114,7 +872,7 @@ function getGoogleModelCapabilities(modelId) {
|
|
|
1114
872
|
|
|
1115
873
|
// src/google-prepare-tools.ts
|
|
1116
874
|
import {
|
|
1117
|
-
UnsupportedFunctionalityError as
|
|
875
|
+
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
1118
876
|
} from "@ai-sdk/provider";
|
|
1119
877
|
function prepareTools({
|
|
1120
878
|
tools,
|
|
@@ -1344,7 +1102,7 @@ function prepareTools({
|
|
|
1344
1102
|
};
|
|
1345
1103
|
default: {
|
|
1346
1104
|
const _exhaustiveCheck = type;
|
|
1347
|
-
throw new
|
|
1105
|
+
throw new UnsupportedFunctionalityError2({
|
|
1348
1106
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
1349
1107
|
});
|
|
1350
1108
|
}
|
|
@@ -1352,24 +1110,11 @@ function prepareTools({
|
|
|
1352
1110
|
}
|
|
1353
1111
|
function prepareFunctionDeclaration(tool) {
|
|
1354
1112
|
var _a;
|
|
1355
|
-
|
|
1113
|
+
return {
|
|
1356
1114
|
name: tool.name,
|
|
1357
|
-
description: (_a = tool.description) != null ? _a : ""
|
|
1115
|
+
description: (_a = tool.description) != null ? _a : "",
|
|
1116
|
+
parametersJsonSchema: tool.inputSchema
|
|
1358
1117
|
};
|
|
1359
|
-
try {
|
|
1360
|
-
return {
|
|
1361
|
-
...declaration,
|
|
1362
|
-
parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
|
|
1363
|
-
};
|
|
1364
|
-
} catch (error) {
|
|
1365
|
-
if (!isRecursiveJSONSchemaReferenceError(error)) {
|
|
1366
|
-
throw error;
|
|
1367
|
-
}
|
|
1368
|
-
return {
|
|
1369
|
-
...declaration,
|
|
1370
|
-
parametersJsonSchema: tool.inputSchema
|
|
1371
|
-
};
|
|
1372
|
-
}
|
|
1373
1118
|
}
|
|
1374
1119
|
|
|
1375
1120
|
// src/google-json-accumulator.ts
|
|
@@ -1855,10 +1600,10 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1855
1600
|
seed,
|
|
1856
1601
|
// response format:
|
|
1857
1602
|
responseMimeType: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? "application/json" : void 0,
|
|
1858
|
-
|
|
1859
|
-
// so this is needed as an escape hatch:
|
|
1603
|
+
responseJsonSchema: (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && // Google does not support all JSON Schema features in
|
|
1604
|
+
// responseJsonSchema, so this is needed as an escape hatch:
|
|
1860
1605
|
// TODO convert into provider option
|
|
1861
|
-
((_c = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _c : true) ?
|
|
1606
|
+
((_c = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _c : true) ? sanitizeResponseJsonSchema(responseFormat.schema) : void 0,
|
|
1862
1607
|
...(googleOptions == null ? void 0 : googleOptions.audioTimestamp) && {
|
|
1863
1608
|
audioTimestamp: googleOptions.audioTimestamp
|
|
1864
1609
|
},
|