Custom Tools
#27442
Replies: 1 comment 1 reply
-
Hey @gnoviawan! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this together! To create custom tools using the from langchain_community.tools.requests.tool import RequestsPostTool
from langchain_community.utilities.requests import TextRequestsWrapper
import json
# Initialize the requests wrapper
requests_wrapper = TextRequestsWrapper(headers={})
# Create an instance of the RequestsPostTool
post_tool = RequestsPostTool(
requests_wrapper=requests_wrapper,
allow_dangerous_requests=True # Ensure this is set to True
)
# Define the input as a JSON string with "url" and "data" keys
input_data = json.dumps({
"url": "https://api.example.com/endpoint",
"data": {"key1": "value1", "key2": "value2"}
})
# Use the tool to send a POST request
response = post_tool._run(input_data)
print(response) Replace |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How to create Custom tools using
LCToolComponent
class ?the tools is simple post http request to API Endpoint
Beta Was this translation helpful? Give feedback.
All reactions