def octoai_modelname_to_contextsize(modelname: str) -> int:
    """
    Calculate the maximum number of tokens possible to generate for a model.

    Args:
        modelname: The modelname we want to know the context size for.

    Returns:
        The maximum context size

    Examples:
        .. code-block:: python

            max_tokens = octoai.modelname_to_contextsize(TextModel.CODELLAMA_13B_INSTRUCT)
            max_tokens = octoai.modelname_to_contextsize("llama-2-13b-chat")

    """
    if modelname not in ALL_AVAILABLE_MODELS:
        print(
            "WARNING: Model not found in octoai.utils.py, returning a generous default value."
        )
        return 8192
    return ALL_AVAILABLE_MODELS[modelname]

    Calculate the maximum number of tokens possible to generate for a model.

    Args:
        modelname: The modelname we want to know the context size for.

    Returns:
        The maximum context size

    Examples:
        .. code-block:: python

            max_tokens = octoai.modelname_to_contextsize(TextModel.CODELLAMA_13B_INSTRUCT)
            max_tokens = octoai.modelname_to_contextsize("llama-2-13b-chat")

    
llama-index-integrations/llms/llama-index-llms-octoai/llama_index/llms/octoai/utils.py