强制转换为可运行#
- langchain_core.runnables.base.coerce_to_runnable(thing: Runnable[Input, Output] | Callable[[Input], Output] | Callable[[Input], Awaitable[Output]] | Callable[[Iterator[Input]], Iterator[Output]] | Callable[[AsyncIterator[Input]], AsyncIterator[Output]] | _RunnableCallableSync[Input, Output] | _RunnableCallableAsync[Input, Output] | _RunnableCallableIterator[Input, Output] | _RunnableCallableAsyncIterator[Input, Output] | Mapping[str, Any]) Runnable[Input, Output] [source]#
将一个类似Runnable的对象强制转换为Runnable。
- Parameters:
thing (Runnable[Input, Output] | Callable[[Input], Output] | Callable[[Input], Awaitable[Output]] | Callable[[Iterator[Input]], Iterator[Output]] | Callable[[AsyncIterator[Input]], AsyncIterator[Output]] | _RunnableCallableSync[Input, Output] | _RunnableCallableAsync[Input, Output] | _RunnableCallableIterator[Input, Output] | _RunnableCallableAsyncIterator[Input, Output] | Mapping[str, Any]) – 一个类似Runnable的对象。
- Returns:
一个可运行的对象。
- Raises:
TypeError – 如果对象不是类似Runnable的。
- Return type:
Runnable[Input, Output]