update deprecation warnings (#718)

This commit is contained in:
Vadym Barda
2024-06-20 15:35:23 -04:00
committed by GitHub
parent adaeff149a
commit 616de2467c
3 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -11,14 +11,15 @@ F = TypeVar("F", bound=Callable[..., Any])
def deprecated(
version: str, alternative: str, *, example: str = ""
version: str, alternative: str, *, removal: str = "", example: str = ""
) -> Callable[[F], F]:
def decorator(func: F) -> F:
@functools.wraps(func)
def wrapper(*args: Any, **kwargs: Any) -> Any:
removal_str = removal if removal else "a future version"
message = (
f"{func.__name__} is deprecated as of version {version} and will be"
f" removed in a future version. Use {alternative} instead.{example}"
f" removed in {removal_str}. Use {alternative} instead.{example}"
)
warnings.warn(message, LangGraphDeprecationWarning, stacklevel=2)
return func(*args, **kwargs)
@@ -44,6 +44,7 @@ def _get_agent_state(input_schema=None):
@deprecated(
"0.0.44",
alternative="create_react_agent",
removal="0.2.0",
example="""
from langgraph.prebuilt import create_react_agent
@@ -34,7 +34,7 @@ class AgentState(TypedDict):
is_last_step: IsLastStep
@deprecated("0.0.44", "create_react_agent")
@deprecated("0.0.44", "create_react_agent", removal="0.2.0")
def create_function_calling_executor(
model: LanguageModelLike, tools: Union[ToolExecutor, Sequence[BaseTool]]
) -> CompiledGraph: