'llm2':  fake_llm,
}
| RunnablePassthrough.assign(
    total_chars=lambda inputs: len(inputs['llm1'] + inputs['llm2'])
  )
runnable.invoke('hello')
# {'llm1': 'completion', 'llm2': 'completion', 'total_chars': 20}
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param afunc: Optional[Union[Callable[[langchain_core.runnables.base.Other], Awaitable[None]], Callable[[langchain_core.runnables.base.Other, langchain_core.runnables.config.RunnableConfig], Awaitable[None]]]] = None¶
param func: Optional[Union[Callable[[langchain_core.runnables.base.Other], None], Callable[[langchain_core.runnables.base.Other, langchain_core.runnables.config.RunnableConfig], None]]] = None¶
param input_type: Optional[Type[langchain_core.runnables.base.Other]] = None¶
async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Optional[Any]) → List[Output]¶
Default implementation runs ainvoke in parallel using asyncio.gather.
The default implementation of batch works well for IO bound runnables.
Subclasses should override this method if they can batch more efficiently;
e.g., if the underlying runnable uses an API which supports a batch mode.
async ainvoke(input: Other, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Other[source]¶
Default implementation of ainvoke, calls invoke from a thread.
The default implementation allows usage of async code even if