Find answers from the community

Updated 11 months ago

Hey! Does anyone know if a query

At a glance

The community members are discussing whether a query pipeline can take different paths or routes based on conditional logic, or if it has to be done on the whole set of functions. A community member provides an example of using conditional links in a query pipeline, and another community member asks for more documentation on this. The community members then discuss that this can be done with any type of pipeline components, not just agent pipelines. There is no explicitly marked answer, but the community members provide helpful information and examples.

Useful resources
Hey! Does anyone know if a query pipeline can take different paths or routes via an if condition or similar? Or does it have to be done on the whole set of functions?
L
a
9 comments
Yea, using conditional links

Plain Text
qp.add_link(
    "a",
    "b",
    condition_fn=lambda inputs: not inputs["done"],
)
@Logan M hey! thanks for your answer! Is there any more documentation regarding this?
The example above is really all you need though tbh
@Logan M does it only work with an agent pipeline? or can you do it with a normal query pipeline (meaning, using FnComponent instead of AgentFnComponent)
You can do it with whatever components you want πŸ‘
Basically it just runs the condition function using the outputs of a (i.e. the inputs of b) to see if the link should actually be followed
Add a reply
Sign up and join the conversation on Discord