INNER CODE UNIT · Python
__init__
pathwaycom/llm-app · serviette/server/main.py:109
def __init__(self) -> None:
self._snapshot: tuple | None = None
self._changed_at: int | None = None
def observe(self, stats: dict[str, Any]) -> dict[str, Any]:
import time
key = (
stats.get("chunks"),
stats.get("documents"),
stats.get("last_indexed_at"),
)
if self._snapshot is None:
self._snapshot = key # first look: nothing to compare against
elif key != self._snapshot:
self._snapshot = key
self._changed_at = int(time.time())
stored = stats.get("last_indexed_at")