Extract the agent's final response text from a transcript. Condenses the transcript and returns the text of the last assistant entry — what the agent said last. This is the fallback source for the session graph's `llm_response` node when the agent's stop payload does not carry the response itself. Returns `None` when the transcript has no assistant text.
(raw: &[u8], format: &str)
| 149 | /// |
| 150 | /// Returns `None` when the transcript has no assistant text. |
| 151 | pub fn last_assistant_text(raw: &[u8], format: &str) -> Option<String> { |
| 152 | condense_transcript(raw, format) |
| 153 | .into_iter() |
| 154 | .rev() |
| 155 | .find(|e| matches!(e.entry_type, EntryType::Assistant)) |
| 156 | .and_then(|e| e.content) |
| 157 | .filter(|t| !t.trim().is_empty()) |
| 158 | } |
| 159 | |
| 160 | /// The transcript format produced by an agent's transcript file. |
| 161 | /// |
no test coverage detected