#how are tokens calculated when generating embeddings

1 messages · Page 1 of 1 (latest)

obsidian prawn
#

how are tokens calculated when generating embeddings

neat jasperBOT
#

Hi @obsidian prawn. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Nomic’s embedding APIs return a usage object with token counts so you can see how many input tokens were processed:

How many tokens are counted depends on your request settings:

  • long_text_mode:
    • truncate: text is cut at the model’s maximum input size. [Embed Text]
    • mean: text can be chunked and averaged; max_tokens_per_text defaults to 8192 per text. [Embed Text]
  • max_tokens_per_text: caps tokens per text (8192 default with mean; otherwise the model’s max input size with truncate). [Embed Text]

Examples in the Python SDK show these usage fields in the response, but the docs do not specify the exact tokenizer used to compute token counts. [Python API]

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: