macro_rules! conditional_edges {
($graph:expr, $source:expr, $route_fn:expr, $($key:expr => $val:expr),+ $(,)?) => { ... };
}Expand description
Simplify add_conditional_edges with automatic route map construction.
Python:
graph.add_conditional_edges("chatbot", tools_condition)Rust (before):
ⓘ
graph.add_conditional_edges(
"chatbot",
RoutingFn(tools_condition),
Some({
let mut map = HashMap::new();
map.insert("tools".to_string(), "tools".to_string());
map.insert(END.to_string(), END.to_string());
map
}),
)?;Rust (after):
ⓘ
conditional_edges!(graph, "chatbot", tools_condition, "tools" => "tools", END => END)?;