from sentence_transformers import SentenceTransformer from sklearn.preprocessing import normalize from config.rag_config import RAGConfig class Embedder: def __init__(self, config: RAGConfig): self.model = SentenceTransformer(config.embedding_model_name) self.normalize = config.normalize_embeddings def embed_texts(self, texts): embeddings = self.model.encode(texts, convert_to_numpy=True) if self.normalize: embeddings = normalize(embeddings) return embeddings