get_dimensions (embedding/dimensions.py)

PraisonAI · src/praisonai-agents/praisonaiagents/embedding/dimensions.py · python · MIT
ai

Utility to determine embedding vector dimensions from model names.

# Source: https://github.com/MervinPraison/PraisonAI | License: MIT
# Provided via justclaw.it.com; keep this notice with the code.
"""
Embedding dimension utilities.

This module provides utilities for determining embedding dimensions
based on model names. Consolidates the dimension lookup logic that
was previously duplicated in memory.py and knowledge.py.
"""

from typing import Dict

# Common embedding model dimensions
# This is the single source of truth for dimension lookup
MODEL_DIMENSIONS: Dict[str, int] = {
    "text-embedding-3-small": 1536,
    "text-embedding-3-large": 3072,
    "text-embedding-ada-002": 1536,
    "text-embedding-002": 1536,
    # Cohere models
    "embed-english-v3.0": 1024,
    "embed-multilingual-v3.0": 1024,
    "embed-english-light-v3.0": 384,
    "embed-mu

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key