from sentence_transformers import SentenceTransformer, util | |
import openai | |
with open('HKIHRMEmployeeHandbook.txt') as f: | |
full_text = f.read() | |
passages = [line.strip() for line in full_text.split('\n \n') if len(line.strip()) > 0] | |
model_name = 'multi-qa-mpnet-base-cos-v1' | |
bi_encoder = SentenceTransformer(model_name) | |
corpus_embeddings = bi_encoder.encode(passages, convert_to_tensor=True, show_progress_bar=True) |