Repository navigation
Conversation
ad1e2a7 to
1440abb
Compare
Castiron custom code✅ No new custom-code files detected. 36 mixed files remain; 0 existing customizations changed. Compared 36 existing customizations unchanged
A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload the exact patch produced by this run (requires repository access): gh run download 35490000656 --repo openai/openai-python \
--name castiron-custom-code-35490000656-1 --dir /tmp/castiron-custom-code-35490000656-1
git apply --stat /tmp/castiron-custom-code-35490000656-1/custom-code.patch
cat /tmp/castiron-custom-code-35490000656-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin 45341061b382473ee8a8e8c796ef8819089abbb6 1440abb43768e5bc5073069667251afe2e1f2d3e
python3 scripts/castiron/custom_code_report.py report \
--base 45341061b382473ee8a8e8c796ef8819089abbb6 \
--head 1440abb43768e5bc5073069667251afe2e1f2d3e --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-1440abb43768
cat /tmp/castiron-custom-code-1440abb43768/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
|
AI-assisted offline accumulator comparison at Five sequences per revision:
The sparse cases also exercise the new per-index event-state dictionary: finishing one choice does not suppress the other choice's done event. Minimal sparse-text input sequence (all chunks have id/model choices_by_chunk = [
[{"index": 4, "delta": {"content": "D"}, "finish_reason": None}],
[{"index": 2, "delta": {"content": "B"}, "finish_reason": None}],
[{"index": 4, "delta": {"content": "d"}, "finish_reason": None},
{"index": 2, "delta": {"content": "b"}, "finish_reason": None}],
[{"index": 2, "delta": {}, "finish_reason": "stop"},
{"index": 4, "delta": {}, "finish_reason": "stop"}],
]Each list was passed through |
Changes being requested
Fix Chat Completions stream accumulation when choice chunks arrive out of index order.
ChatCompletionStreamStatecurrently useschoice.indexas a Python list offset in the snapshot and event-state collections. That only works when every lower-numbered choice has already appeared. A chunk containing a single choice withindex=1, for example, has a one-elementchoiceslist, so the initial snapshot path attempts to assignchoices[1]and raisesIndexError.This change keeps the API-provided index as the choice identity instead of assuming it is the current list position:
choice.index;indexfield;The regression test feeds the accumulator a valid
1 -> 0 -> 1sequence and verifies that the later delta is appended to choice 1, while the final snapshot remains ordered as choices 0 and 1.Additional context & links
The production change is confined to the handwritten
src/openai/lib/streaming/chat/implementation; no generated API resource or public model changes are required.