Unable to get expected result with AI studio but https://gemini.google.com is fine

I’m trying to use Gemini to add new translation for new languages into an existing translations array. Here is the prompt

“”"
#Description
I will give you an array of translation objects (in json format) of different languages and its related metadata. All element’s content of the translation array representing the same meaning.
Your task is:
1. Understand the schema of the provided translation object - its content, metadata
2. See that each translation object has the same meaning, translate it into the new target language
3. Aggregate new translations into a single array with the same schema as the provided one

Requirements:
    - Ensuring that the connotation and meaning of the original are preserved.
    - The input has its own format like rich text, new line, etc... you must keep the original format as much as possible.
    - The "language" field of your response for the target language must respect language code style of the original
    - Translation object has a fixed schema (see the provided array) and you must keep all of its fields especially "_id.['$oid']" field.
    - Only return the new translations array, don't elaborate

Notices:
    - Double quote inside json string value
    - If no translation/meaningful is provided, just return empty array

#Input
###Original translations array

[
  {
    "value": "Chief Technology Officer",
    "_id": {
      "$oid": ""
    },
    "language": "en"
  }
]

###target languages
[‘(ko) Korean Standard)’, ‘(es) Universal Spanish’, ‘(pt-BR) Brazilian Portuguese’]

Output

Translations array

[<new translations>]

“”"
This prompt works fine with ChatGPT, but occasional mistranslations occur so I think Gemini may help (with google transtate data - I think). The prompt seem over-complicated but the input translations array schema varies, and the prompt work best for me (with ChatGPT)

The problem is every time I try the prompt via AI studio I got “Probability of unsafe content: Content not permitted” even if all the filters are off. If I use API it raise “finish_reason: OTHER” error. What interesting is that I (almost) always get the expected response with https://gemini.google.com (same prompt)

So I don’t know how to make it work…

2 Likes

Welcome to the forum!

Your prompt is indeed somewhat complex, the Gemini models respond well if you give them a few examples to start them out.

You could be running into a peculiar problem with Korean reported here: Gemini Stop responding when certain Korean word(normally used or a typical person name) is included in the system instruction or user prompt

One way to check is to look for instances of the pattern that the post describes as problematic. Another quick way to check is to remove Korean from the target languages and see if that makes the OTHER problem go away.

The finishReason OTHER has issues, in my opinion.

1 Like

Yes, I agree with you that the prompt is complex. However, I have been tested with dozens of prompts, and this one gives me the most comprehensive result (in terms of schema). The input JSON varies so much that I’m not even sure what its schema is.

My surprise is that the public Gemini page (https://gemini.google.com) was able to give me what I expected, but the AI Studio did not

I get the exact error “ill see if I can modify your code and report back.”

The api plugin is giving me issues aswell regards translation font🥴

Yes, and my best solution is switching to OpenAI or Claude :smiley: