@ai-sdk/google 2.0.0-canary.0 → 2.0.0-canary.2
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 +16 -0
- package/dist/index.d.mts +102 -94
- package/dist/index.d.ts +102 -94
- package/dist/index.js +172 -165
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +172 -163
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.d.mts +15 -7
- package/internal/dist/index.d.ts +15 -7
- package/internal/dist/index.js +5 -4
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +5 -4
- package/internal/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -26,12 +26,95 @@ __export(src_exports, {
|
|
26
26
|
module.exports = __toCommonJS(src_exports);
|
27
27
|
|
28
28
|
// src/google-provider.ts
|
29
|
+
var import_provider4 = require("@ai-sdk/provider");
|
29
30
|
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
30
31
|
|
31
|
-
// src/google-generative-ai-
|
32
|
-
var
|
32
|
+
// src/google-generative-ai-embedding-model.ts
|
33
|
+
var import_provider = require("@ai-sdk/provider");
|
34
|
+
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
33
35
|
var import_zod2 = require("zod");
|
34
36
|
|
37
|
+
// src/google-error.ts
|
38
|
+
var import_provider_utils = require("@ai-sdk/provider-utils");
|
39
|
+
var import_zod = require("zod");
|
40
|
+
var googleErrorDataSchema = import_zod.z.object({
|
41
|
+
error: import_zod.z.object({
|
42
|
+
code: import_zod.z.number().nullable(),
|
43
|
+
message: import_zod.z.string(),
|
44
|
+
status: import_zod.z.string()
|
45
|
+
})
|
46
|
+
});
|
47
|
+
var googleFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
|
48
|
+
errorSchema: googleErrorDataSchema,
|
49
|
+
errorToMessage: (data) => data.error.message
|
50
|
+
});
|
51
|
+
|
52
|
+
// src/google-generative-ai-embedding-model.ts
|
53
|
+
var GoogleGenerativeAIEmbeddingModel = class {
|
54
|
+
constructor(modelId, settings, config) {
|
55
|
+
this.specificationVersion = "v1";
|
56
|
+
this.modelId = modelId;
|
57
|
+
this.settings = settings;
|
58
|
+
this.config = config;
|
59
|
+
}
|
60
|
+
get provider() {
|
61
|
+
return this.config.provider;
|
62
|
+
}
|
63
|
+
get maxEmbeddingsPerCall() {
|
64
|
+
return 2048;
|
65
|
+
}
|
66
|
+
get supportsParallelCalls() {
|
67
|
+
return true;
|
68
|
+
}
|
69
|
+
async doEmbed({
|
70
|
+
values,
|
71
|
+
headers,
|
72
|
+
abortSignal
|
73
|
+
}) {
|
74
|
+
if (values.length > this.maxEmbeddingsPerCall) {
|
75
|
+
throw new import_provider.TooManyEmbeddingValuesForCallError({
|
76
|
+
provider: this.provider,
|
77
|
+
modelId: this.modelId,
|
78
|
+
maxEmbeddingsPerCall: this.maxEmbeddingsPerCall,
|
79
|
+
values
|
80
|
+
});
|
81
|
+
}
|
82
|
+
const mergedHeaders = (0, import_provider_utils2.combineHeaders)(
|
83
|
+
await (0, import_provider_utils2.resolve)(this.config.headers),
|
84
|
+
headers
|
85
|
+
);
|
86
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils2.postJsonToApi)({
|
87
|
+
url: `${this.config.baseURL}/models/${this.modelId}:batchEmbedContents`,
|
88
|
+
headers: mergedHeaders,
|
89
|
+
body: {
|
90
|
+
requests: values.map((value) => ({
|
91
|
+
model: `models/${this.modelId}`,
|
92
|
+
content: { role: "user", parts: [{ text: value }] },
|
93
|
+
outputDimensionality: this.settings.outputDimensionality
|
94
|
+
}))
|
95
|
+
},
|
96
|
+
failedResponseHandler: googleFailedResponseHandler,
|
97
|
+
successfulResponseHandler: (0, import_provider_utils2.createJsonResponseHandler)(
|
98
|
+
googleGenerativeAITextEmbeddingResponseSchema
|
99
|
+
),
|
100
|
+
abortSignal,
|
101
|
+
fetch: this.config.fetch
|
102
|
+
});
|
103
|
+
return {
|
104
|
+
embeddings: response.embeddings.map((item) => item.values),
|
105
|
+
usage: void 0,
|
106
|
+
rawResponse: { headers: responseHeaders }
|
107
|
+
};
|
108
|
+
}
|
109
|
+
};
|
110
|
+
var googleGenerativeAITextEmbeddingResponseSchema = import_zod2.z.object({
|
111
|
+
embeddings: import_zod2.z.array(import_zod2.z.object({ values: import_zod2.z.array(import_zod2.z.number()) }))
|
112
|
+
});
|
113
|
+
|
114
|
+
// src/google-generative-ai-language-model.ts
|
115
|
+
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
116
|
+
var import_zod3 = require("zod");
|
117
|
+
|
35
118
|
// src/convert-json-schema-to-openapi-schema.ts
|
36
119
|
function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
37
120
|
if (isEmptyObjectSchema(jsonSchema)) {
|
@@ -130,8 +213,8 @@ function isEmptyObjectSchema(jsonSchema) {
|
|
130
213
|
}
|
131
214
|
|
132
215
|
// src/convert-to-google-generative-ai-messages.ts
|
133
|
-
var
|
134
|
-
var
|
216
|
+
var import_provider2 = require("@ai-sdk/provider");
|
217
|
+
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
135
218
|
function convertToGoogleGenerativeAIMessages(prompt) {
|
136
219
|
var _a, _b;
|
137
220
|
const systemInstructionParts = [];
|
@@ -141,7 +224,7 @@ function convertToGoogleGenerativeAIMessages(prompt) {
|
|
141
224
|
switch (role) {
|
142
225
|
case "system": {
|
143
226
|
if (!systemMessagesAllowed) {
|
144
|
-
throw new
|
227
|
+
throw new import_provider2.UnsupportedFunctionalityError({
|
145
228
|
functionality: "system messages are only supported at the beginning of the conversation"
|
146
229
|
});
|
147
230
|
}
|
@@ -167,7 +250,7 @@ function convertToGoogleGenerativeAIMessages(prompt) {
|
|
167
250
|
} : {
|
168
251
|
inlineData: {
|
169
252
|
mimeType: (_b = part.mimeType) != null ? _b : "image/jpeg",
|
170
|
-
data: (0,
|
253
|
+
data: (0, import_provider_utils3.convertUint8ArrayToBase64)(part.image)
|
171
254
|
}
|
172
255
|
}
|
173
256
|
);
|
@@ -205,12 +288,12 @@ function convertToGoogleGenerativeAIMessages(prompt) {
|
|
205
288
|
}
|
206
289
|
case "file": {
|
207
290
|
if (part.mimeType !== "image/png") {
|
208
|
-
throw new
|
291
|
+
throw new import_provider2.UnsupportedFunctionalityError({
|
209
292
|
functionality: "Only PNG images are supported in assistant messages"
|
210
293
|
});
|
211
294
|
}
|
212
295
|
if (part.data instanceof URL) {
|
213
|
-
throw new
|
296
|
+
throw new import_provider2.UnsupportedFunctionalityError({
|
214
297
|
functionality: "File data URLs in assistant messages are not supported"
|
215
298
|
});
|
216
299
|
}
|
@@ -263,23 +346,8 @@ function getModelPath(modelId) {
|
|
263
346
|
return modelId.includes("/") ? modelId : `models/${modelId}`;
|
264
347
|
}
|
265
348
|
|
266
|
-
// src/google-error.ts
|
267
|
-
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
268
|
-
var import_zod = require("zod");
|
269
|
-
var googleErrorDataSchema = import_zod.z.object({
|
270
|
-
error: import_zod.z.object({
|
271
|
-
code: import_zod.z.number().nullable(),
|
272
|
-
message: import_zod.z.string(),
|
273
|
-
status: import_zod.z.string()
|
274
|
-
})
|
275
|
-
});
|
276
|
-
var googleFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResponseHandler)({
|
277
|
-
errorSchema: googleErrorDataSchema,
|
278
|
-
errorToMessage: (data) => data.error.message
|
279
|
-
});
|
280
|
-
|
281
349
|
// src/google-prepare-tools.ts
|
282
|
-
var
|
350
|
+
var import_provider3 = require("@ai-sdk/provider");
|
283
351
|
function prepareTools(mode, useSearchGrounding, dynamicRetrievalConfig, modelId) {
|
284
352
|
var _a, _b;
|
285
353
|
const tools = ((_a = mode.tools) == null ? void 0 : _a.length) ? mode.tools : void 0;
|
@@ -351,7 +419,7 @@ function prepareTools(mode, useSearchGrounding, dynamicRetrievalConfig, modelId)
|
|
351
419
|
};
|
352
420
|
default: {
|
353
421
|
const _exhaustiveCheck = type;
|
354
|
-
throw new
|
422
|
+
throw new import_provider3.UnsupportedFunctionalityError({
|
355
423
|
functionality: `Unsupported tool choice type: ${_exhaustiveCheck}`
|
356
424
|
});
|
357
425
|
}
|
@@ -388,7 +456,7 @@ function mapGoogleGenerativeAIFinishReason({
|
|
388
456
|
// src/google-generative-ai-language-model.ts
|
389
457
|
var GoogleGenerativeAILanguageModel = class {
|
390
458
|
constructor(modelId, settings, config) {
|
391
|
-
this.specificationVersion = "
|
459
|
+
this.specificationVersion = "v2";
|
392
460
|
this.defaultObjectGenerationMode = "json";
|
393
461
|
this.supportsImageUrls = false;
|
394
462
|
this.modelId = modelId;
|
@@ -419,12 +487,10 @@ var GoogleGenerativeAILanguageModel = class {
|
|
419
487
|
var _a, _b;
|
420
488
|
const type = mode.type;
|
421
489
|
const warnings = [];
|
422
|
-
const googleOptions = (0,
|
490
|
+
const googleOptions = (0, import_provider_utils4.parseProviderOptions)({
|
423
491
|
provider: "google",
|
424
492
|
providerOptions: providerMetadata,
|
425
|
-
schema:
|
426
|
-
responseModalities: import_zod2.z.array(import_zod2.z.enum(["TEXT", "IMAGE"])).nullish()
|
427
|
-
})
|
493
|
+
schema: googleGenerativeAIProviderOptionsSchema
|
428
494
|
});
|
429
495
|
const generationConfig = {
|
430
496
|
// standardized settings:
|
@@ -523,22 +589,22 @@ var GoogleGenerativeAILanguageModel = class {
|
|
523
589
|
var _a, _b, _c, _d, _e;
|
524
590
|
const { args, warnings } = await this.getArgs(options);
|
525
591
|
const body = JSON.stringify(args);
|
526
|
-
const mergedHeaders = (0,
|
527
|
-
await (0,
|
592
|
+
const mergedHeaders = (0, import_provider_utils4.combineHeaders)(
|
593
|
+
await (0, import_provider_utils4.resolve)(this.config.headers),
|
528
594
|
options.headers
|
529
595
|
);
|
530
596
|
const {
|
531
597
|
responseHeaders,
|
532
598
|
value: response,
|
533
599
|
rawValue: rawResponse
|
534
|
-
} = await (0,
|
600
|
+
} = await (0, import_provider_utils4.postJsonToApi)({
|
535
601
|
url: `${this.config.baseURL}/${getModelPath(
|
536
602
|
this.modelId
|
537
603
|
)}:generateContent`,
|
538
604
|
headers: mergedHeaders,
|
539
605
|
body: args,
|
540
606
|
failedResponseHandler: googleFailedResponseHandler,
|
541
|
-
successfulResponseHandler: (0,
|
607
|
+
successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(responseSchema),
|
542
608
|
abortSignal: options.abortSignal,
|
543
609
|
fetch: this.config.fetch
|
544
610
|
});
|
@@ -584,18 +650,18 @@ var GoogleGenerativeAILanguageModel = class {
|
|
584
650
|
async doStream(options) {
|
585
651
|
const { args, warnings } = await this.getArgs(options);
|
586
652
|
const body = JSON.stringify(args);
|
587
|
-
const headers = (0,
|
588
|
-
await (0,
|
653
|
+
const headers = (0, import_provider_utils4.combineHeaders)(
|
654
|
+
await (0, import_provider_utils4.resolve)(this.config.headers),
|
589
655
|
options.headers
|
590
656
|
);
|
591
|
-
const { responseHeaders, value: response } = await (0,
|
657
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils4.postJsonToApi)({
|
592
658
|
url: `${this.config.baseURL}/${getModelPath(
|
593
659
|
this.modelId
|
594
660
|
)}:streamGenerateContent?alt=sse`,
|
595
661
|
headers,
|
596
662
|
body: args,
|
597
663
|
failedResponseHandler: googleFailedResponseHandler,
|
598
|
-
successfulResponseHandler: (0,
|
664
|
+
successfulResponseHandler: (0, import_provider_utils4.createEventSourceResponseHandler)(chunkSchema),
|
599
665
|
abortSignal: options.abortSignal,
|
600
666
|
fetch: this.config.fetch
|
601
667
|
});
|
@@ -746,160 +812,98 @@ function extractSources({
|
|
746
812
|
title: chunk.web.title
|
747
813
|
}));
|
748
814
|
}
|
749
|
-
var contentSchema =
|
750
|
-
role:
|
751
|
-
parts:
|
752
|
-
|
753
|
-
|
754
|
-
text:
|
815
|
+
var contentSchema = import_zod3.z.object({
|
816
|
+
role: import_zod3.z.string(),
|
817
|
+
parts: import_zod3.z.array(
|
818
|
+
import_zod3.z.union([
|
819
|
+
import_zod3.z.object({
|
820
|
+
text: import_zod3.z.string()
|
755
821
|
}),
|
756
|
-
|
757
|
-
functionCall:
|
758
|
-
name:
|
759
|
-
args:
|
822
|
+
import_zod3.z.object({
|
823
|
+
functionCall: import_zod3.z.object({
|
824
|
+
name: import_zod3.z.string(),
|
825
|
+
args: import_zod3.z.unknown()
|
760
826
|
})
|
761
827
|
}),
|
762
|
-
|
763
|
-
inlineData:
|
764
|
-
mimeType:
|
765
|
-
data:
|
828
|
+
import_zod3.z.object({
|
829
|
+
inlineData: import_zod3.z.object({
|
830
|
+
mimeType: import_zod3.z.string(),
|
831
|
+
data: import_zod3.z.string()
|
766
832
|
})
|
767
833
|
})
|
768
834
|
])
|
769
835
|
).nullish()
|
770
836
|
});
|
771
|
-
var groundingChunkSchema =
|
772
|
-
web:
|
773
|
-
retrievedContext:
|
837
|
+
var groundingChunkSchema = import_zod3.z.object({
|
838
|
+
web: import_zod3.z.object({ uri: import_zod3.z.string(), title: import_zod3.z.string() }).nullish(),
|
839
|
+
retrievedContext: import_zod3.z.object({ uri: import_zod3.z.string(), title: import_zod3.z.string() }).nullish()
|
774
840
|
});
|
775
|
-
var groundingMetadataSchema =
|
776
|
-
webSearchQueries:
|
777
|
-
retrievalQueries:
|
778
|
-
searchEntryPoint:
|
779
|
-
groundingChunks:
|
780
|
-
groundingSupports:
|
781
|
-
|
782
|
-
segment:
|
783
|
-
startIndex:
|
784
|
-
endIndex:
|
785
|
-
text:
|
841
|
+
var groundingMetadataSchema = import_zod3.z.object({
|
842
|
+
webSearchQueries: import_zod3.z.array(import_zod3.z.string()).nullish(),
|
843
|
+
retrievalQueries: import_zod3.z.array(import_zod3.z.string()).nullish(),
|
844
|
+
searchEntryPoint: import_zod3.z.object({ renderedContent: import_zod3.z.string() }).nullish(),
|
845
|
+
groundingChunks: import_zod3.z.array(groundingChunkSchema).nullish(),
|
846
|
+
groundingSupports: import_zod3.z.array(
|
847
|
+
import_zod3.z.object({
|
848
|
+
segment: import_zod3.z.object({
|
849
|
+
startIndex: import_zod3.z.number().nullish(),
|
850
|
+
endIndex: import_zod3.z.number().nullish(),
|
851
|
+
text: import_zod3.z.string().nullish()
|
786
852
|
}),
|
787
|
-
segment_text:
|
788
|
-
groundingChunkIndices:
|
789
|
-
supportChunkIndices:
|
790
|
-
confidenceScores:
|
791
|
-
confidenceScore:
|
853
|
+
segment_text: import_zod3.z.string().nullish(),
|
854
|
+
groundingChunkIndices: import_zod3.z.array(import_zod3.z.number()).nullish(),
|
855
|
+
supportChunkIndices: import_zod3.z.array(import_zod3.z.number()).nullish(),
|
856
|
+
confidenceScores: import_zod3.z.array(import_zod3.z.number()).nullish(),
|
857
|
+
confidenceScore: import_zod3.z.array(import_zod3.z.number()).nullish()
|
792
858
|
})
|
793
859
|
).nullish(),
|
794
|
-
retrievalMetadata:
|
795
|
-
|
796
|
-
webDynamicRetrievalScore:
|
860
|
+
retrievalMetadata: import_zod3.z.union([
|
861
|
+
import_zod3.z.object({
|
862
|
+
webDynamicRetrievalScore: import_zod3.z.number()
|
797
863
|
}),
|
798
|
-
|
864
|
+
import_zod3.z.object({})
|
799
865
|
]).nullish()
|
800
866
|
});
|
801
|
-
var safetyRatingSchema =
|
802
|
-
category:
|
803
|
-
probability:
|
804
|
-
probabilityScore:
|
805
|
-
severity:
|
806
|
-
severityScore:
|
807
|
-
blocked:
|
867
|
+
var safetyRatingSchema = import_zod3.z.object({
|
868
|
+
category: import_zod3.z.string(),
|
869
|
+
probability: import_zod3.z.string(),
|
870
|
+
probabilityScore: import_zod3.z.number().nullish(),
|
871
|
+
severity: import_zod3.z.string().nullish(),
|
872
|
+
severityScore: import_zod3.z.number().nullish(),
|
873
|
+
blocked: import_zod3.z.boolean().nullish()
|
808
874
|
});
|
809
|
-
var responseSchema =
|
810
|
-
candidates:
|
811
|
-
|
812
|
-
content: contentSchema.nullish().or(
|
813
|
-
finishReason:
|
814
|
-
safetyRatings:
|
875
|
+
var responseSchema = import_zod3.z.object({
|
876
|
+
candidates: import_zod3.z.array(
|
877
|
+
import_zod3.z.object({
|
878
|
+
content: contentSchema.nullish().or(import_zod3.z.object({}).strict()),
|
879
|
+
finishReason: import_zod3.z.string().nullish(),
|
880
|
+
safetyRatings: import_zod3.z.array(safetyRatingSchema).nullish(),
|
815
881
|
groundingMetadata: groundingMetadataSchema.nullish()
|
816
882
|
})
|
817
883
|
),
|
818
|
-
usageMetadata:
|
819
|
-
promptTokenCount:
|
820
|
-
candidatesTokenCount:
|
821
|
-
totalTokenCount:
|
884
|
+
usageMetadata: import_zod3.z.object({
|
885
|
+
promptTokenCount: import_zod3.z.number().nullish(),
|
886
|
+
candidatesTokenCount: import_zod3.z.number().nullish(),
|
887
|
+
totalTokenCount: import_zod3.z.number().nullish()
|
822
888
|
}).nullish()
|
823
889
|
});
|
824
|
-
var chunkSchema =
|
825
|
-
candidates:
|
826
|
-
|
890
|
+
var chunkSchema = import_zod3.z.object({
|
891
|
+
candidates: import_zod3.z.array(
|
892
|
+
import_zod3.z.object({
|
827
893
|
content: contentSchema.nullish(),
|
828
|
-
finishReason:
|
829
|
-
safetyRatings:
|
894
|
+
finishReason: import_zod3.z.string().nullish(),
|
895
|
+
safetyRatings: import_zod3.z.array(safetyRatingSchema).nullish(),
|
830
896
|
groundingMetadata: groundingMetadataSchema.nullish()
|
831
897
|
})
|
832
898
|
).nullish(),
|
833
|
-
usageMetadata:
|
834
|
-
promptTokenCount:
|
835
|
-
candidatesTokenCount:
|
836
|
-
totalTokenCount:
|
899
|
+
usageMetadata: import_zod3.z.object({
|
900
|
+
promptTokenCount: import_zod3.z.number().nullish(),
|
901
|
+
candidatesTokenCount: import_zod3.z.number().nullish(),
|
902
|
+
totalTokenCount: import_zod3.z.number().nullish()
|
837
903
|
}).nullish()
|
838
904
|
});
|
839
|
-
|
840
|
-
|
841
|
-
var import_provider3 = require("@ai-sdk/provider");
|
842
|
-
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
843
|
-
var import_zod3 = require("zod");
|
844
|
-
var GoogleGenerativeAIEmbeddingModel = class {
|
845
|
-
constructor(modelId, settings, config) {
|
846
|
-
this.specificationVersion = "v1";
|
847
|
-
this.modelId = modelId;
|
848
|
-
this.settings = settings;
|
849
|
-
this.config = config;
|
850
|
-
}
|
851
|
-
get provider() {
|
852
|
-
return this.config.provider;
|
853
|
-
}
|
854
|
-
get maxEmbeddingsPerCall() {
|
855
|
-
return 2048;
|
856
|
-
}
|
857
|
-
get supportsParallelCalls() {
|
858
|
-
return true;
|
859
|
-
}
|
860
|
-
async doEmbed({
|
861
|
-
values,
|
862
|
-
headers,
|
863
|
-
abortSignal
|
864
|
-
}) {
|
865
|
-
if (values.length > this.maxEmbeddingsPerCall) {
|
866
|
-
throw new import_provider3.TooManyEmbeddingValuesForCallError({
|
867
|
-
provider: this.provider,
|
868
|
-
modelId: this.modelId,
|
869
|
-
maxEmbeddingsPerCall: this.maxEmbeddingsPerCall,
|
870
|
-
values
|
871
|
-
});
|
872
|
-
}
|
873
|
-
const mergedHeaders = (0, import_provider_utils4.combineHeaders)(
|
874
|
-
await (0, import_provider_utils4.resolve)(this.config.headers),
|
875
|
-
headers
|
876
|
-
);
|
877
|
-
const { responseHeaders, value: response } = await (0, import_provider_utils4.postJsonToApi)({
|
878
|
-
url: `${this.config.baseURL}/models/${this.modelId}:batchEmbedContents`,
|
879
|
-
headers: mergedHeaders,
|
880
|
-
body: {
|
881
|
-
requests: values.map((value) => ({
|
882
|
-
model: `models/${this.modelId}`,
|
883
|
-
content: { role: "user", parts: [{ text: value }] },
|
884
|
-
outputDimensionality: this.settings.outputDimensionality
|
885
|
-
}))
|
886
|
-
},
|
887
|
-
failedResponseHandler: googleFailedResponseHandler,
|
888
|
-
successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(
|
889
|
-
googleGenerativeAITextEmbeddingResponseSchema
|
890
|
-
),
|
891
|
-
abortSignal,
|
892
|
-
fetch: this.config.fetch
|
893
|
-
});
|
894
|
-
return {
|
895
|
-
embeddings: response.embeddings.map((item) => item.values),
|
896
|
-
usage: void 0,
|
897
|
-
rawResponse: { headers: responseHeaders }
|
898
|
-
};
|
899
|
-
}
|
900
|
-
};
|
901
|
-
var googleGenerativeAITextEmbeddingResponseSchema = import_zod3.z.object({
|
902
|
-
embeddings: import_zod3.z.array(import_zod3.z.object({ values: import_zod3.z.array(import_zod3.z.number()) }))
|
905
|
+
var googleGenerativeAIProviderOptionsSchema = import_zod3.z.object({
|
906
|
+
responseModalities: import_zod3.z.array(import_zod3.z.enum(["TEXT", "IMAGE"])).nullish()
|
903
907
|
});
|
904
908
|
|
905
909
|
// src/google-supported-file-url.ts
|
@@ -950,6 +954,9 @@ function createGoogleGenerativeAI(options = {}) {
|
|
950
954
|
provider.embedding = createEmbeddingModel;
|
951
955
|
provider.textEmbedding = createEmbeddingModel;
|
952
956
|
provider.textEmbeddingModel = createEmbeddingModel;
|
957
|
+
provider.imageModel = (modelId) => {
|
958
|
+
throw new import_provider4.NoSuchModelError({ modelId, modelType: "imageModel" });
|
959
|
+
};
|
953
960
|
return provider;
|
954
961
|
}
|
955
962
|
var google = createGoogleGenerativeAI();
|