def build_sparse_embeddings(
        self, input_batch: List[List[int]]
    ) -> List[SparseEmbedding]:
        """
        Build a list of sparse dictionaries from a batch of input_ids.

        NOTE: taken from https://www.pinecone.io/learn/hybrid-search-intro/.

        """
        # store a batch of sparse embeddings
        sparse_emb_list = []
        # iterate through input batch
        for token_ids in input_batch:
            sparse_emb = {}
            # convert the input_ids list to a dictionary of key to frequency values
            d = dict(Counter(token_ids))
            for idx in d:
                sparse_emb[idx] = float(d[idx])
            sparse_emb_list.append(sparse_emb)
        # return sparse_emb list
        return sparse_emb_list

        Build a list of sparse dictionaries from a batch of input_ids.

        NOTE: taken from https://www.pinecone.io/learn/hybrid-search-intro/.

        
llama-index-integrations/vector_stores/llama-index-vector-stores-pinecone/llama_index/vector_stores/pinecone/utils.py