File tree Expand file tree Collapse file tree 5 files changed +1170
-1
lines changed Expand file tree Collapse file tree 5 files changed +1170
-1
lines changed Original file line number Diff line number Diff line change @@ -276,7 +276,7 @@ export type GeminiVersionString =
276
276
* ```js
277
277
* await ai.generate({
278
278
* prompt: 'hi',
279
- * model: gemini('gemini-1 .5-flash')
279
+ * model: gemini('gemini-2 .5-flash')
280
280
* });
281
281
* ```
282
282
*/
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments