This is my code
import os
from dotenv import load_dotenv
load_dotenv()
os.environ[“HF_KEY_2”]=os.getenv(“HF_KEY_2”)
Till this line everything gets executed
from langchain_huggingface import HuggingFaceEmbeddings
embeddings = HuggingFaceEmbeddings(model_name=“all-MiniLM-L6-v2”)
I am getting error here…also the test below fails
text=“This is a test document”
query_result = embeddings.embed_query(text)
query_result
NameError: name ‘embeddings’ is not defined
Appreciate help or if anybody faced similar issue…pls help…I am using Virtual Env using VSCode and anaconda
1 Like
Before looking for a way to avoid the problem, it seems that the class is deprecated in the current LangChain.
It may be a cache-related error in huggingface_hub used in SentenceTransformers.