
    gr	                     J    d Z ddlmZ ddlmZ ddlmZ dededeeef   fdZ	y	)
zb
Helper util for handling databricks-specific cost calculation
- e.g.: handling 'dbrx-instruct-*'
    )Tuple)Usage)get_model_infomodelusagereturnc                    | }| j                  d      s| j                  d      rd}n| j                  d      s| j                  d      rd}n| j                  d      s| j                  d      rd	}n| j                  d
      s| j                  d      rd}n| j                  d
      s| j                  d      rd}nn| j                  d      s| j                  d      rd}nI| j                  d      s| j                  d      rd}n$| j                  d      s| j                  d      rd}t        |d      }|d   |d   z  }|d   |d   z  }||fS )aO  
    Calculates the cost per token for a given model, prompt tokens, and completion tokens.

    Input:
        - model: str, the model name without provider prefix
        - usage: LiteLLM Usage block, containing anthropic caching information

    Returns:
        Tuple[float, float] - prompt_cost_in_usd, completion_cost_in_usd
    zdatabricks/dbrx-instructzdbrx-instructzdatabricks-dbrx-instructz&databricks/meta-llama-3.1-70b-instructzmeta-llama-3.1-70b-instructz&databricks-meta-llama-3-1-70b-instructz'databricks/meta-llama-3.1-405b-instructzmeta-llama-3.1-405b-instructz'databricks-meta-llama-3-1-405b-instructz%databricks/mixtral-8x7b-instruct-v0.1zmixtral-8x7b-instruct-v0.1z databricks-mixtral-8x7b-instructzdatabricks/bge-large-enzbge-large-enzdatabricks-bge-large-enzdatabricks/gte-large-enzgte-large-enzdatabricks-gte-large-enzdatabricks/llama-2-70b-chatzllama-2-70b-chatzdatabricks-llama-2-70b-chat
databricks)r   custom_llm_providerprompt_tokensinput_cost_per_tokencompletion_tokensoutput_cost_per_token)
startswithr   )r   r   
base_model
model_infoprompt_costcompletion_costs         \/var/www/openai/venv/lib/python3.12/site-packages/litellm/llms/databricks/cost_calculator.pycost_per_tokenr      s    J23u7G7G8 0
			B	CuGWGW%H >
			1
			8	9>
			A	BeFVFV$G 8
			A	BeFVFV$G 8
			3	48H8H9 /
			3	48H8H9 /
			7	8E<L<L= 3
jlSJ /*=S2TTK /0:>U3VVO''    N)
__doc__typingr   litellm.types.utilsr   litellm.utilsr   strfloatr    r   r   <module>r      s8   
  % (6(# 6(e 6(eUl0C 6(r   