-
Notifications
You must be signed in to change notification settings - Fork 20.3k
chore(core): improve typing of Runnable __or__
#34530
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
base: master
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #34530 will not alter performanceComparing
|
| invalid_seq_w_assign = ( | ||
| RunnablePassthrough.assign(context=itemgetter("question") | retriever) | ||
| | fake_llm | ||
| | fake_llm # type: ignore[operator] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we are doing that on purpose
871b740 to
caac715
Compare
| other: Callable[[Output], Runnable[Output, Other]] | ||
| | Callable[[Output], Awaitable[Runnable[Output, Other]]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed for instance when chain = input_map | router (see test_higher_order_lambda_runnable)
and
def router(params: dict[str, Any]) -> Runnable[dict[str, Any], str]:| from langchain_core.runnables.passthrough import RunnablePick # noqa: PLC0415 | ||
|
|
||
| return self | RunnablePick(keys) | ||
| return self | RunnablePick(keys) # type: ignore[operator, no-any-return] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think mypy is right: RunnablePick needs a dict[str, Any] as input so it cannot be piped to any Runnable.
Shouldn't it be implemented only for specific subclasses ?
caac715 to
c19a7ca
Compare
c19a7ca to
6aea797
Compare
No description provided.