Skip to main content

Nomic

The NomicEmbeddings class uses the Nomic AI API to generate embeddings for a given text.

Setup

In order to use the Nomic API you'll need an API key. You can sign up for a Nomic account and create an API key here.

You'll first need to install the @langchain/nomic package:

npm install @langchain/nomic @langchain/core

Usage

import { NomicEmbeddings } from "@langchain/nomic";

/* Embed queries */
const nomicEmbeddings = new NomicEmbeddings();
const res = await nomicEmbeddings.embedQuery("Hello world");
console.log(res);
/* Embed documents */
const documentRes = await nomicEmbeddings.embedDocuments([
"Hello world",
"Bye bye",
]);
console.log(documentRes);

API Reference:


Was this page helpful?


You can also leave detailed feedback on GitHub.