Skip to content

fix(toolbox-langchain): Expose auth requirements from underlying core tool #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: anubhav-state
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion packages/toolbox-langchain/src/toolbox_langchain/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

from asyncio import to_thread
from typing import Any, Callable, Union
from typing import Any, Awaitable, Callable, Mapping, Sequence, Union

from deprecated import deprecated
from langchain_core.tools import BaseTool
Expand Down Expand Up @@ -47,6 +47,32 @@ def __init__(
)
self.__core_tool = core_tool

@property
def _bound_params(
self,
) -> Mapping[str, Union[Callable[[], Any], Callable[[], Awaitable[Any]], Any]]:
return self.__core_tool._bound_params

@property
def _required_authn_params(self) -> Mapping[str, list[str]]:
return self.__core_tool._required_authn_params

@property
def _required_authz_tokens(self) -> Sequence[str]:
return self.__core_tool._required_authz_tokens

@property
def _auth_service_token_getters(
self,
) -> Mapping[str, Union[Callable[[], str], Callable[[], Awaitable[str]]]]:
return self.__core_tool._auth_service_token_getters

@property
def _client_headers(
self,
) -> Mapping[str, Union[Callable[[], str], Callable[[], Awaitable[str]], str]]:
return self.__core_tool._client_headers

def _run(self, **kwargs: Any) -> str:
return self.__core_tool(**kwargs)

Expand Down