func CountAudioToken(sec float64, audioType string) { if audioType == "input" { } } CountTextToken 统计文本的token数量,仅当文本包含敏感词,返回错误,同时返回token数量
(text string, model string)
| 466 | |
| 467 | // CountTextToken 统计文本的token数量,仅当文本包含敏感词,返回错误,同时返回token数量 |
| 468 | func CountTextToken(text string, model string) int { |
| 469 | if text == "" { |
| 470 | return 0 |
| 471 | } |
| 472 | tokenEncoder := getTokenEncoder(model) |
| 473 | return getTokenNum(tokenEncoder, text) |
| 474 | } |
no test coverage detected