prompt-search-engine / vectorizer.py
Anja97's picture
Initial commit with cleaned project files
adad4ac
raw
history blame
313 Bytes
from sentence_transformers import SentenceTransformer
import numpy as np
from typing import Sequence
class Vectorizer:
def __init__(self, model) -> None:
self.model = SentenceTransformer(model)
def transform(self, prompts: Sequence[str]) -> np.ndarray:
return self.model.encode(prompts)