gpt4all icon indicating copy to clipboard operation
gpt4all copied to clipboard

Fix chatbot language

Open bennytaccardi opened this issue 1 year ago • 4 comments

Hi, I wonder if there is a possibility to force the language of the chatbot. Fix it in the setup phase and make the chatbot always respond with that language

bennytaccardi avatar Mar 30 '23 10:03 bennytaccardi

Even ChatGPT can't do this, if you speak to it in non-english it frequently replies in English. The only way to force it into a language is really to either ask it directly and have it possess the intellect to understand and apply that request to future messages.

Or for any given prompt scan the response and if it's not in the desired language regenerate the response, which is something you could implement on top of it already, however you'd need to also detect the language, and hopefully not end up in an infinite loop trying to get it to response in one language, but it keeps responding in another.

AjaniBilby avatar Apr 03 '23 08:04 AjaniBilby

Thank you for the answer to my question.

As for the second point, I agree with you that it could be dangerous to implement something like this.

As for the first point, isn't it possible (through a parameter) to force the desired language for this model? I think ChatGPT is pretty good at detecting the most common languages (Spanish, Italian, French, etc). On the other hand, I tried to ask gpt4all a question in Italian and it answered me in English.

bennytaccardi avatar Apr 03 '23 09:04 bennytaccardi

ChatGPT isn't actually aware of what language you're using. You used a set of words in language X, so it spits out words related to your input, which happens to often form an answer since it's really good at prediction. What character set you're using it doesn't even know, it's not represented in it's token system.

AjaniBilby avatar Apr 04 '23 00:04 AjaniBilby

I wantet to open a feature request like this. The times i used ChatGPT it responded in the appropriate language. I'm using english and german, but it never responded in english when i talked in german with ChatGPT. So when asking in german, i will get a german answer. If i ask in english, i get an english answer.

I tried it now with gpt4all-l13b-snoozy (i think?) and i asked in english if it understands and talks german, response yes in english, first question in german, answer in english, "explain in german" in german and then it talked german for one time only. After that, english again.

I'm basically asking if they can answer in german and the answer to that question is in german but then english after that. And its kinda funny, because i asked "Kannst du ab jetzt immer in deutsch antworten, wenn ich in deutsch etwas schreibe?" (From now on, can you always reply in German when I write something in German?) and the answer was "Ja, ich kann ab sofort nur Deutsch antworten, wenn Sie in Deutsch schreiben." (Yes, from now on I can only reply in German if you write in German.) - and the next answer was english again :D

No chance to get it to answer consistently in german.

natrius avatar Jun 03 '23 20:06 natrius

I want this feature too, but I don't know how to do it.

dzungpv avatar Jun 08 '23 11:06 dzungpv

I tried it now with gpt4all-l13b-snoozy (i think?) and i asked in english if it understands and talks german, response yes in english, first question in german, answer in english, "explain in german" in german and then it talked german for one time only. After that, english again.

I want this feature too, but I don't know how to do it.

Try a different model then. They vary a lot in how good they are at following instructions. I forgot which it was (maybe mpt-7b-chat) but I did have a conversation some time ago where I instructed it at the very top with something like: "Always respond in Spanish." and it did just that.

You might have to try to word it differently, like "the assistant always responds in <language>", "from now on ...", "the conversation is in <language>". Or you might have to remind them at some point if they fail to do so.

cosmic-snow avatar Jun 08 '23 11:06 cosmic-snow

I might have to try different wordings, yes.

But when using vicuna-13b-1.1-q4_2 or vicuna-7b-1.1-q4_2 GPT4all responds in german when asking a german question. nous-gpt4-vicuna-13b seems to work as well.

Basically: Look at another model that does what you like the best. From what i looked up the days now it seems different models seem to work best for different usecases. Will try with nous-gpt4-vicuna-13b for now, i think.

natrius avatar Jun 08 '23 12:06 natrius

It seems to be possible to force gpt4all to a language if you go to

  • Settings
  • "Prompt Template:"
  • Translate Strings

In case of german translate to

### Mensch:
%1
### Assistent:

https://www.heise.de/forum/heise-online/Kommentare/GPT4All-ausprobiert-Das-eigene-ChatGPT-ohne-Internetverbindung/Tipp-Wie-man-deutsche-Antworten-bekommt/thread-7362699/

Found here. And if thats the case and it helps a lot for a preferred language, it might be worth thinking about doing something here. "Default template", "Translated default: ger" and "Custom template" as a dropdown, for example.

Maybe it helps others :)

natrius avatar Jun 12 '23 13:06 natrius