UNPKG

@ztimson/momentum

Version:

Client library for momentum

73 lines 2 kB
import { PathEventEmitter } from './core'; import { Momentum } from './momentum'; export type AiInfo = { /** Service provider: Anthropic, OpenAI, Ollama */ readonly host: string; /** Assistant LLM version */ readonly model: string; /** Available tools */ readonly tools: { [name: string]: string; }; }; export type AiMessage = { /** Message originator */ role: 'assistant' | 'system' | 'user'; /** Message content */ content: string | any; /** Timestamp */ timestamp?: number; } | { /** Tool call */ role: 'tool'; /** Unique ID for call */ id: string; /** Tool that was run */ name: string; /** Tool arguments */ args: any; /** Tool result */ content: undefined | string; /** Tool error */ error?: undefined | string; /** Timestamp */ timestamp?: number; }; /** AI integrations */ export declare class Ai extends PathEventEmitter { protected momentum: Momentum; constructor(momentum: Momentum); /** Cancel current AI requests */ abort(): Promise<void>; /** * Ask the AI assistant a question * @param {string} question Users question * @param {context: string, stream: Function} options context - Any hidden context information. stream - Receive response in chunks * @return {Promise<string>} AI's response */ ask(question: string, options?: { context?: any; files?: File[]; stream?: (chunk: { text?: string; done?: boolean; tool?: string; }) => any; }): Promise<string>; /** * Clear AI assistant memory & context * @return {Promise<void>} Resolves once complete */ clear(): Promise<void>; /** * Current chat history * @return {Promise<AiMessage[]>} */ history(): Promise<AiMessage[]>; /** * Get model info * @return {AiInfo>} Model Info */ info(): Promise<AiInfo>; } //# sourceMappingURL=ai.d.ts.map