slidedeckai.helpers.icons_embeddings.get_embeddings#
- slidedeckai.helpers.icons_embeddings.get_embeddings(texts: str | list[str]) ndarray[source]#
Generate embeddings for a list of texts using a pre-trained language model.
- Parameters:
texts – A string or a list of strings to be converted into embeddings.
- Returns:
A NumPy array containing the embeddings for the input texts.
- Raises:
ValueError – If the input is not a string or a list of strings, or if any element in the list is not a string.
Example usage: >>> keyword = ‘neural network’ >>> file_names = [‘neural_network_icon.png’, ‘data_analysis_icon.png’, ‘machine_learning.png’] >>> keyword_embeddings = get_embeddings(keyword) >>> file_name_embeddings = get_embeddings(file_names)