community[patch]: Fix requests alias for load_tools (#23734)

CC @baskaryan
This commit is contained in:
Jacob Lee
2024-07-01 15:02:14 -07:00
committed by GitHub
parent f24e38876a
commit 7791d92711
3 changed files with 66 additions and 48 deletions

View File

@@ -0,0 +1,18 @@
from langchain_community.agent_toolkits.load_tools import load_tools
from langchain_community.tools.requests.tool import (
RequestsDeleteTool,
RequestsGetTool,
RequestsPatchTool,
RequestsPostTool,
RequestsPutTool,
)
def test_load_request_tools() -> None:
request_tools = load_tools(["requests_all"], allow_dangerous_tools=True)
assert len(request_tools) == 5
assert any(isinstance(tool, RequestsDeleteTool) for tool in request_tools)
assert any(isinstance(tool, RequestsGetTool) for tool in request_tools)
assert any(isinstance(tool, RequestsPatchTool) for tool in request_tools)
assert any(isinstance(tool, RequestsPostTool) for tool in request_tools)
assert any(isinstance(tool, RequestsPutTool) for tool in request_tools)