Python class
EmbeddingsContext
EmbeddingsContextโ
class max.interfaces.EmbeddingsContext(*args, **kwargs)
Bases: BaseContext, Protocol
Protocol defining the interface for embeddings generation contexts.
An EmbeddingsContext represents model inputs for embeddings generation pipelines,
managing the state and parameters needed for generating embeddings from input text.
Unlike text generation contexts, this focuses on single-step embedding generation
without iterative token generation concerns.
This protocol includes only the fields necessary for embeddings generation, excluding text generation specific features like:
- End-of-sequence token handling (eos_token_ids)
- Grammar matchers for structured output (matcher)
- JSON schema constraints (json_schema)
- Log probability tracking (log_probabilities)
- Token generation iteration state
model_nameโ
property model_name: str
The name of the embeddings model to use.
-
Returns:
-
A string identifying the specific embeddings model for this request.
tokensโ
property tokens: TokenBuffer
The input tokens to be embedded.
-
Returns:
-
A NumPy array of token IDs representing the input text to generate embeddings for.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!