langcode
Version:
A Plugin-Based Framework for Managing and Using LangChain
36 lines (35 loc) • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tools_1 = require("langchain/tools");
const types_1 = require("../../types");
class RequestsGetToolPlugin {
constructor() {
this.name = "requestsGetTool";
this.description = "Send HTTP GET requests to any URL and retrieve text content.";
this.type = types_1.PluginType.Tool;
this.RunConfigExample = {
url: ""
};
this.InitConfigExample = {};
this.tool = null;
}
expose() {
return {
name: this.name,
description: this.description,
type: this.type,
InitConfigExample: this.InitConfigExample,
RunConfigExample: this.RunConfigExample,
tool: this.tool,
};
}
async init(config) {
this.tool = new tools_1.RequestsGetTool();
}
async run(args) {
if (!this.tool)
throw new Error("Tool is not initialized.");
return await this.tool.invoke(args);
}
}
exports.default = RequestsGetToolPlugin;