Ensures compaction config has a summarizer initialized.
(
*, config: EventsCompactionConfig, agent: BaseAgent
)
| 221 | |
| 222 | |
| 223 | def _ensure_compaction_summarizer( |
| 224 | *, config: EventsCompactionConfig, agent: BaseAgent |
| 225 | ) -> None: |
| 226 | """Ensures compaction config has a summarizer initialized.""" |
| 227 | if config.summarizer is not None: |
| 228 | return |
| 229 | |
| 230 | from ..agents.llm_agent import LlmAgent |
| 231 | |
| 232 | if not isinstance(agent, LlmAgent): |
| 233 | raise ValueError( |
| 234 | 'No LlmAgent model available for event compaction summarizer.' |
| 235 | ) |
| 236 | config.summarizer = LlmEventSummarizer(llm=agent.canonical_model) |
| 237 | |
| 238 | |
| 239 | def _events_to_compact_for_token_threshold( |
no test coverage detected