Closed VinceMack closed 6 months ago
Hi,
You can pass safety settings for Model in constructor. e.g.
var model = new GenerativeModel(apiKey, new ModelParams()
{
SafetySettings = new[]
{
new SafetySetting()
{
Category = HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
Threshold = HarmBlockThreshold.BLOCK_ONLY_HIGH
}
}
});
Alternatively, you can create a request manually to specify the safety settings. e.g.
var model = new GenerativeModel(apiKey);
var res = await model.GenerateContentAsync(new GenerateContentRequest()
{
Contents = new[] { RequestExtensions.FormatGenerateContentInput("Tell me about terrorism") },
SafetySettings = new[]
{
new SafetySetting()
{
Category = HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
Threshold = HarmBlockThreshold.BLOCK_ONLY_HIGH
}
}
});
if you have any suggestion to simplify this, I would happily implement it into the library.
In your Enums.cs file, I noticed that you’ve defined enumeration types for safety settings. However, it appears there isn’t a straightforward way to specify these safety settings for the model which, from what I can tell, appears to be using the defaults from Google. Does version 1.12 of the your unofficial SDK accommodate customizing the safety settings?