atoms and molecules, and it is emitted at all wavelengths. The spectrum of radiation emitted is described by Planck's law and is known as the black body spectrum.print(    chain.run(        "What is the first prime number greater than 40 such that one plus the prime number is divisible by 3?"    ))            > Entering new MultiPromptChain chain...    math: {'input': 'What is the first prime number greater than 40 such that one plus the prime number is divisible by 3?'}    > Finished chain.    ?        The answer is 43. One plus 43 is 44 which is divisible by 3.print(chain.run("What is the name of the type of cloud that rains?"))            > Entering new MultiPromptChain chain...    None: {'input': 'What is the name of the type of cloud that rains?'}    > Finished chain.     The type of cloud that rains is called a cumulonimbus cloud. It is a tall and dense cloud that is often accompanied by thunder and lightning.EmbeddingRouterChain‚ÄãThe EmbeddingRouterChain uses embeddings and similarity to route between destination chains.from langchain.chains.router.embedding_router import EmbeddingRouterChainfrom langchain.embeddings import CohereEmbeddingsfrom langchain.vectorstores import Chromanames_and_descriptions = [    ("physics", ["for questions about physics"]),    ("math", ["for questions about math"]),]router_chain = EmbeddingRouterChain.from_names_and_descriptions(    names_and_descriptions, Chroma, CohereEmbeddings(), routing_keys=["input"])    Using embedded DuckDB without persistence: data will be transientchain = MultiPromptChain(    router_chain=router_chain,    destination_chains=destination_chains,    default_chain=default_chain,    verbose=True,)print(chain.run("What is black body radiation?"))            > Entering new MultiPromptChain chain...    physics: {'input': 'What is black body radiation?'}    > Finished chain.            Black body radiation is the emission of energy from an idealized physical body (known as a black body) that is in thermal
This notebook demonstrates how to use the RouterChain paradigm to create a chain that dynamically selects the next chain to use for a given input.
This notebook demonstrates how to use the RouterChain paradigm to create a chain that dynamically selects the next chain to use for a given input. ->: atoms and molecules, and it is emitted at all wavelengths. The spectrum of radiation emitted is described by Planck's law and is known as the black body spectrum.print(    chain.run(        "What is the first prime number greater than 40 such that one plus the prime number is divisible by 3?"    ))            > Entering new MultiPromptChain chain...    math: {'input': 'What is the first prime number greater than 40 such that one plus the prime number is divisible by 3?'}    > Finished chain.    ?        The answer is 43. One plus 43 is 44 which is divisible by 3.print(chain.run("What is the name of the type of cloud that rains?"))            > Entering new MultiPromptChain chain...    None: {'input': 'What is the name of the type of cloud that rains?'}    > Finished chain.     The type of cloud that rains is called a cumulonimbus cloud. It is a tall and dense cloud that is often accompanied by thunder and lightning.EmbeddingRouterChain‚ÄãThe EmbeddingRouterChain uses embeddings and similarity to route between destination chains.from langchain.chains.router.embedding_router import EmbeddingRouterChainfrom langchain.embeddings import CohereEmbeddingsfrom langchain.vectorstores import Chromanames_and_descriptions = [    ("physics", ["for questions about physics"]),    ("math", ["for questions about math"]),]router_chain = EmbeddingRouterChain.from_names_and_descriptions(    names_and_descriptions, Chroma, CohereEmbeddings(), routing_keys=["input"])    Using embedded DuckDB without persistence: data will be transientchain = MultiPromptChain(    router_chain=router_chain,    destination_chains=destination_chains,    default_chain=default_chain,    verbose=True,)print(chain.run("What is black body radiation?"))            > Entering new MultiPromptChain chain...    physics: {'input': 'What is black body radiation?'}    > Finished chain.            Black body radiation is the emission of energy from an idealized physical body (known as a black body) that is in thermal