[开源] Golang 文心千帆 sdk

文心千帆: cloud.baidu.com/product/wenxinwork... 现在基本申请了就会审核通过

项目地址: github.com/anhao/go-ernie

支持接口:

  • ERNIE-Bot
  • ERNIE-Bot-turbo
  • BLOOMZ-7B
  • Llama-2
  • Embeddings

使用

package main

import (
    "context"
    "fmt"
    ernie "github.com/anhao/go-ernie"
)

func main() {

    client := ernie.NewDefaultClient("API Key", "Secret Key")
    completion, err := client.CreateErnieBotChatCompletion(context.Background(), ernie.ErnieBotRequest{
        Messages: []ernie.ChatCompletionMessage{
            {
                Role:    ernie.MessageRoleUser,
                Content: "你好呀",
            },
        },
    })
    if err != nil {
        fmt.Printf("ernie bot error: %v\n", err)
        return
    }
    fmt.Println(completion)
}
讨论数量: 2

挺好,不过百度扣扣嗖嗖,免费额度都不送,没心思研究他家的API接口了 :joy:

8个月前 评论
Alone88 (楼主) 8个月前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!