From a443b3b25677b83950ec3128b1f8701f456b4e84 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Tue, 19 Nov 2024 17:16:24 -0800 Subject: [PATCH] Fix --- libs/langgraph/langgraph/pregel/call.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/langgraph/langgraph/pregel/call.py b/libs/langgraph/langgraph/pregel/call.py index 53ece995a..a837ff4a8 100644 --- a/libs/langgraph/langgraph/pregel/call.py +++ b/libs/langgraph/langgraph/pregel/call.py @@ -1,3 +1,4 @@ +import asyncio import sys import types from typing import Any, Callable, Optional @@ -111,7 +112,9 @@ def get_runnable_for_func(func: Callable[..., Any]) -> RunnableSeq: return CACHE[func] elif not _lookup_module_and_qualname(func): return RunnableSeq( - RunnableCallable(func, trace=False), + RunnableCallable(None, func, trace=False) + if asyncio.iscoroutinefunction(func) + else RunnableCallable(func, trace=False), ChannelWrite([ChannelWriteEntry(RETURN)]), name=func.__name__, ) @@ -119,7 +122,9 @@ def get_runnable_for_func(func: Callable[..., Any]) -> RunnableSeq: return CACHE.setdefault( func, RunnableSeq( - RunnableCallable(func, trace=False), + RunnableCallable(None, func, trace=False) + if asyncio.iscoroutinefunction(func) + else RunnableCallable(func, trace=False), ChannelWrite([ChannelWriteEntry(RETURN)]), name=func.__name__, ),