File size: 487 Bytes
6256536
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from langchain_huggingface import HuggingFaceEndpointEmbeddings
from dotenv import load_dotenv
from config.config import HUGGINGFACEHUB_API_TOKEN
load_dotenv()

def get_embedding():
    embeddings = HuggingFaceEndpointEmbeddings(
    repo_id="sentence-transformers/all-mpnet-base-v2",
    task="feature-extraction",
    huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN
    )
    return embeddings


# vector = embedding().embed_query("This is a cloud-based embedding.")
# print(vector)