Skip to content

Commit 572db35

Browse files
authored
feat(js/plugins/google-genai): Added Gemini for VertexAI (#3121)
1 parent b614b48 commit 572db35

File tree

5 files changed

+1170
-1
lines changed

5 files changed

+1170
-1
lines changed

js/plugins/google-genai/src/googleai/gemini.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export type GeminiVersionString =
276276
* ```js
277277
* await ai.generate({
278278
* prompt: 'hi',
279-
* model: gemini('gemini-1.5-flash')
279+
* model: gemini('gemini-2.5-flash')
280280
* });
281281
* ```
282282
*/
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import { z } from 'genkit';
18+
import {
19+
HarmBlockThreshold,
20+
HarmCategory,
21+
SafetySetting,
22+
} from '../common/types';
23+
import { SafetySettingsSchema } from './gemini';
24+
25+
export function toGeminiSafetySettings(
26+
genkitSettings?: z.infer<typeof SafetySettingsSchema>[]
27+
): SafetySetting[] | undefined {
28+
if (!genkitSettings) return undefined;
29+
return genkitSettings.map((s) => {
30+
return {
31+
category: s.category as HarmCategory,
32+
threshold: s.threshold as HarmBlockThreshold,
33+
};
34+
});
35+
}

0 commit comments

Comments
 (0)