Skip to content

Commit

Permalink
core: Cache RunnableLambda deps (#29200)
Browse files Browse the repository at this point in the history
`RunnableLambda`'s `deps` may do costly OS operation by calling
`get_function_nonlocals`.
So it's better to cache it.
See #29043
  • Loading branch information
cbornet authored Jan 23, 2025
1 parent f795ab9 commit 618e550
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/core/langchain_core/runnables/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4457,7 +4457,7 @@ def get_output_schema(
module_name=module,
)

@property
@functools.cached_property
def deps(self) -> list[Runnable]:
"""The dependencies of this Runnable.
Expand Down

0 comments on commit 618e550

Please sign in to comment.