Buffer compact features for a routed request (no raw prompts stored).
(
self,
request_id: str,
features: dict[str, float],
tier: str,
*,
model: str = "",
mode: str = "auto",
)
| 82 | # ─── Public API ─── |
| 83 | |
| 84 | def capture( |
| 85 | self, |
| 86 | request_id: str, |
| 87 | features: dict[str, float], |
| 88 | tier: str, |
| 89 | *, |
| 90 | model: str = "", |
| 91 | mode: str = "auto", |
| 92 | ) -> None: |
| 93 | """Buffer compact features for a routed request (no raw prompts stored).""" |
| 94 | compact = {k: v for k, v in features.items() if not k.startswith("ngram_")} |
| 95 | self._buffer[request_id] = RequestContext( |
| 96 | features=compact, |
| 97 | tier=_normalize_tier(tier), |
| 98 | timestamp=self._now(), |
| 99 | model=model, |
| 100 | mode=mode, |
| 101 | ) |
| 102 | self._save_buffer() |
| 103 | |
| 104 | def rebind_request( |
| 105 | self, |