import type { BaseNode, Document, NodeWithScore } from "../../Node.js";
import type { KeywordExtractPrompt, QueryKeywordExtractPrompt } from "../../Prompt.js";
import type { BaseRetriever, RetrieveParams } from "../../Retriever.js";
import type { ServiceContext } from "../../ServiceContext.js";
import type { BaseNodePostprocessor } from "../../postprocessors/index.js";
import type { StorageContext } from "../../storage/StorageContext.js";
import type { BaseDocumentStore } from "../../storage/docStore/types.js";
import type { BaseSynthesizer } from "../../synthesizers/index.js";
import type { QueryEngine } from "../../types.js";
import type { BaseIndexInit } from "../BaseIndex.js";
import { BaseIndex, KeywordTable } from "../BaseIndex.js";
import type { LLM } from "../../llm/types.js";
export interface KeywordIndexOptions {
    nodes?: BaseNode[];
    indexStruct?: KeywordTable;
    indexId?: string;
    serviceContext?: ServiceContext;
    llm?: LLM;
    storageContext?: StorageContext;
}
export declare enum KeywordTableRetrieverMode {
    DEFAULT = "DEFAULT",
    SIMPLE = "SIMPLE",
    RAKE = "RAKE"
}
declare abstract class BaseKeywordTableRetriever implements BaseRetriever {
    protected index: KeywordTableIndex;
    protected indexStruct: KeywordTable;
    protected docstore: BaseDocumentStore;
    protected llm: LLM;
    protected maxKeywordsPerQuery: number;
    protected numChunksPerQuery: number;
    protected keywordExtractTemplate: KeywordExtractPrompt;
    protected queryKeywordExtractTemplate: QueryKeywordExtractPrompt;
    constructor({ index, keywordExtractTemplate, queryKeywordExtractTemplate, maxKeywordsPerQuery, numChunksPerQuery, }: {
        index: KeywordTableIndex;
        keywordExtractTemplate?: KeywordExtractPrompt;
        queryKeywordExtractTemplate?: QueryKeywordExtractPrompt;
        maxKeywordsPerQuery: number;
        numChunksPerQuery: number;
    });
    abstract getKeywords(query: string): Promise<string[]>;
    retrieve({ query }: RetrieveParams): Promise<NodeWithScore[]>;
}
export declare class KeywordTableLLMRetriever extends BaseKeywordTableRetriever {
    getKeywords(query: string): Promise<string[]>;
}
export declare class KeywordTableSimpleRetriever extends BaseKeywordTableRetriever {
    getKeywords(query: string): Promise<string[]>;
}
export declare class KeywordTableRAKERetriever extends BaseKeywordTableRetriever {
    getKeywords(query: string): Promise<string[]>;
}
/**
 * The KeywordTableIndex, an index that extracts keywords from each Node and builds a mapping from each keyword to the corresponding Nodes of that keyword.
 */
export declare class KeywordTableIndex extends BaseIndex<KeywordTable> {
    constructor(init: BaseIndexInit<KeywordTable>);
    static init(options: KeywordIndexOptions): Promise<KeywordTableIndex>;
    asRetriever(options?: any): BaseRetriever;
    asQueryEngine(options?: {
        retriever?: BaseRetriever;
        responseSynthesizer?: BaseSynthesizer;
        preFilters?: unknown;
        nodePostprocessors?: BaseNodePostprocessor[];
    }): QueryEngine;
    static extractKeywords(text: string, serviceContext?: ServiceContext): Promise<Set<string>>;
    /**
     * High level API: split documents, get keywords, and build index.
     * @param documents
     * @param storageContext
     * @param serviceContext
     * @returns
     */
    static fromDocuments(documents: Document[], args?: {
        storageContext?: StorageContext;
        serviceContext?: ServiceContext;
    }): Promise<KeywordTableIndex>;
    /**
     * Get keywords for nodes and place them into the index.
     * @param nodes
     * @param serviceContext
     * @param vectorStore
     * @returns
     */
    static buildIndexFromNodes(nodes: BaseNode[], docStore: BaseDocumentStore, serviceContext?: ServiceContext): Promise<KeywordTable>;
    insertNodes(nodes: BaseNode[]): Promise<void>;
    deleteNode(nodeId: string): void;
    deleteNodes(nodeIds: string[], deleteFromDocStore: boolean): Promise<void>;
    deleteRefDoc(refDocId: string, deleteFromDocStore?: boolean): Promise<void>;
}
export {};
