import { HttpClient } from '../core/http-client.js'; import { ChatRequest, ChatStreamRequest, ChatResponse } from '../types/chat.types.js'; import { AIStream } from '../core/ai-stream.js'; /** * Chat API operations * * Provides AI-powered chat interactions with dashboards and data sources. * Each sendMessage call creates a new connection, receives the response, * then closes. State is managed server-side and can be reset via resetContext(). * * @example * ```typescript * // Non-streaming * const response = await client.ai.chat.sendMessage({ * message: 'Show me sales trends', * datasourceId: 'my-datasource', * }); * * // Streaming * const stream = await client.ai.chat.sendMessage({ * message: 'Analyze my data', * datasourceId: 'my-datasource', * stream: true, * }); * for await (const event of stream) { ... } * ``` */ export declare class ChatOperations { private httpClient; private basePath; /** * Create chat API operations. * * @param httpClient - HTTP client used to call the Reveal AI API * @param basePath - Base path for AI endpoints */ constructor(httpClient: HttpClient, basePath: string); /** * Send a chat message and get a response. * * When `stream` is omitted or false, returns a Promise that resolves * with the complete ChatResponse (uses plain JSON HTTP, no SSE). * * When `stream` is true, returns an AIStream that yields events * as they arrive from the server (SSE). The stream supports: * - `for await (const event of stream)` iteration * - `.on('text', handler)` event listeners * - `.finalResponse()` to get the aggregated ChatResponse * * @param request - Chat request parameters * @returns Chat response for non-streaming requests or AIStream for streaming requests */ sendMessage(request: ChatRequest): Promise; sendMessage(request: ChatStreamRequest): Promise>; /** * Reset the chat context/state on the server * * @param signal - AbortSignal for request cancellation * @returns A promise that resolves when the conversation history is cleared * * @example * ```typescript * await client.ai.chat.resetContext(); * console.log('Chat context reset'); * ``` */ resetContext(signal?: AbortSignal): Promise; /** * Non-streaming path: POST with Accept: application/json, get plain JSON back */ private sendNonStreaming; /** * Streaming path: POST with Accept: text/event-stream, return AIStream */ private sendStreaming; /** * Build the server request body from the client request object */ private buildRequestBody; } //# sourceMappingURL=chat.d.ts.map