haive.core.models.metadata ========================== .. py:module:: haive.core.models.metadata .. autoapi-nested-parse:: Model metadata utilities for LLM configurations. This module provides utilities for downloading, caching, and accessing model metadata from LiteLLM's model_prices_and_context_window.json. Classes ------- .. autoapisummary:: haive.core.models.metadata.ModelMetadata Functions --------- .. autoapisummary:: haive.core.models.metadata.get_model_metadata Module Contents --------------- .. py:class:: ModelMetadata A class to store and provide model metadata. This class encapsulates metadata about a language model, including its pricing, context window limits, and provider information. .. py:property:: context_window :type: int Get the context window size for this model. .. py:property:: pricing :type: dict[str, float] Get the pricing information for this model. .. py:function:: get_model_metadata(model_name, provider = None, force_refresh = False) Get metadata for a specific model with improved matching. This function tries to find the most relevant model metadata based on the model name and provider, with multiple fallback strategies. :param model_name: Name of the model (e.g., "gpt-4", "claude-3-opus") :param provider: Optional provider prefix (e.g., "azure", "anthropic") :param force_refresh: Force download fresh metadata :returns: Model metadata dictionary or empty dict if not found