diff --git a/packages/toolbox-langchain/src/toolbox_langchain/async_tools.py b/packages/toolbox-langchain/src/toolbox_langchain/async_tools.py index 627b18e1..fee763c3 100644 --- a/packages/toolbox-langchain/src/toolbox_langchain/async_tools.py +++ b/packages/toolbox-langchain/src/toolbox_langchain/async_tools.py @@ -14,6 +14,7 @@ from typing import Any, Callable, Union +from deprecated import deprecated from langchain_core.tools import BaseTool from toolbox_core.tool import ToolboxTool as ToolboxCoreTool from toolbox_core.utils import params_to_pydantic_model @@ -108,6 +109,18 @@ def add_auth_token_getter( """ return self.add_auth_token_getters({auth_source: get_id_token}) + @deprecated("Please use `add_auth_token_getters` instead.") + def add_auth_tokens( + self, auth_tokens: dict[str, Callable[[], str]], strict: bool = True + ) -> "AsyncToolboxTool": + return self.add_auth_token_getters(auth_tokens) + + @deprecated("Please use `add_auth_token_getter` instead.") + def add_auth_token( + self, auth_source: str, get_id_token: Callable[[], str], strict: bool = True + ) -> "AsyncToolboxTool": + return self.add_auth_token_getter(auth_source, get_id_token) + def bind_params( self, bound_params: dict[str, Union[Any, Callable[[], Any]]], diff --git a/packages/toolbox-langchain/src/toolbox_langchain/tools.py b/packages/toolbox-langchain/src/toolbox_langchain/tools.py index fd7ab197..500f03ae 100644 --- a/packages/toolbox-langchain/src/toolbox_langchain/tools.py +++ b/packages/toolbox-langchain/src/toolbox_langchain/tools.py @@ -15,6 +15,7 @@ from asyncio import to_thread from typing import Any, Callable, Union +from deprecated import deprecated from langchain_core.tools import BaseTool from toolbox_core.sync_tool import ToolboxSyncTool as ToolboxCoreSyncTool from toolbox_core.utils import params_to_pydantic_model @@ -94,6 +95,18 @@ def add_auth_token_getter( """ return self.add_auth_token_getters({auth_source: get_id_token}) + @deprecated("Please use `add_auth_token_getters` instead.") + def add_auth_tokens( + self, auth_tokens: dict[str, Callable[[], str]], strict: bool = True + ) -> "ToolboxTool": + return self.add_auth_token_getters(auth_tokens) + + @deprecated("Please use `add_auth_token_getter` instead.") + def add_auth_token( + self, auth_source: str, get_id_token: Callable[[], str], strict: bool = True + ) -> "ToolboxTool": + return self.add_auth_token_getter(auth_source, get_id_token) + def bind_params( self, bound_params: dict[str, Union[Any, Callable[[], Any]]],