1.0.2 • Published 5 months ago

@taotao7/tongyi-js-sdk v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

tongyi-js-sdk

This is a third-party JavaScript SDK library used for AskSage, use at your own risk. Currently, it does not support SSE interface and only supports the openai result_format format.

more

TODO

  • message
  • prompt
  • stream(sse)
  • search
  • stop(block word)
  • seed
  • max_token

use

import TongYi from '@tao/tongyi-js-sdk'

const client = new TongYi(process.env.DASHSCOPE_API_KEY as string);

const promptRes = await client.sendPrompt("今天星期几");
console.log(promptRes.data)

const msgRes = await client.sendMessage([
    {
      role: "system",
      content: "you are a helpful assistant",
    },
    {
      role: "user",
      content: "你好吗",
    },
    {
      role: "assistant",
      content: "我很好,谢谢你",
    },
    {
      role: "user",
      content: "你叫什么名字",
    },
]);
console.log(msgRes.data)
1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago