Skip to content

Commit

Permalink
Merge pull request #259 from bespokelabsai/gemini-safety
Browse files Browse the repository at this point in the history
Gemini lower safety constraints
  • Loading branch information
RyanMarten authored Dec 15, 2024
2 parents 879016e + cc4ee05 commit 3e5a919
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,31 @@ def create_api_specific_request(self, generic_request: GenericRequest) -> dict:
if "frequency_penalty" in supported_params and self.frequency_penalty is not None:
request["frequency_penalty"] = self.frequency_penalty

# Add safety settings for Gemini models
if "gemini" in generic_request.model.lower():
request["safety_settings"] = [
{
"category": "HARM_CATEGORY_HARASSMENT",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_NONE",
},
{
"category": "HARM_CATEGORY_CIVIC_INTEGRITY",
"threshold": "BLOCK_NONE",
},
]

return request

async def call_single_request(
Expand Down

0 comments on commit 3e5a919

Please sign in to comment.