leancodepl / arb_translate

A command-line tool for automatically adding missing message translations to ARB files using Google Gemini LLM by LeanCode
https://leancode.co
Apache License 2.0
54 stars 5 forks source link

GenerativeAIException: Response was blocked due to safety #4

Closed tbm98 closed 7 months ago

tbm98 commented 9 months ago
No terms to translate for locale ar
No terms to translate for locale de
Translating 91 terms for locale es...
Translated batch 3/3
Translated batch 1/3
Unhandled exception:
GenerativeAIException: Response was blocked due to safety
#0      GenerateContentResponse.text (package:google_generative_ai/src/api.dart:57:13)
#1      GeminiTranslationDelegate._translateBatch (package:arb_translate/src/translation_delegates/gemini_translation_delegate.dart:130:59)
<asynchronous suspension>
#2      Future.wait.<anonymous closure> (dart:async/future.dart:518:21)
<asynchronous suspension>
#3      GeminiTranslationDelegate.translate (package:arb_translate/src/translation_delegates/gemini_translation_delegate.dart:65:28)
<asynchronous suspension>
#4      _translateBundle (package:arb_translate/src/translate.dart:73:25)
<asynchronous suspension>
#5      translate (package:arb_translate/src/translate.dart:38:5)
<asynchronous suspension>
#6      main (file:///Users/tbm98/.pub-cache/hosted/pub.dev/arb_translate-0.1.0/bin/arb_translate.dart:49:3)
<asynchronous suspension>
RobertOdrowaz commented 9 months ago

Thanks for reporting this. We can probably send more permissive safety settings to Gemini or expose them as an option. Could you try to pinpoint which term seems to trigger this so I can reproduce it more easily?

tbm98 commented 9 months ago

I just translate regular text and don't configure anything special. The error appears only when large amounts of translation are needed

RobertOdrowaz commented 7 months ago

The new version (0.1.3) includes flag --disable-safety which disables Gemini safety settings (it may require some configuration on your GCP account as well)