Lesson 3: Chains, invalid chain name "biology"

In Lesson 3, when running the
“chain.run(“Why does every cell in our body contain DNA?”)”
command I got the following error:
“ValueError: Received invalid destination chain name ‘biology’”

I though it would be directed to the default chain but it didn’t happen.

What I’ve tried:

  1. I changed ‘DEFAULT’ to ‘default’ in MULTI_PROMPT_ROUTER_TEMPLATE, two occurrences
  2. I added space after ‘if the input is not’
  3. I added “" after "json” in MULTI_PROMPT_ROUTER_TEMPLATE

I modified this part in MULTI_PROMPT_ROUTER_TEMPLATE and it worked.

REMEMBER: “destination” MUST be one of the candidate prompts
specified below. If the input is not
well suited for any of the candidate prompts, it should be “default”.


I know it’s been a while since this question has been asked but if anyone is still having this issue even after trying both the solution in the question and in the answer (like me) what helped in my case was changing the following in MULTI_PROMPT_ROUTER_TEMPLATE:
Return a markdown code snippet with a JSON object formatted to look like:
“destination”: string \ name of the prompt to use or “default”
“next_inputs”: string \ a potentially modified version of the original input

REMEMBER: “destination” MUST be one of the candidate prompt
names specified in the CANDIDATE PROMPTS section. If it is
any other word than a candidate prompt return “default”.
REMEMBER: “next_inputs” can just be the original input
if you don’t think any modifications are needed.


There are two solutions that work.

The first one, is to change the model to the smarter one, I used gpt-4-turbo, and it works, I also tried cmd-r from cohere with no success.

The second one, is to use silient_errors=True flag in RouterChain constructor, it simply calls default chain if incorrect destination was selected by LLM (check file /chains/router/base.py:59)

1 Like

It doesn’t work for me with any of the options mentioned as solutions in this thread. Still getting -

ValueError: Received invalid destination chain name 'biology'

I had the issue and changing the prompt did not work. The only thing that worked was changing to the gpt-4-turbo model.
Maybe a line/note should be added that recommends using gpt-4.