diff --git a/examples/src/guides/expression_language/how_to_routing_custom_function.ts b/examples/src/guides/expression_language/how_to_routing_custom_function.ts index cb1d4de80fcb..235ff0380a09 100644 --- a/examples/src/guides/expression_language/how_to_routing_custom_function.ts +++ b/examples/src/guides/expression_language/how_to_routing_custom_function.ts @@ -61,11 +61,11 @@ Answer:` const route = ({ topic }: { input: string; topic: string }) => { if (topic.toLowerCase().includes("anthropic")) { return anthropicChain; - } else if (topic.toLowerCase().includes("langchain")) { + } + if (topic.toLowerCase().includes("langchain")) { return langChainChain; - } else { - return generalChain; - } + } + return generalChain; }; const fullChain = RunnableSequence.from([