Document why reasoning_content keeps its existing meaning

The reasoning_items accumulator now carries every item, while
reasoning_content still holds the summary text of the most recent one. That is
intentional: widening reasoning_content would change what every existing
consumer of that field sees, which is a separate change from the reported bug
(#43620, items being overwritten).

Recorded at the accumulation site so the asymmetry reads as a decision rather
than an oversight.
This commit is contained in:
JingHao-Leon 2026-10-11 18:52:28 +08:00
parent d2569073ad
commit 8dbba3c0ba

View file

@ -883,6 +883,12 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge):
summary_raw=item.summary,
)
pending_reasoning_items = (*pending_reasoning_items, built_reasoning_item)
# ``reasoning_content`` deliberately keeps its pre-existing meaning —
# the summary text of the most recent reasoning item — even though
# ``reasoning_items`` now carries all of them. Widening it to join
# every item's summary would change what every existing consumer of
# ``reasoning_content`` sees, which is a different fix from "stop
# dropping reasoning items" and belongs in its own change.
reasoning_content = " ".join(s["text"] for s in built_reasoning_item["summary"] if s.get("text"))
elif isinstance(item, ResponseOutputMessage):