Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

erick/v03 merge master again #26444

Merged
merged 18 commits into from
Sep 13, 2024
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Keyword-like runnable config (#26295)
hinthornw authored Sep 11, 2024
commit b993172702ee55141e82a2c2a280b9d457b060b6
25 changes: 25 additions & 0 deletions libs/core/langchain_core/runnables/base.py
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
List,
Mapping,
Optional,
Protocol,
Sequence,
Set,
Tuple,
@@ -5519,12 +5520,36 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
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[
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],
]