import { StandardRagBuilder } from './StandardRagBuilder.js';
import { TextChunker, TextRecombiner } from '../chunking/index.js';
export class Rag {
    static standard(context, collectionName, workspace, items) {
        return new StandardRagBuilder(context, collectionName, workspace, items);
    }
    static async filterWithSurroundingText(text, queryOrQueryVector, context, opts) {
        const { tokenLimit, surroundingCharacters, chunkLength, overlap } = opts;
        return Rag.standard(context)
            .addItems(TextChunker.fixedCharacterLength(text, {
            chunkLength,
            overlap,
        }))
            .query(queryOrQueryVector)
            .recombine(TextRecombiner.surroundingTextWithPreview(surroundingCharacters, '...\n', tokenLimit, context.chat.tokenizer, overlap));
    }
}
