feat: update baidu model name & ratio (#1253)

* 修正百度模型名称

* 更新百度模型名称,并保留旧版兼容以及修正单价

* chore: add more model and adjust order

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
This commit is contained in:
manjieqi 2024-04-05 00:02:15 +08:00 committed by GitHub
parent 6f036bd0c9
commit f73f2e51df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 45 additions and 20 deletions

View File

@ -72,14 +72,22 @@ var ModelRatio = map[string]float64{
"claude-3-sonnet-20240229": 3.0 / 1000 * USD, "claude-3-sonnet-20240229": 3.0 / 1000 * USD,
"claude-3-opus-20240229": 15.0 / 1000 * USD, "claude-3-opus-20240229": 15.0 / 1000 * USD,
// https://cloud.baidu.com/doc/WENXINWORKSHOP/s/hlrk4akp7 // https://cloud.baidu.com/doc/WENXINWORKSHOP/s/hlrk4akp7
"ERNIE-Bot": 0.8572, // ¥0.012 / 1k tokens "ERNIE-4.0-8K": 0.120 * RMB,
"ERNIE-Bot-turbo": 0.5715, // ¥0.008 / 1k tokens "ERNIE-Bot-8K-0922": 0.024 * RMB,
"ERNIE-Bot-4": 0.12 * RMB, // ¥0.12 / 1k tokens "ERNIE-3.5-8K": 0.012 * RMB,
"ERNIE-Bot-8K": 0.024 * RMB, "ERNIE-Lite-8K-0922": 0.008 * RMB,
"Embedding-V1": 0.1429, // ¥0.002 / 1k tokens "ERNIE-Speed-8K": 0.004 * RMB,
"bge-large-zh": 0.002 * RMB, "ERNIE-3.5-4K-0205": 0.012 * RMB,
"bge-large-en": 0.002 * RMB, "ERNIE-3.5-8K-0205": 0.024 * RMB,
"bge-large-8k": 0.002 * RMB, "ERNIE-3.5-8K-1222": 0.012 * RMB,
"ERNIE-Lite-8K": 0.003 * RMB,
"ERNIE-Speed-128K": 0.004 * RMB,
"ERNIE-Tiny-8K": 0.001 * RMB,
"BLOOMZ-7B": 0.004 * RMB,
"Embedding-V1": 0.002 * RMB,
"bge-large-zh": 0.002 * RMB,
"bge-large-en": 0.002 * RMB,
"tao-8k": 0.002 * RMB,
// https://ai.google.dev/pricing // https://ai.google.dev/pricing
"PaLM-2": 1, "PaLM-2": 1,
"gemini-pro": 1, // $0.00025 / 1k characters -> $0.001 / 1k tokens "gemini-pro": 1, // $0.00025 / 1k characters -> $0.001 / 1k tokens

View File

@ -38,16 +38,26 @@ func (a *Adaptor) GetRequestURL(meta *util.RelayMeta) (string, error) {
suffix += "completions_pro" suffix += "completions_pro"
case "ERNIE-Bot-4": case "ERNIE-Bot-4":
suffix += "completions_pro" suffix += "completions_pro"
case "ERNIE-3.5-8K":
suffix += "completions"
case "ERNIE-Bot-8K":
suffix += "ernie_bot_8k"
case "ERNIE-Bot": case "ERNIE-Bot":
suffix += "completions" suffix += "completions"
case "ERNIE-Speed":
suffix += "ernie_speed"
case "ERNIE-Bot-turbo": case "ERNIE-Bot-turbo":
suffix += "eb-instant" suffix += "eb-instant"
case "ERNIE-Speed":
suffix += "ernie_speed"
case "ERNIE-Bot-8K":
suffix += "ernie_bot_8k"
case "ERNIE-4.0-8K":
suffix += "completions_pro"
case "ERNIE-3.5-8K":
suffix += "completions"
case "ERNIE-Speed-8K":
suffix += "ernie_speed"
case "ERNIE-Speed-128K":
suffix += "ernie-speed-128k"
case "ERNIE-Lite-8K":
suffix += "ernie-lite-8k"
case "ERNIE-Tiny-8K":
suffix += "ernie-tiny-8k"
case "BLOOMZ-7B": case "BLOOMZ-7B":
suffix += "bloomz_7b1" suffix += "bloomz_7b1"
case "Embedding-V1": case "Embedding-V1":
@ -59,7 +69,7 @@ func (a *Adaptor) GetRequestURL(meta *util.RelayMeta) (string, error) {
case "tao-8k": case "tao-8k":
suffix += "tao_8k" suffix += "tao_8k"
default: default:
suffix += meta.ActualModelName suffix += strings.ToLower(meta.ActualModelName)
} }
fullRequestURL := fmt.Sprintf("%s/rpc/2.0/ai_custom/v1/wenxinworkshop/%s", meta.BaseURL, suffix) fullRequestURL := fmt.Sprintf("%s/rpc/2.0/ai_custom/v1/wenxinworkshop/%s", meta.BaseURL, suffix)
var accessToken string var accessToken string

View File

@ -1,11 +1,18 @@
package baidu package baidu
var ModelList = []string{ var ModelList = []string{
"ERNIE-Bot-4", "ERNIE-4.0-8K",
"ERNIE-Bot-8K", "ERNIE-Bot-8K-0922",
"ERNIE-Bot", "ERNIE-3.5-8K",
"ERNIE-Speed", "ERNIE-Lite-8K-0922",
"ERNIE-Bot-turbo", "ERNIE-Speed-8K",
"ERNIE-3.5-4K-0205",
"ERNIE-3.5-8K-0205",
"ERNIE-3.5-8K-1222",
"ERNIE-Lite-8K",
"ERNIE-Speed-128K",
"ERNIE-Tiny-8K",
"BLOOMZ-7B",
"Embedding-V1", "Embedding-V1",
"bge-large-zh", "bge-large-zh",
"bge-large-en", "bge-large-en",