Sfoglia il codice sorgente

fix: update nomic model provider token calculation (#8705)

tags/0.9.0
ice yao 1 anno fa
parent
commit
64baedb484
Nessun account collegato all'indirizzo email del committer

+ 1
- 0
api/core/model_runtime/model_providers/_position.yaml Vedi File

@@ -39,3 +39,4 @@
- zhinao
- fireworks
- mixedbread
- nomic

+ 1
- 9
api/core/model_runtime/model_providers/nomic/text_embedding/text_embedding.py Vedi File

@@ -77,15 +77,7 @@ class NomicTextEmbeddingModel(_CommonNomic, TextEmbeddingModel):
:param texts: texts to embed
:return:
"""
if len(texts) == 0:
return 0

_, prompt_tokens, _ = self.embed_text(
model=model,
credentials=credentials,
texts=texts,
)
return prompt_tokens
return sum(self._get_num_tokens_by_gpt2(text) for text in texts)

def validate_credentials(self, model: str, credentials: dict) -> None:
"""

Loading…
Annulla
Salva