Closed clemortel closed 6 months ago
Hi, thanks for reporting this issue. It seems that Gemini provides citations for some messages and the parsing of those citations fails. Could you try to find out which messages in your arb_fr.arb cause it to fail? It would help me with reproducing it
I wanted to try again, but now i have another exception `Unhandled exception: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
It looks like there is an issue with your token. How are you providing the token? With envvar, l10n.yaml or command argument? Can you try using a command argument arb_translate --api-key $(gcloud auth print-access-token)
?
*If you were using arb-translate-api-key
in l10n.yaml for API key you have to remove it because it has higher priority than the command argument.
I was using envvar, now it work with the command argument, thanks
I have found messages causing problems, it's all messages containing placeholders
Can you please send me an example and verify that an ARB file with only this example fails as well?
{
"yourExample": "Your example... {placeholder}",
@"yourExample": {
...
}
}
Her is my code example not working
{ "@@locale": "fr", "groupMemberAddDialogContent": "Ajouter {pseudo} à", "@groupMemberAddDialogContent": { "description": "Content of the dialog when try to add member", "placeholders": { "pseudo": { "type": "String", "example": "Diseedant" } } } }
Thank you for the example. I was able to reproduce the problem. The issue is upstream in the google_generative_ai
package. I have created an issue there (https://github.com/google/generative-ai-dart/issues/75) and I will open a PR shortly to fix it. I will also create a branch here with dependency on the fixed version of google_generative_ai
unit the fix is released by Google on pub
It was a bit harder than I expected there is also a small difference between vertex ai API and Gemini API in citations but I've implemented the temporary workaround. Try using the version from git.
dart pub global deactivate arb_translate
dart pub global activate -sgit https://github.com/leancodepl/arb_translate.git --git-ref citation-source-parsing-issue-workaround
Thanks for the fast workaround, however i have now another problem : Provided API key is not valid I've tried to regenerate one and tried with l10.Yaml file and the --api-key also
Please send me a screenshot showing the command you are using (with --api-key
) and the result
Can you try calling exactly this?
arb_translate --api-key $(gcloud auth print-access-token)
Same :
Any news on this ? The package still seem very awesome if working
I am having the same problem, "Translating 1 terms for locale de...
Provided API key is not valid" And I used arb_translate --api-key $(gcloud auth print-access-token)
. I am in Germany.
I've fixed the original citation parsing issue and I think I've found the source and fixed the invalid API key. Setting model provider in l10n.yaml wasn't working correctly so arb_translate
was trying to call Gemini API with Vertex AI key. Check out the new 0.1.2 version
Hi LeanCode team,
Very good work, thank for this package !
So i'm in France, with following configuration :
`Unhandled exception: FormatException: Unhandled CitationMetadata format
0 _parseCitationMetadata (package:google_generative_ai/src/api.dart:576:10)
1 _parseCandidate (package:google_generative_ai/src/api.dart:514:15)
2 MappedListIterable.elementAt (dart:_internal/iterable.dart:425:31)
3 ListIterator.moveNext (dart:_internal/iterable.dart:354:26)
4 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189:27)
5 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
6 new List.of (dart:core-patch/array_patch.dart:39:18)
7 ListIterable.toList (dart:_internal/iterable.dart:224:7)
8 parseGenerateContentResponse (package:google_generative_ai/src/api.dart:470:41)
9 GenerativeModel.generateContent (package:google_generative_ai/src/model.dart:127:14)