Stevenic / vectra

Vectra is a local vector database for Node.js with features similar to pinecone but built using local files.
MIT License
321 stars 29 forks source link

Offline embedding #2

Closed hajsf closed 9 months ago

hajsf commented 1 year ago

Hi, Can U use other methods for embedding than open AI, something offline, so that I do offline enriching for my local pdf files? Thanks

Stevenic commented 1 year ago

You can use any embeddings you want. I haven't explored offline embeddings so not sure what libraries might be out there.

Stevenic commented 1 year ago

Looks like you might be able to user TensorFlow.js to generate your embeddings offline:

https://github.com/tensorflow/tfjs

Here's some example code from LangChain.js to generate embeddings using TensorFlow:

https://github.com/hwchase17/langchainjs/blob/main/langchain/src/embeddings/tensorflow.ts

Here's a video that might help as well:

https://www.youtube.com/watch?v=MdPYT-xCj9w

You'll need this package as well:

https://www.npmjs.com/package/@tensorflow-models/universal-sentence-encoder