Skip to content

Commit a373eff

Browse files
committed
[#34] inline _user_directive_text into _build_user_blocks
Single-caller helper merged into its only caller. Removes the last surviving gold-plating flagged by code-simplifier in round 1 of the Phase B review pipeline.
1 parent 260c883 commit a373eff

1 file changed

Lines changed: 12 additions & 17 deletions

File tree

src/xbrain/describe.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -652,22 +652,6 @@ def describe_all(
652652
return report
653653

654654

655-
def _user_directive_text(batch_size: int) -> dict:
656-
"""Build the trailing text block for the user turn — index-range directive.
657-
658-
Tells the model the index range so the JSON list it emits is
659-
contractually one-to-one with the input order. Indices are
660-
zero-based to match Python and the rubric's example.
661-
"""
662-
return {
663-
"type": "text",
664-
"text": (
665-
f"Describe images 0 through {batch_size - 1}. "
666-
"Return a JSON list with one entry per image, in the order received."
667-
),
668-
}
669-
670-
671655
def _run_one_batch(
672656
*,
673657
batch: list[_Candidate],
@@ -773,7 +757,18 @@ def _build_user_blocks(batch: list[_Candidate], media_root: Path) -> list[dict]:
773757
for candidate in batch:
774758
data = _load_bytes(media_root, candidate.entry.local_path)
775759
blocks.append(_build_image_block(data, _media_type(candidate.entry.local_path)))
776-
blocks.append(_user_directive_text(len(batch)))
760+
# Trailing text directive: tell the model the index range so its JSON
761+
# list is contractually one-to-one with the input order. Indices are
762+
# zero-based to match Python and the rubric's example.
763+
blocks.append(
764+
{
765+
"type": "text",
766+
"text": (
767+
f"Describe images 0 through {len(batch) - 1}. "
768+
"Return a JSON list with one entry per image, in the order received."
769+
),
770+
}
771+
)
777772
return blocks
778773

779774

0 commit comments

Comments
 (0)