def get_text_embedding_batch(
        self,
        texts: List[str],
        show_progress: bool = False,
        **kwargs: Any,
    ) -> List[SparseEmbedding]:
        """Get a list of text embeddings, with batching."""
        cur_batch: List[str] = []
        result_embeddings: List[SparseEmbedding] = []

        queue_with_progress = enumerate(
            get_tqdm_iterable(texts, show_progress, "Generating embeddings")
        )

        model_dict = self.model_dump()
        for idx, text in queue_with_progress:
            cur_batch.append(text)
            if idx == len(texts) - 1 or len(cur_batch) == self.embed_batch_size:
                # flush
                dispatcher.event(
                    SparseEmbeddingStartEvent(
                        model_dict=model_dict,
                    )
                )

                embeddings = self._get_text_embeddings(cur_batch)
                result_embeddings.extend(embeddings)

                dispatcher.event(
                    SparseEmbeddingEndEvent(
                        chunks=cur_batch,
                        embeddings=embeddings,
                    )
                )
                cur_batch = []

        return result_embeddings
Get a list of text embeddings, with batching.
llama-index-core/llama_index/core/base/embeddings/base_sparse.py