Skip to content

Conversation

@cbornet
Copy link
Collaborator

@cbornet cbornet commented Dec 29, 2025

No description provided.

@cbornet cbornet requested a review from eyurtsev as a code owner December 29, 2025 18:11
@github-actions github-actions bot added core `langchain-core` package issues & PRs infra PRs made that include chores, devops, repo meta changes labels Dec 29, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 29, 2025

CodSpeed Performance Report

Merging #34530 will not alter performance

Comparing cbornet:improve-runnable-or (d51225b) with master (e03d6b8)1

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

✅ 13 untouched
⏩ 21 skipped2

Footnotes

  1. No successful run was found on master (721bf15) during the generation of this report, so e03d6b8 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 21 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

invalid_seq_w_assign = (
RunnablePassthrough.assign(context=itemgetter("question") | retriever)
| fake_llm
| fake_llm # type: ignore[operator]
Copy link
Collaborator Author

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

@cbornet cbornet force-pushed the improve-runnable-or branch from 871b740 to caac715 Compare December 29, 2025 18:36
Comment on lines +624 to +625
other: Callable[[Output], Runnable[Output, Other]]
| Callable[[Output], Awaitable[Runnable[Output, Other]]],
Copy link
Collaborator Author

@cbornet cbornet Dec 29, 2025

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]
Copy link
Collaborator Author

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 ?

@cbornet cbornet force-pushed the improve-runnable-or branch from caac715 to c19a7ca Compare December 29, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core `langchain-core` package issues & PRs infra PRs made that include chores, devops, repo meta changes langchain-classic

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant