添加千帆大模型支持
This commit is contained in:
parent
602657e094
commit
7c90312197
|
|
@ -44,6 +44,8 @@ type ModelParam struct {
|
||||||
APISecret string `json:"apiSecret"` //应用密钥
|
APISecret string `json:"apiSecret"` //应用密钥
|
||||||
APIKey string `json:"apiKey"` //应用key
|
APIKey string `json:"apiKey"` //应用key
|
||||||
System string `json:"system"` //系统参数
|
System string `json:"system"` //系统参数
|
||||||
|
AccessKey string `json:"access_key"` //accessKey参数
|
||||||
|
SecretKey string `json:"Secret_key"` //secretKey参数
|
||||||
//其他参数
|
//其他参数
|
||||||
Temperature float32 `json:"temperature"` //温度,默认0.5,核采样阈值。取值越高随机性越强,即相同的问题得到的不同答案的可能性越大
|
Temperature float32 `json:"temperature"` //温度,默认0.5,核采样阈值。取值越高随机性越强,即相同的问题得到的不同答案的可能性越大
|
||||||
MaxTokens int `json:"maxTokens"` //最大生成长度,默认4096
|
MaxTokens int `json:"maxTokens"` //最大生成长度,默认4096
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func Qianfan(modelParam proto.ModelParam, imCtx *proto.IMParamContext) {
|
func Qianfan(modelParam proto.ModelParam, imCtx *proto.IMParamContext) {
|
||||||
qianfan.GetConfig().AccessKey = proto.QianfanAccessKey
|
log.Println("qianfan model param:", modelParam)
|
||||||
qianfan.GetConfig().SecretKey = proto.QianfanSecretKey
|
log.Println("qianfan question:", imCtx.Question)
|
||||||
|
if modelParam.AccessKey == "" || modelParam.APISecret == "" {
|
||||||
|
log.Println("qianfan AccessKey or APISecret is empty")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
qianfan.GetConfig().AccessKey = modelParam.AccessKey
|
||||||
|
qianfan.GetConfig().SecretKey = modelParam.APISecret
|
||||||
|
|
||||||
chat := qianfan.NewChatCompletion(qianfan.WithModel(modelParam.Model))
|
chat := qianfan.NewChatCompletion(qianfan.WithModel(modelParam.Model))
|
||||||
var messages []qianfan.ChatCompletionMessage
|
var messages []qianfan.ChatCompletionMessage
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue