This PR fixes how the grammar mask is index when generating text and adds a new test to ensure the grammars work with non flash models