mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-03 19:57:51 +00:00
Keyword-like runnable config (#26295)
This commit is contained in:
parent
17659ca2cd
commit
b993172702
@ -25,6 +25,7 @@ from typing import (
|
|||||||
List,
|
List,
|
||||||
Mapping,
|
Mapping,
|
||||||
Optional,
|
Optional,
|
||||||
|
Protocol,
|
||||||
Sequence,
|
Sequence,
|
||||||
Set,
|
Set,
|
||||||
Tuple,
|
Tuple,
|
||||||
@ -5519,12 +5520,36 @@ class RunnableBinding(RunnableBindingBase[Input, Output]):
|
|||||||
return attr
|
return attr
|
||||||
|
|
||||||
|
|
||||||
|
class _RunnableCallableSync(Protocol[Input, Output]):
|
||||||
|
def __call__(self, __in: Input, *, config: RunnableConfig) -> Output: ...
|
||||||
|
|
||||||
|
|
||||||
|
class _RunnableCallableAsync(Protocol[Input, Output]):
|
||||||
|
def __call__(self, __in: Input, *, config: RunnableConfig) -> Awaitable[Output]: ...
|
||||||
|
|
||||||
|
|
||||||
|
class _RunnableCallableIterator(Protocol[Input, Output]):
|
||||||
|
def __call__(
|
||||||
|
self, __in: Iterator[Input], *, config: RunnableConfig
|
||||||
|
) -> Iterator[Output]: ...
|
||||||
|
|
||||||
|
|
||||||
|
class _RunnableCallableAsyncIterator(Protocol[Input, Output]):
|
||||||
|
def __call__(
|
||||||
|
self, __in: AsyncIterator[Input], *, config: RunnableConfig
|
||||||
|
) -> AsyncIterator[Output]: ...
|
||||||
|
|
||||||
|
|
||||||
RunnableLike = Union[
|
RunnableLike = Union[
|
||||||
Runnable[Input, Output],
|
Runnable[Input, Output],
|
||||||
Callable[[Input], Output],
|
Callable[[Input], Output],
|
||||||
Callable[[Input], Awaitable[Output]],
|
Callable[[Input], Awaitable[Output]],
|
||||||
Callable[[Iterator[Input]], Iterator[Output]],
|
Callable[[Iterator[Input]], Iterator[Output]],
|
||||||
Callable[[AsyncIterator[Input]], AsyncIterator[Output]],
|
Callable[[AsyncIterator[Input]], AsyncIterator[Output]],
|
||||||
|
_RunnableCallableSync[Input, Output],
|
||||||
|
_RunnableCallableAsync[Input, Output],
|
||||||
|
_RunnableCallableIterator[Input, Output],
|
||||||
|
_RunnableCallableAsyncIterator[Input, Output],
|
||||||
Mapping[str, Any],
|
Mapping[str, Any],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user