Skip to content

The agent engineering platform.

langchain[patch]: Fix `config` arg detection for wrapped lambdarunnable (#14230)

Vincent Brouwers67662564f345
diff --git a/libs/core/langchain_core/runnables/base.py b/libs/core/langchain_core/runnables/base.py
index 1943de8285..d0d1d8d06f 100644
--- a/libs/core/langchain_core/runnables/base.py
+++ b/libs/core/langchain_core/runnables/base.py
@@ -6,7 +6,7 @@ import threading
from abc import ABC, abstractmethod
from concurrent.futures import FIRST_COMPLETED, wait
from copy import deepcopy
-from functools import partial
+from functools import partial, wraps
from itertools import tee
from operator import itemgetter
from typing import (
@@ -2518,6 +2518,7 @@ class RunnableLambda(Runnable[Input, Output]):
afunc = self.afunc
else:
+ @wraps(self.func)
async def f(*args, **kwargs): # type: ignore[no-untyped-def]
return await asyncio.get_running_loop().run_in_executor(
None, partial(self.func, **kwargs), *args