https://discord.gg/botpress logo
Is it possible to have an autonomous node search i...
# 🤝help
b
i.e. exclude some files when answering questions given some criteria?
p
Why would you not make different knowledge bases to have the possibility to exclude knowledge bases instead of a subset of it?
b
We're building a troubleshooting/support bot. We have support docs we need to load in knowledge bases but the problem is that the docs are different per product. Also, we want to use an autonomous node to answer support questions on a per-topic basis; so for example, we'd have one autonomous node to answer questions related to topicA and another autonomous node to answer questions about topicB. (We tried creating a single autonomous node to handle questions related to any topic but it's accuracy was bad; we had much more success by creating per-topic nodes because we have a lot of support documents ranging many topics.) So the problem is that we'd end up needing to create a separate knowledge base for each product+topic combo, which would be a LOT of knowledge bases. I'm wondering if there is a way we can instead have one knowledge base per product, but then tag uploaded files with metadata to mark their topic, then tell the autonomous node to ONLY consider information in its knowledge base from files with metadata topicA, for example. I hope that makes sense. Please let me know if you need more clarification!
p
Can you give me an example of topic? Just to be certain, there is a many to many relationship between topics and products? I'm thinking you might want to make a table that is initially queried to get the products that relate to a topic and then the kbids could be passed to a following query knowledge base card, for the actual information needed. I'd be happy to send you an example of that workflow provided I am not mistaken about your use case.
b
Sure! Our company sells outdoor wood stoves, and two topics would be for example 'wood burning', and 'water treatment' (the stoves heat your house by circulating hot water thru the house). There is a many to many relationship between topics and products (each product has many topics). I tried your idea of using a table to map each product to an array of knowledge bases but it doesn't seem to work to have a Search Knowledge Base card look in an array of kb_ids; see https://discord.com/channels/1108396290624213082/1364279657901461745 An example workflow would be most helpful! Thank you!
p
What kind of answers are you expecting from this process, does it need to be an aggregate on info found in multiple knowledge bases or is the answer found in only one but the challenge is finding which one? Also, a target question example would also be useful to my understanding?
b
We have some documents that apply to multiple products and some that apply to specific products. We also have documents that are specific to one topic as well as documents that span multiple topics (such as an owner's manual for example). I'm trying to figure out the best way to organize all of that scattered information into knowledge bases. I'm open to suggestions on the best way to handle that 😅 Here's an example conversation: **me**: "What is the maximum amount of wood I can load in my furnace?" (router node see's the question is related to wood burning, so routes to the 'wood burning' autonomous node) **bot**: "can I get your serial number please?" **me**: "abc123" (bot uses the serial number to determine the product, then looks in the relevant KB(s) for the 'wood burning' topic for an answer to the user's question) <-- here's the crux of the problem: which KB or KBs? **bot**: "Your model of furnace has a capacity of roughly 6 wood logs of 1 foot diameter. Anything else you'd like to know?" (conversation continues) As the example shows, the model matters because different furnaces have different capacities. This is a very simple example but in reality the support questions are much more complex and that's why we'd also like to have "topical" autonomous nodes to narrow their scope of specialty in order to answer technical questions more accurately.
p
So an approach that is often used is the FAQ Kb and the product table/Kb. Given in your case there seems to be many files for each product, then there could be a kb per product, however if you anticipate users inputing product codes often as a way to identify the correct product that is best done via a table. Now, about your topics grouping, I think the topics do not have to affect your kb organization but they could be represented via an AI transition that detects which topic a user is asking about, which would then lead to different autonomous nodes that would search the products. Additionally, any document that is more general about the company or a large group of products could be placed in the FAQ kb. I do believe this is the most intuitive way to go about it. Hope this helps!
b
Yeah thanks for the help! We might need to do something like that. However, I see that files don't necessarily need to be associated with a knowledge base; I'm wondering if we can do something like this: https://botpress.com/docs/api-reference/files-api/how-tos/index-and-search-files#using-the-search-results-for-rag on a per-file basis, maybe in an Execute Code card; do you know how I can find what functions are available in that card? For example, can I call functions from the botpress SDK like
client.searchFiles()
?
p
Yes, I do think that'd be a great approach to try. Execute code cards can contain any valid code. Therefore, there is no set list of valid functions, but our (Files API) docs is a good place to start.
l
I would recommend you have separate AN nodes per product. there could be overlapping documentation that could confuse the bot and hence your answer quality dipped when you had one AN node for all products. I agree that would mean a lot of KBs, but data segregation and segmentation is the way to go, it will help manage your KBs better