interface PdfPageText {
    page: number;
    text: string;
}
interface PdfAiAssistantConfig {
    endpoint: string;
    apiKey?: string;
    model?: string;
    headers?: Record<string, string>;
    maxContextChars?: number;
    temperature?: number;
    stream?: boolean;
}
interface PdfAiMessage {
    role: "system" | "user" | "assistant";
    content: string;
}
interface PdfAiPanelConfig extends PdfAiAssistantConfig {
    title?: string;
    placeholder?: string;
}
interface PdfAiPanelMessage {
    role: "user" | "assistant";
    content: string;
    error?: string;
    parts: Array<{
        text?: string;
        page?: number;
    }>;
}
declare class PdfAiAssistant {
    private readonly config;
    constructor(config: PdfAiAssistantConfig);
    /**
     * Ask a free-form question about the document. `documentText` is the output
     * of PdfJsViewerComponent.getDocumentText(); `history` carries prior turns
     * for multi-turn chat.
     */
    ask(question: string, documentText: PdfPageText[], history?: PdfAiMessage[], signal?: AbortSignal, onToken?: (full: string, delta: string) => void): Promise<string>;
    /** One-shot document summary. */
    summarize(documentText: PdfPageText[]): Promise<string>;
    /**
     * Raw chat-completions call for custom prompting. Pass `onToken` to stream the
     * answer token-by-token (the callback receives the running full text and the
     * latest delta); the Promise still resolves to the complete text. Streaming is
     * requested only when `onToken` is given and `config.stream !== false`, and it
     * falls back to a single JSON response if the endpoint doesn't stream.
     */
    complete(messages: PdfAiMessage[], signal?: AbortSignal, onToken?: (full: string, delta: string) => void): Promise<string>;
    /**
     * Read an OpenAI-style Server-Sent Events stream, accumulating
     * choices[0].delta.content and emitting each delta through onToken. Returns the
     * full concatenated text. Tolerates chunk boundaries that split SSE lines, and
     * skips frames it can't parse (keep-alive comments, non-`data:` lines) rather
     * than failing the whole stream.
     */
    private readStream;
    private buildContext;
}

export { PdfAiAssistant };
export type { PdfAiAssistantConfig, PdfAiMessage, PdfAiPanelConfig, PdfAiPanelMessage, PdfPageText };
