mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-30 19:59:40 +02:00
update deprecation warnings (#718)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user