Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion agents/s06_context_compact.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def auto_compact(messages: list) -> list:
"Be concise but preserve critical details.\n\n" + conversation_text}],
max_tokens=2000,
)
summary = response.content[0].text
summary = next((block.text for block in response.content if hasattr(block, "text")), "")
if not summary:
summary = "No summary generated."
# Replace all messages with compressed summary
return [
{"role": "user", "content": f"[Conversation compressed. Transcript: {transcript_path}]\n\n{summary}"},
Expand Down