Skip to content

Commit 6aed6ad

Browse files
authored
throws error when draft_choices not cut enough (#10)
1 parent 37e0cc3 commit 6aed6ad

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

DraftRetriever/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,11 @@ impl Reader {
353353

354354
let (draft_choices, max_branch) = get_draft_choices(paths.clone());
355355

356+
if draft_choices.len() > choices as usize {
357+
// It might not be cut enough because cut_to_choices() is best effort, as mentioned in the comment above
358+
return Err(exceptions::PyValueError::new_err("draft_choices was not cut enough"));
359+
}
360+
356361
let (draft_attn_mask, tree_indices, draft_position_ids, retrieve_indices) = generate_draft_buffers(draft_choices.clone(), max_branch);
357362

358363
let max_length = paths.iter().map(|path| path.len()).max().unwrap_or(0);

0 commit comments

Comments
 (0)