Skip to main content

ZhipuAI

ZhipuAIEmbeddings 类使用 ZhipuAI API 为给定文本生成嵌入(embeddings)。

准备工作

你需要注册一个 ZhipuAI API 密钥,并将其设置为名为 ZHIPUAI_API_KEY 的环境变量。

https://open.bigmodel.cn

然后,你需要安装 @langchain/community 包:

:::提示 请参阅安装集成包的一般说明部分。 :::

npm install @langchain/community @langchain/core jsonwebtoken

使用方法

import { ZhipuAIEmbeddings } from "@langchain/community/embeddings/zhipuai";

const model = new ZhipuAIEmbeddings({});
const res = await model.embedQuery(
"What would be a good company name a company that makes colorful socks?"
);
console.log({ res });

API Reference:

相关内容


Was this page helpful?


You can also leave detailed feedback on GitHub.