dashscope
v1.0.1
Published
alibaba dashscope llm sdk
Downloads
20
Readme
期待官方支持完善
文本聊天
import { chat, config } from "dashscope";
const data = {
messages: [
{
role: "system",
content: "你是达摩院的生活助手机器人。",
},
{
role: "user",
content: "欧洲最富裕的家族",
},
],
};
chat(data).then((r) => {
console.log(r);
});
文本生成图片
import { createImage, checkTaskStatus } from "dashscope";
const test = async () => {
const resp = await createImage({ prompt: "一只奔跑的加菲猫" });
if (!resp) return;
const output = resp.output;
if (output.taskId) {
const result = await checkTaskStatus(output.taskId);
console.log(result);
}
};