V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
爱意满满的作品展示区。
alone88

[开源] Golang 文心千帆 sdk

  •  
  •   alone88 · Jul 30, 2023 · 1193 views
    This topic created in 1004 days ago, the information mentioned may be changed or developed.

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

    项目地址: https://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)
    }
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5430 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 08:17 · PVG 16:17 · LAX 01:17 · JFK 04:17
    ♥ Do have faith in what you're doing.