UNPKG

@kaibanjs/tools

Version:

A set of tools to work with LLMs and KaibanJS

86 lines (85 loc) 2.35 kB
/** * WolframAlpha Tool * * This tool integrates with WolframAlpha (https://www.wolframalpha.com/), a computational * intelligence engine that provides robust and detailed answers to complex queries across * various domains. * * Key features: * - Advanced computations and data analysis * - Scientific and mathematical calculations * - Real-time data processing * - Domain-specific knowledge in: * - Mathematics * - Physics * - Chemistry * - Engineering * - Earth Sciences * - Life Sciences * - Units & Measures * - Financial calculations * - And more * * For more information about WolframAlpha, visit: https://www.wolframalpha.com/ * To get an API key, sign up at: https://developer.wolframalpha.com/ */ import { StructuredTool } from '@langchain/core/tools'; import { z } from 'zod'; /** * Type for the parameters in WolframAlphaTool * @typedef {string} WolframAlphaParams * @example * { * query : "What is the capital of France?" * } */ type WolframAlphaParams = { query: string; }; /** * Response type for the WolframAlphaTool * @typedef {string} WolframAlphaResult * @example * "The answer to your question is: [answer]" */ type WolframAlphaResult = string; /** * Error type for the WolframAlphaTool * @typedef {string} WolframAlphaError * @example * "ERROR_MISSING_APP_ID: No appId was provided for analysis. Agent should provide valid appId in the 'appId' field." */ type WolframAlphaError = string; /** * Type for the response from the WolframAlphaTool * @typedef {WolframAlphaResult | WolframAlphaError} WolframAlphaResponse */ type WolframAlphaResponse = WolframAlphaResult | WolframAlphaError; /** * Interface for the WolframAlphaTool * @typedef {Object} WolframAlphaFields * @property {string} appId - The WolframAlpha API key */ interface WolframAlphaFields { appId: string; } /** * WolframAlphaTool class * @extends StructuredTool */ export declare class WolframAlphaTool extends StructuredTool { private appId; private httpClient; name: string; description: string; schema: z.ZodObject<{ query: z.ZodString; }, "strip", z.ZodTypeAny, { query: string; }, { query: string; }>; constructor(fields: WolframAlphaFields); _call(input: WolframAlphaParams): Promise<WolframAlphaResponse>; } export {};