Skip to content

Commit 50e4caa

Browse files
chore: remove debug writer dependency
1 parent cc37a5f commit 50e4caa

1 file changed

Lines changed: 5 additions & 16 deletions

File tree

src/askui/models/shared/truncation_strategies.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -333,15 +333,7 @@ def __init__(
333333
self._n_messages_to_keep = n_messages_to_keep
334334
self._token_counter = SimpleTokenCounter()
335335
self._image_removal_boundary_index: int | None = None
336-
try:
337-
from askui.models.shared.truncation_debug import ( # type: ignore[import-untyped]
338-
TruncationDebugWriter,
339-
)
340-
341-
self._debug_writer = TruncationDebugWriter()
342-
except ImportError:
343-
self._debug_writer = None
344-
logger.exception("Could not add truncation debug writer")
336+
self._debug_writer = None
345337

346338
logger.warning(
347339
"%s is experimental and may change, misbehave or crash "
@@ -380,7 +372,8 @@ def append_message(self, message: MessageParam) -> None:
380372
truncated = True
381373

382374
if self._debug_writer:
383-
self._debug_writer.write_snapshot(
375+
# will only be used if compatible debug writer is injected
376+
self._debug_writer.write_snapshot( # type: ignore[unreachable]
384377
event="truncate" if truncated else "append",
385378
full_messages=self._full_message_history,
386379
truncated_messages=self._truncated_message_history,
@@ -401,9 +394,7 @@ def truncate(self) -> None:
401394
logger.warning(msg)
402395
return
403396
if _has_pending_tool_use(self._truncated_message_history):
404-
logger.debug(
405-
"Deferring truncation: last message has pending tool_use"
406-
)
397+
logger.debug("Deferring truncation: last message has pending tool_use")
407398
return
408399

409400
logger.info("Summarizing message history")
@@ -729,9 +720,7 @@ def truncate(self) -> None:
729720
logger.warning(msg)
730721
return
731722
if _has_pending_tool_use(self._truncated_message_history):
732-
logger.debug(
733-
"Deferring truncation: last message has pending tool_use"
734-
)
723+
logger.debug("Deferring truncation: last message has pending tool_use")
735724
return
736725

737726
logger.info("Summarizing message history")

0 commit comments

Comments
 (0)