Configure alternatives for Runnable objects that can be set at runtime.
Get the name of the Runnable.
Get a Pydantic model that can be used to validate input to the Runnable.
Get a JSON schema that represents the input to the Runnable.
Get a Pydantic model that can be used to validate output to the Runnable.
Runnable that routes to a set of Runnable based on Input['key'].
Returns the output of the selected Runnable.
Example:
from langchain_core.runnables.router import RouterRunnable
from langchain_core.runnables import RunnableLambda
add = RunnableLambda(func=lambda x: x + 1)
square = RunnableLambda(func=lambda x: x**2)
router = RouterRunnable(runnables={"add": add, "square": square})
router.invoke({"key": "square", "input": 3})Get a JSON schema that represents the output of the Runnable.
A mapping of keys to Runnable objects.