initial commit
This commit is contained in:
31
venv/Lib/site-packages/langgraph/managed/base.py
Normal file
31
venv/Lib/site-packages/langgraph/managed/base.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from inspect import isclass
|
||||
from typing import (
|
||||
Any,
|
||||
Generic,
|
||||
TypeGuard,
|
||||
TypeVar,
|
||||
)
|
||||
|
||||
from langgraph._internal._scratchpad import PregelScratchpad
|
||||
|
||||
V = TypeVar("V")
|
||||
U = TypeVar("U")
|
||||
|
||||
__all__ = ("ManagedValueSpec", "ManagedValueMapping")
|
||||
|
||||
|
||||
class ManagedValue(ABC, Generic[V]):
|
||||
@staticmethod
|
||||
@abstractmethod
|
||||
def get(scratchpad: PregelScratchpad) -> V: ...
|
||||
|
||||
|
||||
ManagedValueSpec = type[ManagedValue]
|
||||
|
||||
|
||||
def is_managed_value(value: Any) -> TypeGuard[ManagedValueSpec]:
|
||||
return isclass(value) and issubclass(value, ManagedValue)
|
||||
|
||||
|
||||
ManagedValueMapping = dict[str, ManagedValueSpec]
|
||||
Reference in New Issue
Block a user