I want to know how can I use Model Selector node as fallback mechanism in my workflow. I checked the docs and I found this statement “… This enables implementing fallback mechanisms for error handling or choosing the optimal model for specific tasks.” it means that I could use it when my primary LLM returning error.
I tried to change the “On Error” setting from “Stop” to “Continue” and tried to get the error message using this syntax {{ $json.execution.error.message }} like on the workflow below but it doesn’t work. So how should I use Model Selector node as fallback mechanism?
Thanks it works! but what about if I want the second model to also do the same? Let’s say I want LLM 1 and 2 to be about raid limit do I also use {{ $error.message }} syntax on the second rule?
Hi @ezraluandre Yes you can use that $error.message syntax, but it has some limits on, what i would recommend is you should:
Set up rules with increasingly broad conditions:
-
Rule 1: {{ $error.message }} contains 429 > Model 2
-
Rule 2: {{ $error.message }} contains rate limit > Model 3 (broader match, catches what rule 1 misses)
-
Rule 3 (default): {{ $error }} is not empty > Model 3 (catch-all)
I just notice that I use {{ error }} syntax and not {{ error.message}}, when I use {{ error.message }} with contain Rate Limit it return this error message:
No matching rule found
None of the defined rules matched the workflow data
why it is failed when I add message parameter?
@ezraluandre That is good, using error instead of error.message in your model selector, as sometimes the error i mean that object would not specifically have a message object.
It might be failing because like in your error object it does not exist i mean that message branch and maybe that error object can be empty which is highly unlikely , it must be because the error object does not contain anything like message as insider object.
Ok that’s clarify why I got that error message. Once again thank you!
@ezraluandre glad it helped you consider marking that as a solution to let future discoverers know what it means.
Cheers!