In the TokenCountBatchingStrategy implementation, pre-compute the token count in documents so that it can fail fast before iterating through the documents. For more details, see here.