https://discord.gg/botpress logo
#🤝help
KB/AI task issues
# 🤝help
s

shy-air-17871

01/04/2024, 3:06 PM
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

mysterious-cricket-72777

01/04/2024, 5:12 PM
what kind of bot are u doing?
s

shy-air-17871

01/04/2024, 5:37 PM
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

mysterious-cricket-72777

01/04/2024, 7:49 PM
I’m just a little curious
Ai task doesn’t look in the kb
f

fresh-fireman-491

01/04/2024, 8:16 PM
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

shy-air-17871

01/05/2024, 8:48 AM
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

fresh-fireman-491

01/05/2024, 10:47 AM
What language is your KB in?
s

shy-air-17871

01/05/2024, 10:59 AM
it's in Finnish
company website
f

fresh-fireman-491

01/05/2024, 11:02 AM
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

crooked-van-25152

01/05/2024, 2:14 PM
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

shy-air-17871

01/09/2024, 7:11 PM
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

mysterious-cricket-72777

01/09/2024, 7:15 PM
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

crooked-van-25152

01/09/2024, 8:24 PM
@famous-jewelry-85388 Do you think you could help here when you get the chance?! thanks very much 🙂
s

shy-air-17871

01/10/2024, 7:15 PM
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

fresh-fireman-491

01/10/2024, 7:21 PM
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

shy-air-17871

01/10/2024, 7:22 PM
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

fresh-fireman-491

01/10/2024, 7:43 PM
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

shy-air-17871

01/10/2024, 7:45 PM
this didn't work as well as the Ai task at least before the KB update
f

fresh-fireman-491

01/10/2024, 7:45 PM
It should work now
s

shy-air-17871

01/10/2024, 7:45 PM
okay, need to check
f

fresh-fireman-491

01/10/2024, 7:47 PM
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

shy-air-17871

01/10/2024, 7:50 PM
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

fresh-fireman-491

01/10/2024, 7:55 PM
well your instructions are different than what he used in the video
Try his exact instruction and input
So like this
and this
s

shy-air-17871

01/11/2024, 7:22 AM
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

crooked-van-25152

01/11/2024, 4:40 PM
Amazing!! Will mark this thread as solved then 🙂