UNPKG

@nomyx/assistant

Version:

A powerful assistant library and cli for your AI projects. works with Vertex AI (Claude and Gemini)

73 lines (72 loc) 1.79 kB
export interface GenericToolSchema { name: string; description: string; parameters: { type: string; properties: Record<string, ParameterDefinition>; required?: string[]; }; } export interface ParameterDefinition { type: string; description?: string; enum?: string[]; items?: ParameterDefinition; properties?: Record<string, ParameterDefinition>; required?: string[]; } export interface StandardTool { name: string; description?: string; execute(params: any, context: ActionContext): Promise<any>; } export interface IToolManager { registerTool(tool: StandardTool): void; getTool(name: string): StandardTool | undefined; getAllTools(): StandardTool[]; } export interface StandardizedToolCall { name: string; arguments: Record<string, any>; } export interface Tool extends StandardTool { getSchema(): GenericToolSchema; validate(args: Record<string, any>): boolean; } export interface ActionSchema<TInput, TOutput> { input: { type: string; properties: { [key: string]: { type: string; description?: string; }; }; required: string[]; }; output: { type: string; properties: { [key: string]: { type: string; description?: string; }; }; }; } export interface ActionContext { user: { id: string; name: string; }; session: { id: string; timestamp: string; }; } export interface Action<TInput, TOutput> { name: string; schema: ActionSchema<TInput, TOutput>; description: string; execute(params: TInput, context: ActionContext): Promise<TOutput>; }