Created
October 7, 2025 15:47
-
-
Save zseta/a62739318f3c6ae71709bf0471eae57a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sentence_transformers import SentenceTransformer | |
| class EmbeddingCreator: | |
| def __init__(self, model_name: str = 'all-MiniLM-L6-v2'): | |
| self.embedding_model = SentenceTransformer(model_name, device='cpu') | |
| def create_embedding(self, text: str) -> list[float]: | |
| """ | |
| Get embedding for a single text input using SentenceTransformer. | |
| Returns the embedding vector. | |
| """ | |
| return self.embedding_model.encode(text).tolist() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment