langchain_core.runnables.base.coerce_to_runnable¶

langchain_core.runnables.base.coerce_to_runnable(thing: Union[Runnable[Input, Output], Callable[[Input], Output], Callable[[Input], Awaitable[Output]], Callable[[Iterator[Input]], Iterator[Output]], Callable[[AsyncIterator[Input]], AsyncIterator[Output]], Mapping[str, Any]]) Runnable[Input, Output][source]¶

Coerce a runnable-like object into a Runnable.

Parameters

thing (Union[Runnable[Input, Output], Callable[[Input], Output], Callable[[Input], Awaitable[Output]], Callable[[Iterator[Input]], Iterator[Output]], Callable[[AsyncIterator[Input]], AsyncIterator[Output]], Mapping[str, Any]]) – A runnable-like object.

Returns

A Runnable.

Return type

Runnable[Input, Output]