The library supports usage of Cohere-AI embed-english-v2.0 embedding model out of the box. This model returns vectors with dimension 4096.

Here’s what you have to do to use it -

  • Sign up for an account with Cohere-AI, go to the API Keys section and copy / create an API_KEY.

  • Set the key in the environment variable COHERE_API_KEY

COHERE_API_KEY="<YOUR_KEY>"

Install Cohere addon

npm install @llm-tools/embedjs-cohere

Usage

import { RAGApplicationBuilder } from '@llm-tools/embedjs';
import { CohereEmbeddings } from '@llm-tools/embedjs-cohere';
import { HNSWDb } from '@llm-tools/embedjs-hnswlib';

const app = await new RAGApplicationBuilder()
.setEmbeddingModel(new CohereEmbeddings())

Was this page helpful?