@core-ai/google-genai 0.6.0 → 0.7.0
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/dist/index.d.ts +17 -76
- package/dist/index.js +16 -11
- package/package.json +4 -5
package/dist/index.d.ts
CHANGED
|
@@ -20,41 +20,19 @@ type GoogleReasoningMetadata = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
declare const googleGenerateProviderOptionsSchema: z.ZodObject<{
|
|
23
|
-
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString
|
|
23
|
+
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
24
|
frequencyPenalty: z.ZodOptional<z.ZodNumber>;
|
|
25
25
|
presencePenalty: z.ZodOptional<z.ZodNumber>;
|
|
26
26
|
seed: z.ZodOptional<z.ZodNumber>;
|
|
27
27
|
topK: z.ZodOptional<z.ZodNumber>;
|
|
28
|
-
},
|
|
29
|
-
stopSequences?: string[] | undefined;
|
|
30
|
-
frequencyPenalty?: number | undefined;
|
|
31
|
-
presencePenalty?: number | undefined;
|
|
32
|
-
seed?: number | undefined;
|
|
33
|
-
topK?: number | undefined;
|
|
34
|
-
}, {
|
|
35
|
-
stopSequences?: string[] | undefined;
|
|
36
|
-
frequencyPenalty?: number | undefined;
|
|
37
|
-
presencePenalty?: number | undefined;
|
|
38
|
-
seed?: number | undefined;
|
|
39
|
-
topK?: number | undefined;
|
|
40
|
-
}>;
|
|
28
|
+
}, z.core.$strict>;
|
|
41
29
|
type GoogleGenerateProviderOptions = z.infer<typeof googleGenerateProviderOptionsSchema>;
|
|
42
30
|
declare const googleEmbedProviderOptionsSchema: z.ZodObject<{
|
|
43
31
|
taskType: z.ZodOptional<z.ZodString>;
|
|
44
32
|
title: z.ZodOptional<z.ZodString>;
|
|
45
33
|
mimeType: z.ZodOptional<z.ZodString>;
|
|
46
34
|
autoTruncate: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
-
},
|
|
48
|
-
taskType?: string | undefined;
|
|
49
|
-
title?: string | undefined;
|
|
50
|
-
mimeType?: string | undefined;
|
|
51
|
-
autoTruncate?: boolean | undefined;
|
|
52
|
-
}, {
|
|
53
|
-
taskType?: string | undefined;
|
|
54
|
-
title?: string | undefined;
|
|
55
|
-
mimeType?: string | undefined;
|
|
56
|
-
autoTruncate?: boolean | undefined;
|
|
57
|
-
}>;
|
|
35
|
+
}, z.core.$strict>;
|
|
58
36
|
type GoogleEmbedProviderOptions = z.infer<typeof googleEmbedProviderOptionsSchema>;
|
|
59
37
|
declare const googleImageProviderOptionsSchema: z.ZodObject<{
|
|
60
38
|
outputGcsUri: z.ZodOptional<z.ZodString>;
|
|
@@ -62,8 +40,17 @@ declare const googleImageProviderOptionsSchema: z.ZodObject<{
|
|
|
62
40
|
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
63
41
|
guidanceScale: z.ZodOptional<z.ZodNumber>;
|
|
64
42
|
seed: z.ZodOptional<z.ZodNumber>;
|
|
65
|
-
safetyFilterLevel: z.ZodOptional<z.ZodEnum<
|
|
66
|
-
|
|
43
|
+
safetyFilterLevel: z.ZodOptional<z.ZodEnum<{
|
|
44
|
+
BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
|
|
45
|
+
BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
|
|
46
|
+
BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
|
|
47
|
+
BLOCK_NONE: "BLOCK_NONE";
|
|
48
|
+
}>>;
|
|
49
|
+
personGeneration: z.ZodOptional<z.ZodEnum<{
|
|
50
|
+
DONT_ALLOW: "DONT_ALLOW";
|
|
51
|
+
ALLOW_ADULT: "ALLOW_ADULT";
|
|
52
|
+
ALLOW_ALL: "ALLOW_ALL";
|
|
53
|
+
}>>;
|
|
67
54
|
includeSafetyAttributes: z.ZodOptional<z.ZodBoolean>;
|
|
68
55
|
includeRaiReason: z.ZodOptional<z.ZodBoolean>;
|
|
69
56
|
language: z.ZodOptional<z.ZodString>;
|
|
@@ -73,41 +60,7 @@ declare const googleImageProviderOptionsSchema: z.ZodObject<{
|
|
|
73
60
|
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
74
61
|
imageSize: z.ZodOptional<z.ZodString>;
|
|
75
62
|
enhancePrompt: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
-
},
|
|
77
|
-
seed?: number | undefined;
|
|
78
|
-
outputGcsUri?: string | undefined;
|
|
79
|
-
negativePrompt?: string | undefined;
|
|
80
|
-
aspectRatio?: string | undefined;
|
|
81
|
-
guidanceScale?: number | undefined;
|
|
82
|
-
safetyFilterLevel?: "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | undefined;
|
|
83
|
-
personGeneration?: "DONT_ALLOW" | "ALLOW_ADULT" | "ALLOW_ALL" | undefined;
|
|
84
|
-
includeSafetyAttributes?: boolean | undefined;
|
|
85
|
-
includeRaiReason?: boolean | undefined;
|
|
86
|
-
language?: string | undefined;
|
|
87
|
-
outputMimeType?: string | undefined;
|
|
88
|
-
outputCompressionQuality?: number | undefined;
|
|
89
|
-
addWatermark?: boolean | undefined;
|
|
90
|
-
labels?: Record<string, string> | undefined;
|
|
91
|
-
imageSize?: string | undefined;
|
|
92
|
-
enhancePrompt?: boolean | undefined;
|
|
93
|
-
}, {
|
|
94
|
-
seed?: number | undefined;
|
|
95
|
-
outputGcsUri?: string | undefined;
|
|
96
|
-
negativePrompt?: string | undefined;
|
|
97
|
-
aspectRatio?: string | undefined;
|
|
98
|
-
guidanceScale?: number | undefined;
|
|
99
|
-
safetyFilterLevel?: "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | undefined;
|
|
100
|
-
personGeneration?: "DONT_ALLOW" | "ALLOW_ADULT" | "ALLOW_ALL" | undefined;
|
|
101
|
-
includeSafetyAttributes?: boolean | undefined;
|
|
102
|
-
includeRaiReason?: boolean | undefined;
|
|
103
|
-
language?: string | undefined;
|
|
104
|
-
outputMimeType?: string | undefined;
|
|
105
|
-
outputCompressionQuality?: number | undefined;
|
|
106
|
-
addWatermark?: boolean | undefined;
|
|
107
|
-
labels?: Record<string, string> | undefined;
|
|
108
|
-
imageSize?: string | undefined;
|
|
109
|
-
enhancePrompt?: boolean | undefined;
|
|
110
|
-
}>;
|
|
63
|
+
}, z.core.$strict>;
|
|
111
64
|
type GoogleImageProviderOptions = z.infer<typeof googleImageProviderOptionsSchema>;
|
|
112
65
|
declare module '@core-ai/core-ai' {
|
|
113
66
|
interface GenerateProviderOptions {
|
|
@@ -121,24 +74,12 @@ declare module '@core-ai/core-ai' {
|
|
|
121
74
|
}
|
|
122
75
|
}
|
|
123
76
|
declare const googleProviderOptionsSchema: z.ZodObject<{
|
|
124
|
-
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString
|
|
77
|
+
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
125
78
|
frequencyPenalty: z.ZodOptional<z.ZodNumber>;
|
|
126
79
|
presencePenalty: z.ZodOptional<z.ZodNumber>;
|
|
127
80
|
seed: z.ZodOptional<z.ZodNumber>;
|
|
128
81
|
topK: z.ZodOptional<z.ZodNumber>;
|
|
129
|
-
},
|
|
130
|
-
stopSequences?: string[] | undefined;
|
|
131
|
-
frequencyPenalty?: number | undefined;
|
|
132
|
-
presencePenalty?: number | undefined;
|
|
133
|
-
seed?: number | undefined;
|
|
134
|
-
topK?: number | undefined;
|
|
135
|
-
}, {
|
|
136
|
-
stopSequences?: string[] | undefined;
|
|
137
|
-
frequencyPenalty?: number | undefined;
|
|
138
|
-
presencePenalty?: number | undefined;
|
|
139
|
-
seed?: number | undefined;
|
|
140
|
-
topK?: number | undefined;
|
|
141
|
-
}>;
|
|
82
|
+
}, z.core.$strict>;
|
|
142
83
|
type GoogleProviderOptions = GoogleGenerateProviderOptions;
|
|
143
84
|
|
|
144
85
|
export { type GoogleEmbedProviderOptions, type GoogleGenAIProvider, type GoogleGenAIProviderOptions, type GoogleGenerateProviderOptions, type GoogleImageProviderOptions, type GoogleProviderOptions as GoogleModelProviderOptions, type GoogleReasoningMetadata, createGoogleGenAI, googleEmbedProviderOptionsSchema, googleGenerateProviderOptionsSchema, googleImageProviderOptionsSchema, googleProviderOptionsSchema };
|
package/dist/index.js
CHANGED
|
@@ -14,8 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
FunctionCallingConfigMode
|
|
16
16
|
} from "@google/genai";
|
|
17
|
-
import {
|
|
18
|
-
import { getProviderMetadata } from "@core-ai/core-ai";
|
|
17
|
+
import { getProviderMetadata, zodSchemaToJsonSchema } from "@core-ai/core-ai";
|
|
19
18
|
|
|
20
19
|
// src/model-capabilities.ts
|
|
21
20
|
var DEFAULT_CAPABILITIES = {
|
|
@@ -25,6 +24,18 @@ var DEFAULT_CAPABILITIES = {
|
|
|
25
24
|
}
|
|
26
25
|
};
|
|
27
26
|
var MODEL_CAPABILITIES = {
|
|
27
|
+
"gemini-3.1-pro": {
|
|
28
|
+
reasoning: {
|
|
29
|
+
thinkingParam: "thinkingLevel",
|
|
30
|
+
canDisableThinking: false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"gemini-3.1-flash-lite-preview": {
|
|
34
|
+
reasoning: {
|
|
35
|
+
thinkingParam: "thinkingLevel",
|
|
36
|
+
canDisableThinking: false
|
|
37
|
+
}
|
|
38
|
+
},
|
|
28
39
|
"gemini-3-pro": {
|
|
29
40
|
reasoning: {
|
|
30
41
|
thinkingParam: "thinkingLevel",
|
|
@@ -260,8 +271,7 @@ function convertTools(tools) {
|
|
|
260
271
|
const functionDeclarations = Object.values(
|
|
261
272
|
tools
|
|
262
273
|
).map((tool) => {
|
|
263
|
-
const schema =
|
|
264
|
-
const { $schema: _schema, ...parametersJsonSchema } = schema;
|
|
274
|
+
const { $schema: _schema, ...parametersJsonSchema } = zodSchemaToJsonSchema(tool.parameters);
|
|
265
275
|
return {
|
|
266
276
|
name: tool.name,
|
|
267
277
|
description: tool.description,
|
|
@@ -307,11 +317,7 @@ function convertToolChoice(choice) {
|
|
|
307
317
|
};
|
|
308
318
|
}
|
|
309
319
|
function getStructuredOutputToolName(options) {
|
|
310
|
-
|
|
311
|
-
if (trimmedName && trimmedName.length > 0) {
|
|
312
|
-
return trimmedName;
|
|
313
|
-
}
|
|
314
|
-
return DEFAULT_STRUCTURED_OUTPUT_TOOL_NAME;
|
|
320
|
+
return options.schemaName?.trim() || DEFAULT_STRUCTURED_OUTPUT_TOOL_NAME;
|
|
315
321
|
}
|
|
316
322
|
function createStructuredOutputOptions(options) {
|
|
317
323
|
const toolName = getStructuredOutputToolName(options);
|
|
@@ -375,12 +381,11 @@ function createGenerateRequest(modelId, options) {
|
|
|
375
381
|
...mapGoogleProviderOptionsToConfig(googleOptions),
|
|
376
382
|
...options.signal ? { abortSignal: options.signal } : {}
|
|
377
383
|
};
|
|
378
|
-
|
|
384
|
+
return {
|
|
379
385
|
model: modelId,
|
|
380
386
|
contents: convertedMessages.contents,
|
|
381
387
|
config: requestConfig
|
|
382
388
|
};
|
|
383
|
-
return baseRequest;
|
|
384
389
|
}
|
|
385
390
|
function mapSamplingToConfig(options) {
|
|
386
391
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@core-ai/google-genai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Google GenAI provider package for @core-ai/core-ai",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Omnifact (https://omnifact.ai)",
|
|
@@ -43,12 +43,11 @@
|
|
|
43
43
|
"test:watch": "vitest"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@core-ai/core-ai": "^0.
|
|
47
|
-
"@google/genai": "^1.42.0"
|
|
48
|
-
"zod-to-json-schema": "^3.25.1"
|
|
46
|
+
"@core-ai/core-ai": "^0.7.0",
|
|
47
|
+
"@google/genai": "^1.42.0"
|
|
49
48
|
},
|
|
50
49
|
"peerDependencies": {
|
|
51
|
-
"zod": "^
|
|
50
|
+
"zod": "^4.0.0"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
53
|
"@core-ai/eslint-config": "*",
|