Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions aragora/debate/cognitive_limiter_rlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
3. The LLM can recursively call itself on context subsets
4. The LLM dynamically decides decomposition strategy (grep, map-reduce, peek, etc.)

When the official RLM library is installed (`pip install aragora[rlm]`), this module
When the official RLM library is installed (`pip install rlm`), this module
uses the real REPL-based approach. Otherwise, it falls back to hierarchical
summarization which preserves semantics but isn't true RLM.

Install RLM support:
pip install aragora[rlm]
pip install rlm
"""

from __future__ import annotations
Expand All @@ -37,11 +37,6 @@
)

# Check for official RLM library (use factory for consistent initialization)
get_rlm: Any
get_compressor: Any
DebateContextAdapter: Any
RLMBackendConfig: Any

try:
from aragora.rlm import get_rlm, get_compressor, HAS_OFFICIAL_RLM
from aragora.rlm.bridge import DebateContextAdapter, RLMBackendConfig
Expand All @@ -50,10 +45,10 @@
except ImportError:
HAS_OFFICIAL_RLM = False
HAS_RLM_FACTORY = False
get_rlm = None
get_compressor = None
DebateContextAdapter = None
RLMBackendConfig = None
get_rlm: Any = None # type: ignore[no-redef]
get_compressor: Any = None # type: ignore[no-redef]
DebateContextAdapter: Any = None # type: ignore[no-redef]
RLMBackendConfig: Any = None # type: ignore[no-redef]

if TYPE_CHECKING:
from aragora.rlm.compressor import HierarchicalCompressor
Expand Down Expand Up @@ -206,7 +201,7 @@ def __init__(
else:
logger.info(
"RLM factory not available. Using hierarchical summarization fallback. "
"Install with: pip install aragora[rlm]"
"Install with: pip install rlm"
)

# Widen stats type to support mixed int/float/dict values from RLM extension
Expand Down Expand Up @@ -251,7 +246,8 @@ async def query_with_rlm(
... strategy="grep"
... )
"""
if not self.has_real_rlm:
rlm = self._aragora_rlm
if rlm is None:
logger.warning("Real RLM not available, using fallback search")
return self._fallback_search(query, messages)

Expand All @@ -263,7 +259,7 @@ async def query_with_rlm(
formatted_context = self._format_messages_for_rlm(messages)

# Use AragoraRLM for query
result = await self._aragora_rlm.compress_and_query(
result = await rlm.compress_and_query(
query=query,
content=formatted_context,
source_type="debate",
Expand Down
17 changes: 7 additions & 10 deletions aragora/knowledge/mound/api/rlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
approach where the model writes code to examine context. This is preferred
over compression-based methods.

Install TRUE RLM: pip install aragora[rlm]
Install TRUE RLM: pip install rlm

NOTE: This is a mixin class designed to be composed with KnowledgeMound.
Attribute accesses like self._ensure_initialized, self.workspace_id, self.query_semantic, etc.
Expand Down Expand Up @@ -127,7 +127,7 @@ async def query_with_rlm(
# Build text content from knowledge items
content_parts = []
for item in items:
source = getattr(item, "source", None) or getattr(item, "source_type", None)
source: Any = getattr(item, "source", None) or getattr(item, "source_type", None)
source_str = (
source.value if hasattr(source, "value") else str(source) if source else "unknown"
)
Expand Down Expand Up @@ -212,7 +212,7 @@ async def query_with_true_rlm(
- Model writes code like: `facts = get_facts(km, "topic", min_confidence=0.8)`
- No information loss from truncation or compression

This is the PREFERRED method when `pip install aragora[rlm]` is installed.
This is the PREFERRED method when `pip install rlm` is installed.

Falls back to compression-based query if TRUE RLM not available.

Expand All @@ -227,8 +227,7 @@ async def query_with_true_rlm(
"""
if not HAS_RLM:
logger.warning(
"[rlm] RLM not available for knowledge query. "
"Install with: pip install aragora[rlm]"
"[rlm] RLM not available for knowledge query. Install with: pip install rlm"
)
return None

Expand All @@ -242,7 +241,7 @@ async def query_with_true_rlm(
logger.warning(
"[rlm] TRUE RLM preferred but not available. "
"Will use compression fallback. "
"Install with: pip install aragora[rlm] for better results."
"Install with: pip install rlm for better results."
)

# Fetch relevant knowledge items via QueryOperationsMixin
Expand All @@ -259,7 +258,7 @@ async def query_with_true_rlm(
# Build text content from knowledge items
content_parts = []
for item in items:
source = getattr(item, "source", None) or getattr(item, "source_type", None)
source: Any = getattr(item, "source", None) or getattr(item, "source_type", None)
source_str = (
source.value if hasattr(source, "value") else str(source) if source else "unknown"
)
Expand Down Expand Up @@ -368,9 +367,7 @@ async def create_knowledge_repl(
REPL environment, or None if TRUE RLM not available
"""
if not HAS_RLM or not HAS_OFFICIAL_RLM:
logger.warning(
"[rlm] TRUE RLM REPL not available. Install with: pip install aragora[rlm]"
)
logger.warning("[rlm] TRUE RLM REPL not available. Install with: pip install rlm")
return None

# Cast self to Protocol to access methods provided by composed KnowledgeMound class
Expand Down
2 changes: 1 addition & 1 deletion aragora/memory/cross_debate_rlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
context = await memory.get_relevant_context(task="Design a new API")

Install official RLM support:
pip install aragora[rlm]
pip install rlm
"""

from __future__ import annotations
Expand Down
5 changes: 1 addition & 4 deletions aragora/rlm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
can symbolically interact with."

Installation:
# Install with real RLM support
pip install aragora[rlm]

# Or install the official library directly
# Install the official RLM library for real RLM support
pip install rlm

Usage with Real RLM:
Expand Down
2 changes: 1 addition & 1 deletion aragora/rlm/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ class REPLContextAdapter(RLMContextAdapter):
# >>> disagreements = search_debate(debate, r"disagree|however")
# >>> FINAL(f"Key disagreements: {summarize(disagreements)}")

Requires: pip install aragora[rlm] for TRUE RLM functionality
Requires: pip install rlm for TRUE RLM functionality
"""

def __init__(
Expand Down
8 changes: 4 additions & 4 deletions aragora/rlm/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def _apply_env_overrides(rlm_config: RLMConfig) -> RLMConfig:
if not HAS_OFFICIAL_RLM:
error_msg = (
"TRUE RLM required but official RLM library not installed. "
"Install with: pip install aragora[rlm] or pip install rlm"
"Install with: pip install rlm"
)
logger.error("[RLM Factory] %s", error_msg)
raise RuntimeError(error_msg)
Expand Down Expand Up @@ -264,12 +264,12 @@ def _apply_env_overrides(rlm_config: RLMConfig) -> RLMConfig:
if warn_on_fallback and effective_mode in (RLMMode.AUTO, RLMMode.TRUE_RLM):
logger.warning(
"[RLM Factory] TRUE RLM not available, using compression fallback. "
"For better performance, install: pip install aragora[rlm]"
"For better performance, install: pip install rlm"
)
else:
logger.info(
"[RLM Factory] Created AragoraRLM with compression fallback "
"(official RLM not installed - pip install aragora[rlm] for TRUE RLM)"
"(official RLM not installed - pip install rlm for TRUE RLM)"
)

# Cache if using default config and no specific mode
Expand Down Expand Up @@ -468,7 +468,7 @@ async def wrapper(*args, **kwargs):
if not HAS_OFFICIAL_RLM:
raise RuntimeError(
f"Function {func.__name__} requires TRUE RLM but official library "
"is not installed. Install with: pip install aragora[rlm]"
"is not installed. Install with: pip install rlm"
)
return await func(*args, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion docs/status/STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1965,7 +1965,7 @@ Based on [arXiv:2512.24601](https://arxiv.org/abs/2512.24601) - "Recursive Langu
**Installation:**
```bash
# Install with real RLM support
pip install aragora
pip install rlm
```

**Usage:**
Expand Down
2 changes: 1 addition & 1 deletion tests/debate/test_cognitive_limiter_rlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- Real RLM integration (arXiv:2512.24601) - REPL-based approach
- Fallback hierarchical summarization when RLM library not installed

Install real RLM: pip install aragora[rlm]
Install real RLM: pip install rlm
"""

from __future__ import annotations
Expand Down
2 changes: 1 addition & 1 deletion tests/rlm/test_cognitive_limiter_rlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
is stored as a Python variable and LLM writes code to query it
2. Fallback hierarchical summarization when RLM library not installed

Install real RLM: pip install aragora[rlm]
Install real RLM: pip install rlm
"""

import asyncio
Expand Down
Loading