transformers
b7c2cca6 - fix: raise `ValueError` for empty conversation in `apply_chat_template` (#46753)

Commit
6 days ago
fix: raise `ValueError` for empty conversation in `apply_chat_template` (#46753) * fix: raise ValueError for empty conversation in apply_chat_template apply_chat_template crashes with an unhandled IndexError when passed an empty list because conversation[0] is accessed without checking if the list is empty first. Add an explicit empty check that raises a clear ValueError with a helpful message instead. Fixes #46752 * test: add test for empty conversation in apply_chat_template * style: format test file
Author
Parents
Loading