Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the LLM history tracking to prefer a cleaner, conversation-style history by focusing on voice/ASR input and enforcing a maximum history length via truncation.
Changes:
- Extract only voice/ASR inputs per tick for the user history entry.
- Store a simplified assistant history entry composed of spoken text (and selected parsed
responsefields). - Replace summarization-trigger behavior with direct history truncation to
history_length.
src/providers/llm_history_manager.py
Outdated
| else: | ||
| formatted_inputs = ( | ||
| f"User: {self.agent_name} received no voice input this cycle." | ||
| ) |
There was a problem hiding this comment.
When no voice/ASR input is present, this generates a placeholder user message ("received no voice input this cycle"). Given the PR goal (“only save voice input”), consider not creating/storing any user history entry for cycles without voice input (or gate placeholder storage behind an explicit debug flag).
| if ( | ||
| self.history_manager.config.history_length > 0 | ||
| and len(self.history_manager.history) | ||
| > self.history_manager.config.history_length | ||
| ): |
There was a problem hiding this comment.
history_length is Optional[int] (see LLMConfig.history_length), but this code compares it to 0. If it is ever None, this will raise TypeError. Please guard with is not None (or coerce to an int) before doing comparisons/arithmetic, similar to the existing truncation logic in start_summary_task’s callback.
src/providers/llm_history_manager.py
Outdated
| speak_parts = [] | ||
| for action in response.actions: | ||
| atype = action.type.lower() | ||
| if atype == "speak" and action.value: | ||
| speak_parts.append(action.value) |
There was a problem hiding this comment.
This change stops recording non-verbal actions into assistant history (only speak and parsed JSON with a response field are kept). If that’s intended, consider removing the now-unused ACTION_MAP constant to avoid dead code; otherwise, consider retaining a structured action summary so the history still reflects what the agent did.
src/providers/llm_history_manager.py
Outdated
| # Only extract voice (ASR) input for clean conversation history | ||
| voice_input = "" | ||
| for input_type, input_info in self.io_provider.inputs.items(): | ||
| if input_info.tick == current_tick: | ||
| logging.debug(f"LLM: {input_type} (tick #{input_info.tick})") |
There was a problem hiding this comment.
There are existing pytest unit tests covering LLMHistoryManager.update_history formatting and history-length behavior. With the new voice-only input extraction, those tests should be updated and new cases added (voice present vs absent, truncation) to prevent regressions.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Overview
Only save the voice input to the history based on the history length.