qianfan
v0.0.8
Published
百度智能云千帆大模型平台JS SDK
Downloads
464
Readme
百度智能云千帆大模型平台 JS SDK
安装
npm install qianfan
使用
import { Qianfan } from "qianfan";
const api_client = new Qianfan("API_KEY", "SECRET_KEY");
async function main() {
// 发起对话
const resp = await api_client.chat({
messages: [
{
role: "user",
content: "Hello World",
},
],
});
// 打印结果
console.log(resp.result);
// 文生图
const text2image_resp = await client.text2image({
prompt: "cat",
});
// 打印结果
console.log(text2image_resp);
// 插件应用
const plugin_resp = await client.plugin(
"YOUR_SERVICE_ENDPOINT",
["uuid-zhishiku"],
{
query: "焊头沾水会怎么样?",
},
);
// 打印结果
console.log(plugin_resp);
}
main();
LICENSE
Qianfan JS SDK is released under the MIT license.