Skip to main content

Alibaba Tongyi

The AlibabaTongyiEmbeddings class uses the Alibaba Tongyi API to generate embeddings for a given text.

Setupโ€‹

You'll need to sign up for an Alibaba API key and set it as an environment variable named ALIBABA_API_KEY.

Then, you'll need to install the @langchain/community package

npm install @langchain/community @langchain/core

Usageโ€‹

import { AlibabaTongyiEmbeddings } from "@langchain/community/embeddings/alibaba_tongyi";

const model = new AlibabaTongyiEmbeddings({});
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.

© . This site is unofficial and not affiliated with LangChain, Inc.
่ฟ™ไบ›ๆ–‡ๆกฃ้š็€ LangChain v1.0 ๅœจ 2025 ๅนด 10 ๆœˆ็š„ๅ‘ๅธƒ่€Œๅผƒ็”จ๏ผŒๅนถไธ”ไธๅ†็ปดๆŠคใ€‚ ่ฏท่ฎฟ้—ฎ v1.0 ๆ–‡ๆกฃ