Some checks failed
CI / validate (pull_request) Has been cancelled
Add nexus/adaptive_calibrator.py with the AdaptiveCalibrator class that provides online learning (EMA) for LLM inference cost prediction. Key features: - Per-model ModelCalibration state tracking ms/token and base overhead - EMA updates from observed (prompt_tokens, completion_tokens, actual_ms) - Confidence metric grows with sample count (1 - exp(-n/10)) - Seeded priors distinguish local Ollama models from Groq cloud models - Atomic JSON persistence to ~/.nexus/calibrator_state.json - reset() per-model or global; autosave on every record() - 23 unit tests covering convergence, persistence, edge cases Exported from nexus/__init__.py as AdaptiveCalibrator and CostPrediction. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
36 lines
788 B
Python
36 lines
788 B
Python
"""
|
|
Nexus — Embodied Mind Module
|
|
|
|
The perception adapter, experience store, trajectory logger, and
|
|
consciousness loop that give Timmy a body in the Nexus.
|
|
"""
|
|
|
|
from nexus.perception_adapter import (
|
|
ws_to_perception,
|
|
parse_actions,
|
|
PerceptionBuffer,
|
|
Perception,
|
|
Action,
|
|
)
|
|
from nexus.experience_store import ExperienceStore
|
|
from nexus.trajectory_logger import TrajectoryLogger
|
|
from nexus.adaptive_calibrator import AdaptiveCalibrator, CostPrediction
|
|
|
|
try:
|
|
from nexus.nexus_think import NexusMind
|
|
except Exception:
|
|
NexusMind = None
|
|
|
|
__all__ = [
|
|
"ws_to_perception",
|
|
"parse_actions",
|
|
"PerceptionBuffer",
|
|
"Perception",
|
|
"Action",
|
|
"ExperienceStore",
|
|
"TrajectoryLogger",
|
|
"AdaptiveCalibrator",
|
|
"CostPrediction",
|
|
"NexusMind",
|
|
]
|