UNPKG

@kakaopay-develop/agent-toolkit

Version:
69 lines (61 loc) 1.93 kB
import { StructuredTool, BaseToolkit } from '@langchain/core/tools'; import { z } from 'zod'; import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager'; import { RunnableConfig } from '@langchain/core/runnables'; import * as axios from 'axios'; type Context = { cid?: string; }; type Configuration = { actions: { [product: string]: { [action: string]: boolean; }; }; context?: Context; }; declare class KakaoPayClient { private client; constructor(secretKey: string); post<T>(url: string, data?: any): Promise<axios.AxiosResponse<T>>; } type Tool = { method: string; name: string; description: string; parameters: z.ZodObject<any, any, any, any>; actions: { [key: string]: { [action: string]: boolean; }; }; execute: (_client: KakaoPayClient, _context: Context, _params: any) => Promise<any>; }; declare class KakaoPayAPI { kakaoPayClient: KakaoPayClient; context: Context; tools: Tool[]; constructor(secretKey: string, context?: Context); run(method: string, arg: any): Promise<string>; } declare class KakaoPayTool extends StructuredTool { kakaopayAPI: KakaoPayAPI; method: string; name: string; description: string; schema: z.ZodObject<any, any, any, any>; constructor(kakaopayAPI: KakaoPayAPI, method: string, description: string, schema: z.ZodObject<any, any, any, any, { [x: string]: any; }>); _call(arg: z.output<typeof this.schema>, _runManager?: CallbackManagerForToolRun, _parentConfig?: RunnableConfig): Promise<any>; } declare class KakaoPayAgentToolkit implements BaseToolkit { private _kakaopay; tools: KakaoPayTool[]; constructor({ secretKey, configuration, }: { secretKey: string; configuration: Configuration; }); getTools(): KakaoPayTool[]; } export { KakaoPayAgentToolkit };