pdf_rag_chatbot / src /services /sentence-embedding.py
hohieu's picture
init project
841b0ff
raw
history blame
326 Bytes
from langchain_community.embeddings.sentence_transformer import (
SentenceTransformerEmbeddings
)
model = SentenceTransformerEmbeddings(model_name="vinai/phobert-base-v2")
query = 'This framework generates embeddings for each input sentence'
sentence_embeddings = model.embed_query(query)
print(len(sentence_embeddings))