mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-02 02:11:58 +00:00
fix(compact_20260112): surface warning-only applied edits in response
`applied_edits_for_response()` previously hid `compact_20260112` edits when they had only warnings (no compaction block, no error). This dropped diagnostically important warnings such as `unsupported_trigger_type_X_using_input_tokens` and `pause_after_compaction_ignored` whenever the conversation was under the trigger threshold. Operators now see these warnings in the response. Co-authored-by: Yassin Kortam <yassin@berri.ai>
This commit is contained in:
parent
5298d52e2c
commit
78fa1fb1e1
1 changed files with 13 additions and 7 deletions
|
|
@ -29,18 +29,24 @@ class PolyfillResult:
|
|||
"""``applied_edits`` to attach on the client-visible response.
|
||||
|
||||
``compact_20260112`` is included when a new compaction block was
|
||||
synthesized (success) OR when the edit carries an ``error`` field
|
||||
synthesized (success), when the edit carries an ``error`` field
|
||||
(``summary_model_not_configured``, ``summary_call_failed``,
|
||||
``summary_extraction_failed``) — operators and clients need to see
|
||||
why compaction was requested but not applied. Slice-only /
|
||||
under-threshold paths that produced no edit at all are omitted.
|
||||
Other edit types are included when the editor returned an
|
||||
``AppliedEdit``.
|
||||
``summary_extraction_failed``), or when the edit carries
|
||||
``warnings`` (e.g. ``unsupported_trigger_type_X_using_input_tokens``,
|
||||
``pause_after_compaction_ignored``) — operators and clients need to
|
||||
see why compaction was requested but not applied as expected.
|
||||
Slice-only / under-threshold paths that produced no edit at all
|
||||
(no block, no error, no warnings) are omitted. Other edit types are
|
||||
included when the editor returned an ``AppliedEdit``.
|
||||
"""
|
||||
visible: List[AppliedEdit] = []
|
||||
for edit in self.applied_edits:
|
||||
if edit.get("type") == COMPACT_EDIT_TYPE:
|
||||
if self.compaction_block is not None or edit.get("error"):
|
||||
if (
|
||||
self.compaction_block is not None
|
||||
or edit.get("error")
|
||||
or edit.get("warnings")
|
||||
):
|
||||
visible.append(edit)
|
||||
else:
|
||||
visible.append(edit)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue