1
const { HuggingFaceInferenceEmbeddings } = require('@huggingface/inference');

const embeddings = new HuggingFaceInferenceEmbeddings({
  apiKey: process.env.HUGGINGFACEHUB_API_KEY,
  model: "hkunlp/instructor-large",
});

    vectorStore = await HNSWLib.load(
      VECTOR_STORE_PATH,
      // new OpenAIEmbeddings()
      embeddings
    );

I am trying to sub OpenAiEmbeddings with Huggingface, but with import from @huggingface/inference package I get the error:

TypeError: HuggingFaceInferenceEmbeddings is not a constructor 

With import from langchain there is the

Error: __init__() got an unexpected keyword argument 'pooling_mode_weightedmean_tokens' 

, I am considering using another vectorDb lib. Without specifying any model it should default to one and it gives the same error.

user42141
  • 33
  • 4

0 Answers0