HF RL Explorer

Bug: Chat template renders empty tool list incorrectly

Bug: Chat template renders empty tool list incorrectly: a task in LegoFlow-SWE (Harbor dataset). When using the tokenizer’s template to render a chat with an empty tool list ( tools= ), the resulting tokens include an unwanted <functions </functions block. The expected behavior is that the…

The task

When using the tokenizer’s `template` to render a chat with an empty tool list (`tools=[]`), the resulting `tokens` include an unwanted `<functions>[]</functions>` block. The expected behavior is that the `<functions>` section should be omitted entirely when `tools` is empty, just as it is when `tools` is `None`.

Part of Lego-X/LegoFlow-SWE.