def _mean_pooling(self, model_output: Any, attention_mask: Any) -> Any:
        """Mean Pooling - Take attention mask into account for correct averaging."""
        token_embeddings = model_output[
            0
        ]  # First element of model_output contains all token embeddings
        input_mask_expanded = np.broadcast_to(
            np.expand_dims(attention_mask, axis=-1), token_embeddings.size()
        )
        return np.sum(token_embeddings * input_mask_expanded, 1) / np.clip(
            input_mask_expanded.sum(1), a_min=1e-9
        )
Mean Pooling - Take attention mask into account for correct averaging.
llama-index-integrations/embeddings/llama-index-embeddings-openvino-genai/llama_index/embeddings/openvino_genai/base.py