Skip to main content

get_dimensions

Function
This function is defined in the dimensions module.
Get embedding dimensions based on model name. This function checks if the model name contains any known model identifiers and returns the corresponding dimension. Falls back to the default dimension (1536) for unknown models.

Signature

def get_dimensions(model_name: str) -> int

Parameters

model_name
str
required
The embedding model name (e.g., “text-embedding-3-small”)

Returns

Returns
int
The embedding dimension for the model

Usage

>>> get_dimensions("text-embedding-3-small")
    1536
    >>> get_dimensions("openai/text-embedding-3-large")
    3072
    >>> get_dimensions("unknown-model")
    1536