Translator Agent with manual KB answers
# 🤝help
e
Hello! I have a short question. As you can see in the screenshot, the bot perfectly understands the Spanish question, but answers in English. Is that because I do manual KB answering, how can I make the bot answer in the user's language? My translator agent has everything enabled and the node has translator agent enabled as well. https://cdn.discordapp.com/attachments/1227882704683667456/1227882704905703526/image.png?ex=662a05e1&is=661790e1&hm=b356246c5f40156031162420f66907ec58e73fc4d91ac6d8329a123161b75b4b&
f
Hey there, Can you send me a screenshot of your translator agent settings?
@fresh-fireman-491
To not waste your time completely, I have a quick other question 🙂 If I want the bots answers to be shorter, should I tell it to the "query knowledge base" card or the personality agent?
f
Yes, you can do that in the knowledge agent settings.
You could try either. There are a lot of options. I would recommend you to just try a lot of different things, and see what works the best for you.

https://www.youtube.com/watch?v=vAaCudOUwuc&pp=ygUkYm90cHJlc3MgaG93IHRvIG1hbmlwdWxhdGUgQm90cHJlc3Mg

e
@fresh-fireman-491 Translation issue again, any ideas why does the bot detect the finnish language correctly, translates the reply, but the next ones are in english although they normally translate to the other language too. https://cdn.discordapp.com/attachments/1227882704683667456/1229115175529873468/image.png?ex=662e81b5&is=661c0cb5&hm=9201521a9a66801ccaf52802393835628c87b16c88794d37bf44f5c296758c66&
Is it because I wrote "hi" in the beginning?
Works with spanish but not with finnish. How could it be that one node understands it knows to translate the answer to finnish but the following cards are still in english, which are usually translated too? I have 0 idea how its even possible, maybe the language detection at every turn screws with something? https://cdn.discordapp.com/attachments/1227882704683667456/1229117393498804224/image.png?ex=662e83c6&is=661c0ec6&hm=aa6465c45df178e8407ba80dd2c36687dd98a6361bdaeb0e2311d54a8a864ab4&
f
That is weird. Let me just send this to the Botpress team
e
Thank you!
g
Hi. Thanks for the response. @User But In My case it doesn't even work at all. I am having a challenge. I set the bot to automatically detect the users language then respond in starting the conversation. In my assumption I feel that this should control all the outputs of the chat henceforth. But the challenge is the knowledge base doesn't translate to the detected language. It always outputs in english. For instance. My bot starts out with requesting the user to type in their chosen language for detection. This input is stored in a user.lang variable. The AI task checks input in user.lang the conversation history, and passes the detected language to the language's ISO stored in a variable called userlangISO Then using and execute code card, we pass the detected ISO in userlangISO to the translator which then changes its response language based on language detected, and responds on that detected language. This flow Is correct for the bot response. But it doesn't work for the output of the knowledge base. I know I have something wrong somewhere and I was hoping If there Is a known way to fix this.?
f
Hey there, That sounds pretty annoying to be honest. It doesn't seem like there is much that I can do. I would advise you to create your own help post and include a report id.
@square-energy-41150
s
# Sending a Problem Report Here's how to send the Botpress Team a problem report: 1. In the Botpress Cloud Studio, locate the "Help" icon in the bottom left corner of the screen. 2. Click "Report a problem" and follow the steps on the screen. 3. Copy the Report ID to your clipboard and provide it to a member of the Botpress Team on Discord.
c
@gentle-lunch-37811 #1228265078516875336 check it out!
g
So I actually found a fix for it. I'm still testing it to see. You can advise if I was just plain lucky to have found the fix or that's the intended feature. The only thing I did differently was to turn on the translator agent. By doing this I don't need to write any code to do the translation. Looks like by default it would translate anything on screen to the language it detects in the user question. So far it's been working. Though I cannot say if I will run into new bugs soon. For a break down. I created a single node and set a raw input capture card. And enabled the translator for that node. ( It's auto enabled for all nodes by the way. Then I linked that node to the knowledge base node. Then once user inputs a language it detects it automatically and translates to that language. I didn't need to write code. Nor did I need to use an AI task. It just works.
c
This is because indeed because of the “translator Agent” which automatically detects a users language. My suggestion can be useful to prevent the language from changing mid conversation.
g
can you link your suggstions here. it is not on this thread
m
Hi, I have problem with translator agent, Sometimes it failed to reply in user language (bahasa), the bot answer in english instead. My team even try to set the user language in every node using code, but sometimes, like a bug, it still reply in english. when we test it, it clearly catch the correct user language. can anyone help with this?
e
I have the same problem. The bot translates everything, except for the kb content. E.g. if I have a KB in portuguese and set translate to "fr", the bot translates everything to "fr", but the kb is getting translate to "en". I understand that the bot translates everything to en by default, then to the selected language. The last translation is not working.
c
alright! let me remind myself to make a quick tutorial for a fix this weekend 💡 #1240726709310066758 You can do the following:
Copy code
js
user.TranslatorAgent.language = "en"; // Set your initial language
Copy code
js
user.TranslatorAgent.language = "fr"; // Set your new language (translation)
YOUR KB ANSWER HERE // encapsulate your KB answer within these two code blocks (execute code)
Copy code
js
user.TranslatorAgent.language = "en"; // After giving the translated answer return back to your original language.
You can set variables at the beginning to set your initial language like
workflow.initialLanguage= 'en'
9 Views