Translate Agent and Knowledge Base
# 🤝help
a
Hi! My information from Knowledge Base is in ro. Sometimes the answer is the same as in the KB, sometimes a ro - en - ro translation happens for the answer. The problem is that the translation is not always correct. The language is hardcoded (automatically detect language is disabled) and the knowledge agent has answer manually. There is a way to stop this translation and force the answer to have the same words from the KB? Also, in deploy, some answers have weird formating ( extras newlines) which don't appear when testing in studio.
Also, sometime when testing outside the studio, some answers are in en, and not in ro
b
Describe your variables. That worked for me
c
Legend @broad-vase-10073 It seems like describing the variables are the key for many issues here.
b
For now I guess. Will just have to wait for @cold-motherboard-82208 future updates
c
@bumpy-butcher-41910 we need tutorial about it, Describing the variables.It seems its overriding the default instruction.
a
Unfortunately this doesn't help with the language consistency. For exemple now I have a bug where a certain question has an answer just in en, but in emulator I see the correct answer in ro, before it's translated to en. I tried using a personality agent to force al answers to be in ro, but the translation is .... just wrong
a
Stefy are you using the translation agent at all?
a
I think so. The translator agent is enabled, and "Set User Language" (with {{user.TranslatorAgent.language}} = 'ro') is the first card used in the Main flow. 95% of the answers from Knowledge Agent are in ro, but sometimes they are translated in english or retranslated in romanian (an this makes the final answer kind of wrong)

https://cdn.discordapp.com/attachments/1131155404982865950/1131189561419112548/image.png

https://cdn.discordapp.com/attachments/1131155404982865950/1131189561687560232/image.png

@acceptable-kangaroo-64719 example how the answer is translated to english, but just for this exact question.

https://cdn.discordapp.com/attachments/1131155404982865950/1131190038152106045/image.png

https://cdn.discordapp.com/attachments/1131155404982865950/1131190038412132472/image.png

c
Can you show me your card? The structure?
Node card
a

https://cdn.discordapp.com/attachments/1131155404982865950/1131197544144326657/image.png

https://cdn.discordapp.com/attachments/1131155404982865950/1131197544425324626/image.png

a
Your "set user language" card just needs to two digit code, like this

https://cdn.discordapp.com/attachments/1131155404982865950/1131199295350128720/image.png

everything else looks ok
a
I did this minor change (but I don't understand why it worked till now) , but I still have the same behaviour for that question with the answer in English. Strange is that for a small amount of time, it gave me the correct translated version, before the set with just 2 digits 🤷‍♂️
a
Where in your flow are you setting the language?
a
First card, in the first node, from the main flow.

https://cdn.discordapp.com/attachments/1131155404982865950/1131207131845120070/image.png

https://cdn.discordapp.com/attachments/1131155404982865950/1131207132226781214/image.png

a
yep that's the right place to do it. And your knowledge base is completely in Romanian?
a
yes, all the info from KB is in Romanian
I have a single KB with 2 plain text sources
a
Are the Knowledge base titles & descriptions also in Romanian?
a
The description is in English and for the title they are still named "Plain Text"
c
test this, it worked for me

https://cdn.discordapp.com/attachments/1131155404982865950/1131208781108346901/image.png

a
Unfortunately, I have the same behaviour.

https://cdn.discordapp.com/attachments/1131155404982865950/1131211223824863362/image.png

c
tell your ai taask to answer back the user with their language
include it in your instruction
test it
as you can see, this message is generated by ai task

https://cdn.discordapp.com/attachments/1131155404982865950/1131211929856249947/image.png

so i guess defualt language is set to be english. You need to override it
l
@ancient-alligator-64385 lmk if you fix this, I have the same issue, but for the text cards( they are written in ro, but it translates them in english)
a
Unfortunately no, the question below the answer is generated by an ai task. I don't give the kb answer to an ai task in my flow.
c
You dont have AI task in your flow ?
a
I use AI task just to create a question like "Any more questions?"
c

https://cdn.discordapp.com/attachments/1131155404982865950/1131213442435534848/image.png

how does your instuction looks ?
a
this is my only AI task in the main flow. And I use it after I print the kb answer. I hesitate to translate using the ai task because it will use synonymous terms, but they will be wrong in given context (this happened when I tried using a personality agent). I need the exact (or at least almost) words used in the KB.

https://cdn.discordapp.com/attachments/1131155404982865950/1131215497086636094/image.png

c
hmm i let the team experts help you brother, if i guess i would say it is on the ai task that runs behind the background. I dont know how we can override it 🙂
@acceptable-gold-88171 @bumpy-butcher-41910
a
Also, like I said, is just for this question where the answer is translated (90% times) in English. The other questions have their respective answer in Romanian
a
To get more control I would enable answer manually, and pass event.kb.results to the AI task and ask which ones to keep. Then you can tell it to merge the keepable ones, and be very very strict about not changing the wording, keeping the romanian language. I think that will do the trick.

https://cdn.discordapp.com/attachments/1131155404982865950/1131224945918218240/image.png

https://cdn.discordapp.com/attachments/1131155404982865950/1131224946383794247/image.png

I shared a screenshot of the data that you will want to work with, you can find it in the bottom tab under JSON
a
Alright, I will try this method. I want to mention that in the last 20 minutes, this question went from an English answer to no answer/ no citations from KB (and yes, just this question). And now, I again get the English vers.
a
I think that should fix the translation issue at least, and also likely fix the wording issue. 🤞
a
I suppose that I need to use the original answer from KnowledgeAgent when choosing the elements from event.kb.result, and also the user's question. Is this correct? Also, I'm afraid that using this AI task will be too time consuming
Unfortunately I couldn't get your idea to work @acceptable-gold-88171 . Also, while testing using the mediafile link, there were discovered more questions which weren't translated to Romanian. And even after the KB update, I still have this bug where the same question sometimes is translated to English, sometimes is translated to Romanian, sometimes doesn't get an answer from KB.
a
Have you been able to open the JSON tab at the bottom and see the results information? Can you try that and see if it's in Romanian?
c
If you use automatically detect the language, it will try to detect it on the first message the bot deems long enough, then saves it as the user's language. In the debugger, what is the language set in the TranslatorAgent variable? And can you provide a screenshot of the Logs tab? Agents can log some events there, it could be helpful. Can you try setting the language to "Romanian (RO)"

https://cdn.discordapp.com/attachments/1131155404982865950/1131605672098791464/image.png

b
For me, the language set (as I can see in the debugger Object) is dutch and still the outcome is as I described above
Even when fiddling with when I use the set translator agent in the workflow or in the specific node order, it gives inconsistent replies switching between dutch and english. Would reseting the user language in every node help? Btw, shouldn't the set translate agent hardcode the language for all the nodes? Checking the docs, that is supposed to be the role of it
c
When you use the langage set card, it just overrides the variable user.TranslatorAgent.language. You could set it manually in the code editor and it would have the same effect. Here's the tricky part. When your bot send messages, they are 'batched', and when the flow is done with processing, that batch is sent to the translator agent to be translated, then to the personality agent to be customized if it's enabled. So, even if you use 2 or 3 language set cards, it wouldn't change anything. The language set by the last card processed. If you have one language set to english, send a message, then set it to dutch, and another message, all those messages will be sent as dutch. Do you have the personality agent enabled? And can you provide a screenshot of your logs tab? this could help identify the problem
b
The funny thing is that I don't have the personality agent enabled, as I saw you guys are mentioning in the docs that this is actually causing problems with the translator agent. I also only have dutch language enabled and not english. The outcome is that it randomly provides answers in english, and so far the only way to overcome this is using an AI task, which again hugely impacts the performance (speed) of the answer. So again, the translator agent functionality doesn't make sense as it does not work a 100% of times
But as you can see a lot of people are complaining about this
Btw hardcoding the language to dutch (according to the videos your provided on youtube on how to use the translator agent) and still getting the answers in english...well that just doesn't make sense, wouldn't you say? The definition of "hardcoding" the language by firmly setting it via the set translator language or even hardcoding the value of the variable to in the code execution card would mean that it would indeed set the language to the prefered ISO code...this just isn't the case with your functionality, there are numerous examples of people experiencing the same
c
The fact that is translates sometimes in one language and then in another is indeed strange. Are you sure that "detect language every turn" is unchecked? Otherwise it tries to detect the language on every message the user writes and may detect another one & adjust the language automatically

https://cdn.discordapp.com/attachments/1131155404982865950/1132387371673989181/image.png

e
Hey @ancient-alligator-64385, since your knowledge base is in Romanian, all of your text and questions are in Romanian, and the bot shall only speak Romanian, there is no need to use the Translator Agent, you can go ahead and disable it. Let me know if that helps!
b
Yeah, I figured that out as well and disabled it early in the beginning. However, did not help. What does help is completely disabling the translator agent and creating an AI task and give it very specific instructions on only giving responses in Dutch. But that basically renders the translator agent useless and it also impacts the performance, because an AI task for that trivial thing we need it for takes more than 3 seconds to run and that is before it's deployed to production, which doesn't give us a lot of confidence. Do you guys test edge cases? This does seem like a very buggy feature indeed
c
We do test edge cases but of course we may be missing some. Can you send me the export of your bot and the steps to reproduce the issue, so we can find a solution that fixes your issue without relying on ai task cards?
b
Thanks @colossal-activity-12523 and sorry, not able to provide you what you are asking for because that would mean I have to basically go back to how I build the bot yesterday and I made a lot of progress, therefore this is really not something I am looking to do. I will make sure in the future to make screenshots of logs and the cards in my workflow and provide them immediately when I ask the question as I know this would be very valuable to you. As of now, I will have to work with the AI task and try to figure out other huge issues that I reported, for example the bot giving the users that interact with it the references to specific documents in the knowledge base as oppose to giving the information contained in the references. It would be really valuable if we get a response on that as this is a huge bottleneck and a blocker for many people here. Please check this feature request (https://discord.com/channels/1108396290624213082/1132627307257938012/1132627307257938012) and this thread (https://discord.com/channels/1108396290624213082/1128301099657478236/1132623671572303933) as I can see you are online atm (sorry for pushing this, but this is a huge liability and prevents our clients to see the value in the bot
a
If I disable the translator agent and ask something which is not in my questions list, but the info can still be found in the knowledge base, the final answer will be in English. And If I enable the translator agent some answers from my questions list will be translated to English. It seems both choices have a drawback.
10 Views