跳到主要内容

Nomic

NomicEmbeddings 类使用 Nomic AI API 为给定文本生成嵌入。

设置

要使用 Nomic API,您需要一个 API 密钥。您可以在这里注册一个 Nomic 帐户并创建一个 API 密钥。

您首先需要安装 @langchain/nomic

提示

请参阅此部分以获取有关安装集成包的通用说明。

npm install @langchain/nomic @langchain/core

用法

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 参考


此页是否对您有帮助?


您也可以留下详细的反馈 在 GitHub 上.

© . This site is unofficial and not affiliated with LangChain, Inc.
这些文档随着 LangChain v1.0 在 2025 年 10 月的发布而弃用,并且不再维护。 请访问 v1.0 文档