diff --git a/libs/langgraph/langgraph/func/__init__.py b/libs/langgraph/langgraph/func/__init__.py index d990ae4a5..d608f41f7 100644 --- a/libs/langgraph/langgraph/func/__init__.py +++ b/libs/langgraph/langgraph/func/__init__.py @@ -23,12 +23,28 @@ from langgraph.pregel.call import get_runnable_for_func from langgraph.pregel.read import PregelNode from langgraph.pregel.write import ChannelWrite, ChannelWriteEntry from langgraph.store.base import BaseStore -from langgraph.types import RetryPolicy, call +from langgraph.types import RetryPolicy P = ParamSpec("P") +P1 = TypeVar("P1") T = TypeVar("T") +def call( + func: Callable[[P1], T], + input: P1, + *, + retry: Optional[RetryPolicy] = None, +) -> concurrent.futures.Future[T]: + from langgraph.constants import CONFIG_KEY_CALL + from langgraph.utils.config import get_configurable + + conf = get_configurable() + impl = conf[CONFIG_KEY_CALL] + fut = impl(func, input, retry=retry) + return fut + + @overload def task( *, retry: Optional[RetryPolicy] = None diff --git a/libs/langgraph/langgraph/types.py b/libs/langgraph/langgraph/types.py index c3bf175a2..67c7e53f8 100644 --- a/libs/langgraph/langgraph/types.py +++ b/libs/langgraph/langgraph/types.py @@ -1,5 +1,3 @@ -import concurrent -import concurrent.futures import dataclasses import sys from collections import deque @@ -22,7 +20,7 @@ from typing import ( ) from langchain_core.runnables import Runnable, RunnableConfig -from typing_extensions import ParamSpec, Self +from typing_extensions import Self from langgraph.checkpoint.base import ( BaseCheckpointSaver, @@ -365,21 +363,3 @@ def interrupt(value: Any) -> Any: ), ) ) - - -P = ParamSpec("P") -T = TypeVar("T") - - -def call( - func: str | Callable[P, T], - *args: P.args, - retry: Optional[RetryPolicy] = None, -) -> concurrent.futures.Future[T]: - from langgraph.constants import CONFIG_KEY_CALL - from langgraph.utils.config import get_configurable - - conf = get_configurable() - impl = conf[CONFIG_KEY_CALL] - fut = impl(func, *args, retry=retry) - return fut