This commit is contained in:
Nuno Campos
2024-12-04 15:39:16 -08:00
parent ec7bbe14b2
commit 40d16593c7
2 changed files with 18 additions and 22 deletions
+17 -1
View File
@@ -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
+1 -21
View File
@@ -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