Accept a function returning the autocomplete terms