qianfanhj
TypeScript icon, indicating that this package has built-in type declarations

0.0.10 • Public • Published

百度智能云千帆大模型平台 JS SDK

npm version

安装

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);
}

main();

LICENSE

Qianfan JS SDK is released under the MIT license.

Dependents (0)

Package Sidebar

Install

npm i qianfanhj

Weekly Downloads

2

Version

0.0.10

License

MIT

Unpacked Size

23.6 kB

Total Files

7

Last publish

Collaborators

  • sguo202311