else:
            return "RunnableLambda(...)"
    def _invoke(
        self,
        input: Input,
        run_manager: CallbackManagerForChainRun,
        config: RunnableConfig,
        **kwargs: Any,
    ) -> Output:
        output = call_func_with_variable_args(
            self.func, input, config, run_manager, **kwargs
        )
        # If the output is a runnable, invoke it
        if isinstance(output, Runnable):
            recursion_limit = config["recursion_limit"]
            if recursion_limit <= 0:
                raise RecursionError(
                    f"Recursion limit reached when invoking {self} with input {input}."
                )
            output = output.invoke(
                input,
                patch_config(
                    config,
                    callbacks=run_manager.get_child(),
                    recursion_limit=recursion_limit - 1,
                ),
            )
        return output
    async def _ainvoke(
        self,
        input: Input,
        run_manager: AsyncCallbackManagerForChainRun,
        config: RunnableConfig,
        **kwargs: Any,
    ) -> Output:
        if hasattr(self, "afunc"):
            afunc = self.afunc
        else:
            @wraps(self.func)
            async def f(*args, **kwargs):  # type: ignore[no-untyped-def]
                return await asyncio.get_running_loop().run_in_executor(
                    None, partial(self.func, **kwargs), *args
                )
            afunc = f
        output = await acall_func_with_variable_args(
            afunc, input, config, run_manager, **kwargs
        )
        # If the output is a runnable, invoke it
        if isinstance(output, Runnable):