zhipu embedding token method (#1976)

Co-authored-by: jyong <jyong@dify.ai>
This commit is contained in:
Jyong 2024-01-09 19:54:02 +08:00 committed by GitHub
parent 5b24d7129e
commit 60ee98f578
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,7 +55,7 @@ class ZhipuAITextEmbeddingModel(_CommonZhipuaiAI, TextEmbeddingModel):
total_num_tokens = 0
for text in texts:
total_num_tokens += len(_get_token_ids_default_method(text))
total_num_tokens += self._get_num_tokens_by_gpt2(text)
return total_num_tokens