18 lines
429 B
Python
18 lines
429 B
Python
"""Adaptive RAG shared utils."""
|
|
from __future__ import annotations
|
|
|
|
from .shared_imports import *
|
|
|
|
def _env_int(name: str, default: int, *, minimum: int, maximum: int) -> int:
|
|
raw = str(os.getenv(name, "") or "").strip()
|
|
if not raw:
|
|
value = int(default)
|
|
else:
|
|
try:
|
|
value = int(raw)
|
|
except Exception:
|
|
value = int(default)
|
|
return max(minimum, min(maximum, value))
|
|
|
|
|