Gmail drafts sometimes reply in English – how do I automatically detect the correct language for incoming mail?

Hi everyone,

I have an n8n automation that automatically drafts a reply in Gmail when a new chat or email message arrives (see attached workflow). It works fine in itself, but I notice that the AI model (OpenAI Chat Model in my case) often defaults to English in response even if the original email is in Dutch, German, or French.

Sometimes it picks the correct language, but it usually stays in English.

Is there a simple way (for example, using an additional node) to automatically display the language of the incoming message and hand it over to the AI model so it can respond in that language?

If so:

Which node should I use for this?

How can I best add this to my existing workflow?

Any tips are welcome! :folded_hands:

Perhaps add another AI node to detect the previous AI node’s output language.

If the output language is not what you expected. Translate it again.

2 Likes

Hi,
You can strict the llm to respect in the incoming language by giving strict instructions in the system prompt

1 Like

Thanks Darrel

Thanks Bilal

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.