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
- Yarn
- pnpm
npm install @langchain/nomic
yarn add @langchain/nomic
pnpm add @langchain/nomic
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:
- NomicEmbeddings from
@langchain/nomic