ó
    °"³jÅ  ã                  ó„  • S SK Jr  S SKJr  S SKJr  S SKJrJ	r	  SSK
JrJr  SSKJr  SSKJrJrJr  \" S	5      rS
r\	SSS.         SS jj5       r\	SSS.         SS jj5       rSSSS.           SS jjr\	SS.       SS jj5       r\	SS.       SS jj5       rSSSS.         SS jjrg)é    )Úannotations)Údatetime)Úversion)ÚAnyÚoverloadé   )Údata_snapshotÚtypes)ÚUsage)ÚUpdatePricesÚwait_prices_updated_asyncÚwait_prices_updated_syncÚgenai_prices)r   Ú
calc_pricer   r   r   Ú__version__N)Úprovider_idÚgenai_request_timestampc               ó   • g ©N© )ÚusageÚ	model_refr   r   s       ÚR/home/mande/repo/quber/.venv/lib/python3.13/site-packages/genai_prices/__init__.pyr   r      ó   € ð !ó    )Úprovider_api_urlr   c               ó   • g r   r   )r   r   r   r   s       r   r   r      r   r   )r   r   r   c               óN   • [         R                  " 5       R                  XX#U5      $ )a¨  Calculate the price of an LLM API call.

Either `provider_id` or `provider_api_url` should be provided, but not both. If neither are provided,
we try to find the most suitable provider based on the model reference.

Args:
    usage: The usage to calculate the price for.
    model_ref: A reference to the model used, this method will try to match this to a specific model.
    provider_id: The ID of the provider to calculate the price for.
    provider_api_url: The API URL of the provider to calculate the price for.
    genai_request_timestamp: The timestamp of the request to the GenAI service, use `None` to use the current time.

Returns:
    The price calculation details.
)r	   Úget_snapshotÚcalc)r   r   r   r   r   s        r   r   r   #   s#   € ô. ×%Ò%Ó'×,Ñ,¨U¸{Ð^uÓvÐvr   Údefault)Ú
api_flavorc               ó   • g r   r   )Úresponse_datar   r"   s      r   Úextract_usager%   =   ó   € ð r   c               ó   • g r   r   )r$   r   r"   s      r   r%   r%   C   r&   r   )r   r   r"   c               óL   • [         R                  " 5       R                  XX#5      $ )a+  Extract usage information from a response.

One of `provider_id` or `provider_api_url` is required.

Args:
    response_data: The response data to extract usage information from.
    provider: The provider to extract usage information for.
    provider_id: The ID of the provider to extract usage information for.
    provider_api_url: The API URL of the provider to extract usage information for.
    api_flavor: The API flavor of the provider to extract usage information for.

Returns:
    The extracted usage information, model ref and provider used.
)r	   r   r%   )r$   r   r   r"   s       r   r%   r%   I   s!   € ô* ×%Ò%Ó'×5Ñ5°mÐRbÓoÐor   )
r   útypes.AbstractUsager   Ústrr   útypes.ProviderID | str | Noner   údatetime | NoneÚreturnútypes.PriceCalculation)
r   r)   r   r*   r   ú
str | Noner   r,   r-   r.   )r   r)   r   r*   r   r+   r   r/   r   r,   r-   r.   )r$   r   r   ztypes.ProviderID | strr"   r*   r-   útypes.ExtractedUsage)r$   r   r   r*   r"   r*   r-   r0   )
r$   r   r   r+   r   r/   r"   r*   r-   r0   )Ú
__future__r   Ú_annotationsr   Úimportlib.metadatar   Ú_metadata_versionÚtypingr   r   Ú r	   r
   r   Úupdate_pricesr   r   r   r   Ú__all__r   r%   r   r   r   Ú<module>r9      sÃ  ðÝ 2å Ý ;ß  ç "Ý ß \Ñ \á Ó/€Ø
w€ð 
ð
 26Ø/3ñ!Øð!àð!ð /ð	!ð
 -ð!ð ô!ó 
ð!ð 
ð
 $(Ø/3ñ!Øð!àð!ð !ð	!ð
 -ð!ð ô!ó 
ð!ð 26Ø#'Ø/3ñwØðwàðwð /ð	wð
 !ðwð -ðwð õwð4 
àR[ñØðØ(>ðØLOðàôó 
ðð
 
àDMñØðØ-0ðØ>Aðàôó 
ðð 26Ø#'ØñpØðpð /ðpð !ð	pð
 ðpð öpr   