"""
LongRefiner Algorithm Implementation
====================================

LongRefiner: A three-stage context compression algorithm for long-context RAG.

Stages:
    1. Query Analysis: Determines if the query needs local or global information
    2. Document Structuring: Structures documents into hierarchical sections
    3. Global Selection: Selects relevant sections based on query analysis

References:
    LongRefiner: Compress, Structure, and Select for Long-Context RAG
"""

from __future__ import annotations

from typing import TYPE_CHECKING

from .compressor import LongRefinerCompressor

__all__ = [
    "LongRefinerCompressor",
]

# Type hint for optional import
if TYPE_CHECKING:
    from .operator import LongRefinerOperator as _LongRefinerOperator

# Optional: SAGE operator (only available inside SAGE framework)
LongRefinerOperator: type[_LongRefinerOperator] | None
try:
    from .operator import LongRefinerOperator

    __all__.append("LongRefinerOperator")
except ImportError:
    LongRefinerOperator = None
