O3-mini is replying in Spanish despite prompts are in English

I’m receiving responses in Spanish even though the system and user prompts are in English. No Spanish is mentioned, and I am forcing the reply to be in the same language.
This is an example:

{
    "model": "o3-mini",
    "messages": [
        {
            "role": "developer",
            "content": "You are PMPilot, an AI chatbot project manager assistant at xxx that can answer questions about xxx features, and project management in general\nYour role is to answer the User Question using the provided Documentation from xxxxxx. If the question is about project management in general, you can provide a general answer, and try to relate it to xxxx.\nThe Documentation is a set of chunks of text and metadata that should be relevant to the User Question. The user must not be made aware of this process, just receive your help.\nIf the question is not about xxxx or project management, politely decline to answer.\nDo not make up information. Only if you don't know the answer, say so and suggest the user contact support.\nUsing markdown, respond in the user's language.\n\n\nOnce you have the answer, reread it to make sure it replies to the User Question, in the original question language, and is clear and concise. Always reply using markdown syntax."
        },
        {
            "role": "user",
            "content": "****************************************************\nDocumentation: CHUNK 1\nMETADATA:\ncontent-hash: b40f4bc2\ndoc-description: This article explains the licensing model and roles in xxxxx.\ndoc-id: c1f4749666\ndoc-title: Licenses and Roles\nurl: https://helpcenter.itmplatform.com/system-settings-and-customization/licenses-and-roles/\nCONTENT:\n## **Common User Scenarios**\n* A user needs to access only to dashboards. This will require a custom role to be created which can only be done with a Full Access license. Unselect all other features and leave access only to the dashboard feature.\n* A Project Managers is not allowed to....\n\n****************************************************\nUser question: can i change my license to full access?"
        }
    ]
}

Any piece of advice?

1 Like

You can add “always reply in the language the user is using unless the user asks for a different one” to your prompt.

“respond in the user’s language” is a phrase that might be difficult to understand for the model. Try around with language variations of the prompt. Change the grammar.

and you can also add multiple examples (the more the better).

“always reply in the language the user is using unless the user asks for a different one for example when the user asks a question in english then you must respond in english.”

Try to see the model as an intern with access to a copy of the internet he made some months ago.

The more likely an intern would get it right with your prompt the better the prompt.

You can also try to see it as a very stupid intern and make prompts like this:

“listen here you stupid punk! You will never use another language other than the one the user was using when they send the prompt to you! Did I make my point clear? Now get back to your virtual desk and be a professional customer support bot! I dare you to make any more mistakes!!”

2 Likes

Thanks, @jochenschultz. I have made the prompt more explicit. Still, I’m suspicious as to why Spanish. It turns out to be our company’s second language.
I will update on any new findings.

1 Like

If it turns out to be useful for anybody, I used old-fashioned libraries to detect the user’s input language and be explicit in the prompt. I used Langdetect in Python and Efficient Language Detector (ELD) for Node.
I tested them against GPT’s language detection. Not only is it faster to use a library, but, in some cases, it is more accurate.
When there is a strong mix (e.g., "Tell me about the project ’ Proyecto Legado Estelar de la Humanidad’), both get confused.

1 Like