EmbedJs supports local embeddings via Ollama. Read more here Ollama embeddings.

To use this, you need to setup and have Ollama working locally. Refer to their Github here to understand how to do this. Once done, follow these steps -

Install Ollama addon

npm install @llm-tools/embedjs-ollama

Usage

import { RAGApplicationBuilder } from '@llm-tools/embedjs';
import { OllamaEmbeddings } from '@llm-tools/embedjs-ollama';

const app = await new RAGApplicationBuilder()
.setEmbeddingModel(new OllamaEmbeddings({
    modelName: "...",
    baseUrl: 'http://localhost:11434'
}))

Was this page helpful?