mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 03:09:01 +08:00
fix: update nomic model provider token calculation (#8705)
This commit is contained in:
parent
4638f99aaa
commit
64baedb484
@ -39,3 +39,4 @@
|
|||||||
- zhinao
|
- zhinao
|
||||||
- fireworks
|
- fireworks
|
||||||
- mixedbread
|
- mixedbread
|
||||||
|
- nomic
|
||||||
|
@ -77,15 +77,7 @@ class NomicTextEmbeddingModel(_CommonNomic, TextEmbeddingModel):
|
|||||||
:param texts: texts to embed
|
:param texts: texts to embed
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
if len(texts) == 0:
|
return sum(self._get_num_tokens_by_gpt2(text) for text in texts)
|
||||||
return 0
|
|
||||||
|
|
||||||
_, prompt_tokens, _ = self.embed_text(
|
|
||||||
model=model,
|
|
||||||
credentials=credentials,
|
|
||||||
texts=texts,
|
|
||||||
)
|
|
||||||
return prompt_tokens
|
|
||||||
|
|
||||||
def validate_credentials(self, model: str, credentials: dict) -> None:
|
def validate_credentials(self, model: str, credentials: dict) -> None:
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user