I’ve spent a long time setting up Google Gemini. Now that I’ve:
- Setup a Google Workspace
- Connected a GCP Billing Account (If you don’t do this, you’ll receive
Status 429 exceeds quota
(?)) - Ect.
Anyway, I can now send API requests. These requests contain very large text files. Now I’m getting the error block_reason: OTHER
.
I set the safety_settings
as shown below, but still receiving the block…
How do I determine what text in this 200-500k token text is the culprit?
Here is the function I’m using:
def start_gemini_chat(api_key, system_message, user_message):
genai.configure(api_key=api_key)
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"}]
generation_config = {
"temperature": 0,
"max_output_tokens": 8192
}
model = genai.GenerativeModel(
model_name="gemini-1.5-pro-latest",
generation_config=generation_config,
system_instruction=system_message,
safety_settings=safety_settings
)
chat_session = model.start_chat(history=[])
response = chat_session.send_message(user_message)
return response.text