Find answers from the community

Updated 2 months ago

Condition

Hey all! Question about Query Pipelines. When conditionally linking one component to another, is there a way to have this condition based on the output of a separate component while avoiding having two inputs?
L
r
38 comments
Can you give a example? Trying to picture what this looks like
Hey Logan! Sorry I fell off the radar for a bit there.
Let's say we have a pipeline with the following:
  1. User Input
  1. Component A
  2. Component B
  3. Component C
What we want to do is:

  1. Have User Input as Component A's Input
  2. Have User Input as Component B's Input AND Component C's Input, but only if the output of Component A is x or y
  3. The output of Component A does not need to go into B or C, but it determines if the User Input should
I feel like a combination of conditional links and custom components would solve this
What I ended up doing was essentially that
  1. Component A returns an output dict that has both its input, being User Input, and its output.
  2. I created conditional links on Components B and C, which evaluates the output part of the dict Component A returns
  3. Each conditional link also has an input function that only passes the input part of the dicts
Would you say the best way to implement a multi-agent solution is w/ query pipelines? Or should I just use agents with more agents?

I like the expressiveness of query pipelines, but I want to make sure I'm not coding myself into a corner here. I am building a DAG via query pipelines, but I want to add a conversational interface. I'll probably wrap an agent around it unless there is a better way.

Things I need:
  1. Chat History to be accessible throughout the pipeline when needed (I can probably add this as another input key from the agent function I imagine)
  2. Sub agents or components to be able to ask the user for more context when needed
  3. Streaming support
I think using the query pipeline agent worker is fine for making custom agents. You could also sub-class the agent workers themselves.

Wrapping the query pipeline or other agents into a FunctionTool works toos
Okay great, thanks
Hey Logan. I'm running into an issue w/ query pipelines and I have a suspicion as to why.

I'm trying to create a branch in my DAG, but somehow components that should not have been linked based on conditionals are kicked off after the root component.

Here is the dag:
  1. Root Component -> Component A if x
  2. Root Component -> Component B if y
  3. Component B -> Component C if i
  4. Component B -> Component D if j
When running the pipeline with an input that triggers x, Component A runs, as expected...but somehow Component C and D also run. I can't figure out why, but I'm wondering if it has something to do w/ the Component B condition? If that link fails the condition, does that negate the conditions for Component C and D?
If you can give some sample code, I can probably help debug
This should outline the issue for you! Please let me know if you want to hop on a voice call.
hmmm yea ok, super strange
will try to debug lol
Ok, I think I see the issue (first time diving into this code tbh haha)
Its pretty complex, but I think the issue is when a conditional link is false, we aren't pruning the tree of that links dependencies
Ahh damn, was worried about that
I think I almost have it fixed though
In my eyes, query pipelines is the llama-index answer for LLM DAGs or Agent DAGs...or RAG DAGs (hehe).

If that is so, are y'all prioritizing any more development on them? I noticed there was mention of more structured input/output down the road, but anything else?
We've been meaning to prioritize some development on them! Its on the todo list haha
  • viewing intermediate outputs
  • batch execution
  • serialization
Still figuring out if we want to bring this fully to agents like langgraph does though. Still not convinced tbh
Okay good to know. We are planning to try wrapping an agent or chat around our pipeline, where the pipeline is likely doing a lot of decision making w/ routers and such, as well as able to return follow-up questions, etc.

I just want to avoid writing ourselves into a corner.
Let me know if there is anything I can do to fix the bug!
Definitely! Will try to get this fix in today (made decent progress yesterday, but had to switch to other stuff)
Also in general, pretty open to feedback on the current query pipeline stuff.

I know one thing missing is its a pure DAG - no cycles. I think also some of the errors when connecting stuff is quite cryptic/unhelpful
Yeah totally, we'll definitely provide feedback as needed. Do you see the need to reimagine how QP works or maybe just some improvements that can take place?
I think more so just improvements -- things that can help improve the UX and whatnot πŸ™‚
The former would be a bit more for us to take on, but the latter would be most doable.
what a doozy haha
added a unit test for this
Just saw this! Apologies!
Oh nice, the sample code helped write the UT! I'm glad to see that ❀️
haha yes, theat code was super helpful
Add a reply
Sign up and join the conversation on Discord