KB/AI task issues
# 🤝help
s
Problem number 1. Same questions in english and in finnish result in different answers.(Pictures 1 and 2) Problem number 2. Chatgpt fallback doesn't work(Pictures 3 and 4, this mechanism worked before the latest KB updates). Now it works only sometimes (watch the last picture). How can I fix this?
m
what kind of bot are u doing?
s
what matters is that I am trying to have a chatgpt fallback if the answer is not found from KB
This is a good example that the answer is found from KB but the Ai task cant find it, so what goes wrong here?
And the error says that "Cognitive Ai task failed: Colon expected at position xxxx
And other example, so that the answer is not in KB but in the emulator the bot shows that answer is found in KB.
m
I’m just a little curious
Ai task doesn’t look in the kb
f
I believe that it gives 2 different answers because it has to translate your Finnish message into English before searching the KB. It might translate it to something slightly else than your English question. I can't understand Finnish but how different are the answers? Are 1 of them completely wrong while the other is correct or are they kind of similar? For the GPT fallback take a look at this:

https://www.youtube.com/watch?v=Q2VMitD6DMU

s
If there were only a small difference it would be fine, but now I am asking "Who is Teemu Selänne?" and in English it's able to respond but when asking the same question in Finnish (Kuka on Teemu Selänne?) it answers "sorry I am not able to answer to that question..." This is not a big problem but
this is. When I ask the same question in Chatgpt it's able to answer but not in here
This part I was able to resolve when I changed the promt for this
f
What language is your KB in?
s
it's in Finnish
company website
f
I think it's because it's translating the KB into English and the question into English. My knowledge is limited on this topic so I will ask the Botpress Team to jump in
c
Hello hello!
Ok let's go step by step. When asking questions in Finnish, are the answers ok?
How did you set up the language of your bot?

https://youtu.be/fBwSLPbPqn8?si=dCW4hWfCxhlbbD_a

(please have a look at this video to know how you can set up your language).
s
Hi, most of the time (maybe 70% of the time) the Finnish answers are okay but then there are questions like "What do your company do?" that the bot cannot answer even though the answer is in KB. this is the way I have set up my language and you can also see the AI task prompt for "User_KB_Answer" (I have also used this as an input: {{turn.KnowledgeAgent.answer}} )
m
The ai task is just ChatGPT it doesn’t actually have the kb you have to add the kb answer manually if you wanna use ai task
c
@famous-jewelry-85388 Do you think you could help here when you get the chance?! thanks very much 🙂
s
what do this error: "cognitive AI task failed, colon expected at position 2240" mean? The workflow variable User_KB_Answer is "Not set" maybe this affects it and could it be that the "user input: {{turn.KnowledgeAgent.answer}}" affects it, because it evaluates to nothing. Let's see if I change it to {{event.preview}}
now the Ai cognitive error is gone but still the answer is not correct
f
Hi there. I can see that a lot of your instructions have been placed in the AI Task Input instead of in the Task Instructions. I don't think that this will fix the issue but its a start. Screenshot so you can see how it could be setup.
s
thanks, I will test that
this worked, thanks!
well it didn't solve this mystery and it doesn't matter whether the input is "event.preview" or "turn.knowledge.agent.answer"
f
It does matter wether its {{event.preview}} or if its {{turn.KnowledgeAgent.answer}}. What are you trying to do
And before using the AI Task card
Use an expression card with !turn.KnowledgeAgent.answer in it
That checks if there have not been found an answer
From the KB
s
this didn't work as well as the Ai task at least before the KB update
f
It should work now
s
okay, need to check
f
Why do you want the AI Task to answer the users question while the KB also answers it?
Why not just print out the answer from the KB?
s
well, if the answer is not found from KB, I would like to have a chatgpt fallback. I did it like this:

https://www.youtube.com/watch?v=Q2VMitD6DMU

but yeah currently it is not working either😆
f
well your instructions are different than what he used in the video
Try his exact instruction and input
So like this
and this
s
You are right thanks! Before the update though the Ai tasks worked better than the expression and {turn.KnowledgeAgent.answer}
Hi, I changed the prompts a bit and changed from AI tasks to expressions so now it seems to work way better than previously, in Finnish too. Thank you @fresh-fireman-491! So this is solved!
c
Amazing!! Will mark this thread as solved then 🙂