Skip to content

Commit 8255c11

Browse files
committed
add safety settings arg
1 parent 311d922 commit 8255c11

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

x-pack/packages/kbn-langchain/server/language_models/gemini_chat.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77

88
import {
99
Content,
10-
Part,
10+
EnhancedGenerateContentResponse,
1111
FunctionCallPart,
1212
FunctionResponsePart,
13-
POSSIBLE_ROLES,
14-
EnhancedGenerateContentResponse,
1513
GenerateContentRequest,
16-
TextPart,
17-
InlineDataPart,
1814
GenerateContentResult,
15+
HarmBlockThreshold,
16+
HarmCategory,
17+
InlineDataPart,
18+
POSSIBLE_ROLES,
19+
Part,
20+
TextPart,
1921
} from '@google/generative-ai';
2022
import { ActionsClient } from '@kbn/actions-plugin/server';
2123
import { PublicMethodsOf } from '@kbn/utility-types';
@@ -57,6 +59,12 @@ export class ActionsClientGeminiChatModel extends ChatGoogleGenerativeAI {
5759
...props,
5860
apiKey: 'asda',
5961
maxOutputTokens: props.maxTokens ?? 2048,
62+
safetySettings: [
63+
{
64+
category: HarmCategory.HARM_CATEGORY_HARASSMENT,
65+
threshold: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE,
66+
},
67+
],
6068
});
6169
// LangChain needs model to be defined for logging purposes
6270
this.model = props.model ?? this.model;

0 commit comments

Comments
 (0)