from __future__ import annotations

from pathlib import Path
from typing import Any
from collections.abc import Sequence

from ketju.rag.protocols import RAGProtocol
from ketju.rag.base import BaseRAG

class RAGAdapter(BaseRAG):
    def __init__(self, engine: RAGProtocol, *, name: str, persist_dir: Path | None = None, docs_dir: Path):
        super().__init__(name=name, persist_dir=persist_dir, docs_dir=docs_dir)
        self.engine = engine

    def ingest(
        self,
        folder: Path | None = None,
        files: Sequence[Path | str] | None = None,
        max_files: int | None = None,
        **kwargs: Any,
    ) -> int:
        return self.engine.ingest(folder=folder, files=files, max_files=max_files, **kwargs)

    def query(self, question: str, **kwargs: Any) -> Any:
        return self.engine.query(question, **kwargs)