I've built an app that use embedding model from Huggingface under the hood. It uses "@huggingface/transformers" package, version "^3.8.1".
The way I use it is that I call:
this.extractor = await pipeline('feature-extraction', config.modelName);
and then:
const output = await this.extractor(text, { pooling: 'mean', normalize: true });
to generate embeddings.
Some of the models are big and take time to download, so I though it will improve UX if I firstly check if model is ready. If not, user should be shown a message that model is being downloaded and a progress bar indicating how long will it take to finish.
Is there a standard way for that? As for now I can see that the model is stored in ./node_modules/@huggingface/transformers/.cache/ and in theory I could just check if the file exists there, but do I have a guarantee that this path does not change in the future?