langgraph4j
langgraph4j copied to clipboard
How to implement routing function:
How to implement routing function: How to achieve intent recognition similar: The selector for LlamaIndex Pydant Router in LlamaIndex ZeroShot TextRouter in Haystack
HI @smileyboy2019
The routing is based on conditional edge that use a routing function to decide what is the next step.
In the routing function you got the Agent State and based on it you can choose the route
graph.addConditionalEdges("nl-router", routingFunction, Map.of( "first": "llm-router", "second": "semantic-router" ) );
It is very important define and contribute to the Agent State in order to have in each node or edge the right information to do the right actions
1.How to pass parameters during the routing process 2. Can the entire arrangement be implemented through JSON
1.How to pass parameters during the routing process 2. Can the entire arrangement be implemented through JSON
- Only
Agent Stateis passed to node and edge actions so, you have to store parameters into state itself - Could be, but it is not so and should be implemented