-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unknown error due to some settings #7
Comments
I know the root cause now. The Here is what I think. The technical details should be hidden from the library user. The model should be reuse between generatecontent and counttokens. So maybe we can change At this moment, I have to write two different var modelCountTokens = googleAI.GenerativeModel(model: Model.GeminiPro);
var modelGenerateContent = googleAI.GenerativeModel(model: Model.GeminiPro,
generationConfig: new GenerationConfig()
{
TopK = 1,
TopP = 1,
Temperature = 0.9f
},
safetySettings: new List<SafetySetting>()
{
new SafetySetting() { Category = HarmCategory.HarmCategoryHarassment, Threshold = HarmBlockThreshold.BlockOnlyHigh },
new SafetySetting() { Category = HarmCategory.HarmCategoryHateSpeech, Threshold = HarmBlockThreshold.BlockOnlyHigh },
new SafetySetting() { Category = HarmCategory.HarmCategorySexuallyExplicit, Threshold = HarmBlockThreshold.BlockOnlyHigh },
new SafetySetting() { Category = HarmCategory.HarmCategoryDangerousContent, Threshold = HarmBlockThreshold.BlockOnlyHigh }
}); |
Is this related to #8 while using SafetySettings associated with PaLM 2 models? |
New version 0.9.1 should make it clearer. Plus, there is the official documentation about Safety settings in Gemini that apply. Hope this helps. Closing the issue (for now). |
The current ( var response = await model.GenerateContent(prompt,
generationConfig: new GenerationConfig()
{
TopK = 1,
TopP = 1,
Temperature = 0.9f
},
safetySettings: new List<SafetySetting>()
{
new SafetySetting() { Category = HarmCategory.HarmCategoryHarassment, Threshold = HarmBlockThreshold.BlockOnlyHigh },
new SafetySetting() { Category = HarmCategory.HarmCategoryHateSpeech, Threshold = HarmBlockThreshold.BlockOnlyHigh },
new SafetySetting() { Category = HarmCategory.HarmCategorySexuallyExplicit, Threshold = HarmBlockThreshold.BlockOnlyHigh },
new SafetySetting() { Category = HarmCategory.HarmCategoryDangerousContent, Threshold = HarmBlockThreshold.BlockOnlyHigh }
}); |
Cool, thanks for the feedback. The ones you configure at the model level apply to all requests following whereas the attributes you pass into a request are for that request only. See GenerateContent(string) as an example. Hmm, just noticed that same is currently missing with
Going to add this and to |
The following code will produce
Response status code does not indicate success: 400 (Bad Request).
error. I have no idea.LINQPad Query: https://share.linqpad.net/entk5npb.linq
The text was updated successfully, but these errors were encountered: