UNPKG

@langchain/community

Version:
42 lines (40 loc) • 1.36 kB
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs'); const __langchain_core_tools = require_rolldown_runtime.__toESM(require("@langchain/core/tools")); //#region src/tools/wolframalpha.ts var wolframalpha_exports = {}; require_rolldown_runtime.__export(wolframalpha_exports, { WolframAlphaTool: () => WolframAlphaTool }); /** * @example * ```typescript * const tool = new WolframAlphaTool({ * appid: "YOUR_APP_ID", * }); * const res = await tool.invoke("What is 2 * 2?"); * ``` */ var WolframAlphaTool = class extends __langchain_core_tools.Tool { appid; name = "wolfram_alpha"; description = `A wrapper around Wolfram Alpha. Useful for when you need to answer questions about Math, Science, Technology, Culture, Society and Everyday Life. Input should be a search query.`; constructor(fields) { super(fields); this.appid = fields.appid; } static lc_name() { return "WolframAlphaTool"; } async _call(query) { const url = `https://www.wolframalpha.com/api/v1/llm-api?appid=${this.appid}&input=${encodeURIComponent(query)}`; const res = await fetch(url); return res.text(); } }; //#endregion exports.WolframAlphaTool = WolframAlphaTool; Object.defineProperty(exports, 'wolframalpha_exports', { enumerable: true, get: function () { return wolframalpha_exports; } }); //# sourceMappingURL=wolframalpha.cjs.map