https://discord.gg/botpress logo
Search Multiple KB's separately and then combine t...
# 🤝help
n
I want to separate out my data by state into multiple KBs, and then have a single Autonomous node be able to use multiple sub workflows, each with a search on their own KB, and compile the data across the different subworkflows and then respond. Currently I am only seeing it choose one subworkflow and then when it returns, the autonomous node answers the whole question based on that one subworkflow. I need it to take a question that applies to multiple states and then make a query for each relevant subworkflow, and then compile all the answers from all the subworkflows. Or, is it better for me to give one KB Search card access to all the state-based KBs and let it do it's thing? Having one KB with all the documents, sometimes the bot gets confused between similar content but in different docs for different states. So my goal is to just have it search KB's individually so there's no chance of confusion there
Here's my setup now, but the thing is it only picks one workflow to go down. I was hoping it would decide on it's own how many to use. Here's my sample algorithm to address this, but sheeeesh it's a lot of work if I'm going to do one per state... (Node) Description (0) Bot waits to hear a question (1) Parse question and see what states are relevant, then save those states in workflow variable? (2) Have a standard node that goes through our new variable, add a transition card to check for each state and goes into that state's subworkflow, gets an answer from that subworkflow with a KB search back to the main workflow, and then the standard node moves on to the next transition card to check the next state? (3) Store all those answers in WF variables and/or Pass all those answers into an LLM node (non-conversational) that compiles the answers into one cohesive answer then sends it to the user (4) Bot waits to hear the next question
@aloof-traffic-22451 @stale-addition-18113 any insight here?
w
you should be able to prompt it (by giving it the right code to execute as an example) in a way it executes several workflow before "thinking" and giving back the response
n
@wooden-beard-40210 Interesting, what is the right "code to execute" ? In my screenshot I'm just hitting subworkflows. Are you saying I need to change these to execute code cards (or actions in this case since its autonomous)? Or are you saying I need to work on my prompt?
I tried to tell it in the prompt to decide what states are needed then follow all the workflows come back and compile an answer. I wonder if i'm wording that part wrongt?
l
If I had to build this - I will ensure a master AN Node like your setup and with sub AN nodes in each workflow connected to individual KBs and each of the sub AN Nodes will have their "Allow Conversation" turned off and each of them exit after generating their individual response. The Master AN gathers the responses from all workflows, stitches them together and produces an output However, I do wonder why such a long route?
w
When you click on "inspect", you should be able to see the code it executes Dm me your prompt or your bot file if you want I'll takea look
n
Thanks - that's exactly what I did (small exception - I couldn't use AN for the KB search because AN runs global search, instead of knowledge agent - i needed knowledge agent to get the "turn" variable - that has the citations in it) However the master AN Node seems to be going down one Subworkflow. I thought that maybe the AN node can only go down one, but it seems the issue is more related to my prompt. Is that accurate?
l
I am guessing - haven't tried an approach like yours earlier
n
@limited-pencil-78283 okay thanks!! Makes sense, that's what I am going for 🙂 appreciate it