KB accurate
# 🤝help
c
Is there any solution to make more accurate for kb to find answers? I guess u have some ideas @witty-football-93730
any recommendation or tips are welcomed 🙂
w
Hey @curved-traffic-50479 nice to have you here. That always depends on the type of your data. KB documents and plain text are great for unstructured non-repetitive data. Think of long texts. Ways you can improve the results of such datasource : 1- change the provided context 2- change the content of your documents itself 3- if you want fine grained control over the answer, use the manual answering 4- if you want fine grained control over the query, use the Query KB card
Whenever you have repetitive data (like tabular or list of options) you use a KB for that, GPT might have a hard time combining results (it's not THAT smart). If we take your example of list of flats.
Copy code
Area: Majorstuen, Oslo
Size: 60 square meters
Apartment Type: 3-bedroom apartment
Area: Grünerløkka, Oslo
Size: 75 square meters
Apartment Type: 1-bedroom apartment
Area: Bislett, Oslo
Size: 40 square meters
Apartment Type: 4-bedroom apartment
Area: Majorstuen, Oslo
Size: 100 square meters
Apartment Type: 2-bedroom apartment
Area: Møllenberg, Trondheim
Size: 55 square meters
Apartment Type: 1-bedroom apartment
Area: Nygårdshøyden, Bergen
Size: 35 square meters
Apartment Type: 3-bedroom apartment
Area: Grønland, Oslo
Size: 80 square meters
Apartment Type: 2-bedroom apartment
Area: Lillestrøm, Akershus
Size: 65 square meters
Apartment Type: 1-bedroom apartment
Area: Bjølsen, Oslo
Size: 42 square meters
Apartment Type: 4-bedroom apartment
Area: Sinsen, Oslo
Size: 95 square meters
It's highely repetitive, so whenever we find similar results, GPT will combine answers and potentially combine items from the list or worse, make up results. That's just how GPT works. What I suggest you to use in this case would be the Tables feature
c
thanks for your answer. So with tables feature it could fix the issue ? how can i use it for this example? Do i need to put all the aparments in the table and botpress will automatic find the answer in tables ?
w

https://cdn.discordapp.com/attachments/1135590661316415658/1135594848829833277/Screenshot_2023-07-31_at_11.28.16_AM.png

This would be how I would define the table
c
yeah then i will start asking it ?
in emulator in natrul language? like im searching for aparments in that area
w
As of today tough , botperss won't automaticcaly find the results with any query but, very soon. Like by the end of the week, you'll be able to perform tables query like the following:
show me appartments in @area
You would then save that in variable and generate a pretty answer for it 🙂
That doesn't mean you can't start building today with pre=defined queries, let me show you
c
so from next week i could say show me appatments in area x without @ ?
w
with or without the @
Here's what you can do today
you define a "selector" that you can re-use in your flow

https://cdn.discordapp.com/attachments/1135590661316415658/1135596544960241704/Screenshot_2023-07-31_at_11.35.00_AM.png

Then you use it in your flow, like so

https://cdn.discordapp.com/attachments/1135590661316415658/1135596736572833863/Screenshot_2023-07-31_at_11.35.54_AM.png

Then you can re-use the results in your flow e.g: - manually forge an answer to your user and send a message back - use it in an ai task - etc
In this case I used the selector I showed you and generated an aswer

https://cdn.discordapp.com/attachments/1135590661316415658/1135597792916680875/Screenshot_2023-07-31_at_11.39.29_AM.png

c
wow
😮
but its manuel now
right?
w
what do you mean ?
The only thing that is manual for now is that you have to pre-define queries
c
yeah
w
But you know that dynamic is coming 🙂 so you can build around it
c
<33333
bro
that is game changer
w
I know right
c
so the result will be so accrute right?
w
Yep, there is no way you get GPT hallucinations using that, except if you use an AI task and ask it to generate a long story about the available apparments
c
this is insane bro. one thing i wonder, can we finally upload csv files ? 🥹
to generate tables automatic
w
I knew you would ask that
c
hahahah
w
it's coming
Meanwhile you can use an executeCode card to populate your table if you are a little bit fabiliar with code
c
with java script
like read csv file then generate to table ?
w
Like copy/paste your csv in an array and feed it to the table
c
truee
this should work
w
I know it's not perfect but it works
c
yeah
man now i know the biggest advange with tables
thanks bro for the help ❤️ 10/10
time to digg more into tables
w
Here's the insert records you would need to use

https://cdn.discordapp.com/attachments/1135590661316415658/1135600507218567320/Screenshot_2023-07-31_at_11.50.35_AM.png

q
@witty-football-93730 will there be a way to use multi reference fields in tables?
w
@witty-football-93730 thank you for all your tips man , really
i was going to a dead end until i saw this
sorry to ask but i need help in order to complete what you were saying @witty-football-93730 i was trying to run this but i won't fill the table , i sense that the code is not right , can you help please ?

https://cdn.discordapp.com/attachments/1135590661316415658/1135657990398152905/Untitled.png

https://cdn.discordapp.com/attachments/1135590661316415658/1135657990674989208/Untitled2.png

w
Hi guys i have a knowledge base that contains multiple articles. Each article has a link at the start of article that says 'Link to this article:' so the user ask the questions, bot respond from the knowledge base relative article, i also want to return the link of the article the bot pulled info from. how can i do that?
w
I think that {{turn.knowladgeagent.citiation}} will get you the Link of the article you are asking about
f
thats going to be awesome if only it would also put it into a card! 😉
c
is there any update on this feature ? would be great to learn more about it.
c
@witty-football-93730 is there a feature similar to !turn.KnowledgeAgent.answer for tables? Maybe !turn.tables.answer? something like that haha
f
this...!
c
yeahh still waiting for this haha
q
same
w
Hey guys, sorry I just got back from time off. Stay tuned, dynamic table queries will come. I'll keep you posted whenever we're ready
p
Hey guys! 🤗 Do any of you know why the chatbot sometimes gives wrong answers to the questions it's asked? I've had situations where it answered incorrectly even though the correct response was in the Knowledge, and also instances where it gave a wrong answer to a question it didn't know because the answer wasn't in the knowledge. Instead of saying it didn't know the answer, it provided a wrong response. Thanks!!
w
Dynamic table queries are in using execute code statement 🎉
q
This is amzing man, you are the boss. I tested it, damn it works. this is the sh*t. yeeeeeeee
@witty-football-93730 got this error with event.preview , but if I just copy that text by myself inside it works. Its something with variable error, need to check.

https://cdn.discordapp.com/attachments/1135590661316415658/1146942286563917874/64646846e.PNG

look, this doesnt work, but if I copy that sentence directly inside Ai brackets it works.

https://cdn.discordapp.com/attachments/1135590661316415658/1146947540709806161/453434354.PNG

q
Is the correct setup to use a Table as a KB?

https://cdn.discordapp.com/attachments/1135590661316415658/1147189963063037972/Screen_Shot_2023-09-01_at_11.22.29_AM.png

q
you can also get table data like this " // Find records in the table const data = await Data1Table.findRecords({ selectorName: 'adults' }) workflow.adults = data"
w
I took good note of this. I'll look it up
q
Thanks!
w
You can't use Table as KB source just yet but you can query tables with dynamic fields meanwhile. (only as code) .
I gotta jump on a meeting but let me kow if this is not clear enough, I can bring up a more detailed example
q
That would be great. What im trying to achieve is Database for an employee roster. So I have 10 columns of information about set employee. Example would be like "what is "name" birthday, status, etc" and then the bot retrieves that specific data
w
Ok I f I understand it right what you want is to retrieve an employee data from a table using dynamic queries. Say your chatbots asked the chat user its name and store it in a name variable. You can currently query the table using dynamic queries with code as follows
Copy code
// Find records in the table
const data = await EmployeTable.findRecords({ filter: AI`find an employee named ${workflow.name}` })
workflow.employeeData = data[0]
Technically this should work very well. Is that what you were waiting for ? I can share screenshots later on if necessary
q
Something similar to this, id have to DM you my example just to make sure my thinking is correct in the setup
w
Sure please do
b
Hmm this is quite finicky... I am using an AI task to extract variables from a text and classify them. Then this variable is passed into the AI filter for the table. But it is very hit and miss...
p
Hi everyone! @witty-football-93730 I don't know about programming. Is there an easy way to make me use tables as the basis of the KB? In another post where I asked for help on chat hallucinations they told me that a solution could be to simplify the data into tables but I don't know how to use them later as KB. Thank you!
13 Views