mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-18 08:03:36 +00:00
community[minor]: add allow_dangerous_requests for OpenAPI toolkits (#19493)
**OpenAPI allow_dangerous_requests**: community: add allow_dangerous_requests for OpenAPI toolkits **Description:** a description of the change Due to BaseRequestsTool changes, we need to pass allow_dangerous_requests manually.b617085af0/libs/community/langchain_community/tools/requests/tool.py (L26-L46)
While OpenAPI toolkits didn't pass it in the arguments.b617085af0/libs/community/langchain_community/agent_toolkits/openapi/planner.py (L262-L269)
**Issue:** the issue # it fixes, if applicable https://github.com/langchain-ai/langchain/issues/19440 If not passing allow_dangerous_requests, it won't be able to do requests. **Dependencies:** any dependencies required for this change Not much --------- Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com> Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
@@ -35,8 +35,8 @@ class BaseRequestsTool(BaseModel):
|
||||
if not kwargs.get("allow_dangerous_requests", False):
|
||||
raise ValueError(
|
||||
"You must set allow_dangerous_requests to True to use this tool. "
|
||||
"Request scan be dangerous and can lead to security vulnerabilities. "
|
||||
"For example, users can ask a server to make a request to an internal"
|
||||
"Requests can be dangerous and can lead to security vulnerabilities. "
|
||||
"For example, users can ask a server to make a request to an internal "
|
||||
"server. It's recommended to use requests through a proxy server "
|
||||
"and avoid accepting inputs from untrusted sources without proper "
|
||||
"sandboxing."
|
||||
@@ -50,7 +50,10 @@ class RequestsGetTool(BaseRequestsTool, BaseTool):
|
||||
"""Tool for making a GET request to an API endpoint."""
|
||||
|
||||
name: str = "requests_get"
|
||||
description: str = "A portal to the internet. Use this when you need to get specific content from a website. Input should be a url (i.e. https://www.google.com). The output will be the text response of the GET request."
|
||||
description: str = """A portal to the internet. Use this when you need to get specific
|
||||
content from a website. Input should be a url (i.e. https://www.google.com).
|
||||
The output will be the text response of the GET request.
|
||||
"""
|
||||
|
||||
def _run(
|
||||
self, url: str, run_manager: Optional[CallbackManagerForToolRun] = None
|
||||
@@ -182,7 +185,11 @@ class RequestsDeleteTool(BaseRequestsTool, BaseTool):
|
||||
"""Tool for making a DELETE request to an API endpoint."""
|
||||
|
||||
name: str = "requests_delete"
|
||||
description: str = "A portal to the internet. Use this when you need to make a DELETE request to a URL. Input should be a specific url, and the output will be the text response of the DELETE request."
|
||||
description: str = """A portal to the internet.
|
||||
Use this when you need to make a DELETE request to a URL.
|
||||
Input should be a specific url, and the output will be the text
|
||||
response of the DELETE request.
|
||||
"""
|
||||
|
||||
def _run(
|
||||
self,
|
||||
|
Reference in New Issue
Block a user