ó
    üÞ j$  ã                  óN   • S r SSKJr  SSKJr  SSKJrJrJr   S     SS jjr	g)	uÊ  Shared token-usage mapping.

``_create_usage_metadata`` normalizes an OpenAI-shaped token ``usage`` dict into
LangSmith's canonical :class:`~langsmith.schemas.UsageMetadata`. It lives here â€”
not in ``langsmith.wrappers._openai`` â€” so integrations can reuse it without
importing the ``wrappers`` package (whose ``__init__`` eagerly imports a
deprecated tombstone that warns at import time). ``wrappers._openai`` re-exports
it for backwards compatibility.
é    )Úannotations)ÚOptional)ÚInputTokenDetailsÚOutputTokenDetailsÚUsageMetadataNc                óÖ  • US;   a  UOS nU(       a  U S3OSnU R                  S5      =(       d    U R                  S5      =(       d    SnU R                  S5      =(       d    U R                  S5      =(       d    SnU R                  S	5      =(       d    XE-   nS
U R                  S5      =(       d    U R                  S5      =(       d    0 R                  S5      U S3U R                  S5      =(       d    U R                  S5      =(       d    0 R                  S5      0nS
U R                  S5      =(       d    U R                  S5      =(       d    0 R                  S5      U S3U R                  S5      =(       d    U R                  S5      =(       d    0 R                  S5      0nU(       aD  UUR                  U S35      =(       d    S-
  Xr'   UUR                  U S35      =(       d    S-
  X‚'   [        UUU[        S0 UR                  5        V	V
s0 sH  u  pšU
c  M
  Xš_M     sn
n	D6[	        S0 UR                  5        V	V
s0 sH  u  pšU
c  M
  Xš_M     sn
n	D6S9$ s  sn
n	f s  sn
n	f )N)ÚpriorityÚflexÚ_Ú Úprompt_tokensÚinput_tokensr   Úcompletion_tokensÚoutput_tokensÚtotal_tokensÚaudioÚprompt_tokens_detailsÚinput_tokens_detailsÚaudio_tokensÚ
cache_readÚcached_tokensÚcompletion_tokens_detailsÚoutput_tokens_detailsÚ	reasoningÚreasoning_tokens)r   r   r   Úinput_token_detailsÚoutput_token_details© )Úgetr   r   Úitemsr   )Úoai_token_usageÚservice_tierÚrecognized_service_tierÚservice_tier_prefixr   r   r   r   r   ÚkÚvs              ÚT/var/www/html/gaurav/venv/lib/python3.13/site-packages/langsmith/_internal/_usage.pyÚ_create_usage_metadatar(      s�  € ð %Ð(<Ó<‰À$ð ö *AÐ"Ð
# 1Ñ%Àbð ð
 	×Ñ˜OÓ,×X°×0CÑ0CÀNÓ0S×XÐWXð ð 	×ÑÐ/Ó0÷ 	Ø×Ñ˜Ó/÷	àð ð
 #×&Ñ& ~Ó6×V¸,Ñ:V€LàØ×ÑÐ 7Ó8÷ Ø×"Ñ"Ð#9Ó:÷àß
‰#ˆnÓ
ØÐ
˜zÐ*Ø×ÑÐ 7Ó8÷ Ø×"Ñ"Ð#9Ó:÷àß
‰#ˆoÓ
ð!Ðð 	Ø×ÑÐ ;Ó<÷ Ø×"Ñ"Ð#:Ó;÷àß
‰#ˆnÓ
ØÐ
˜yÐ)Ø×ÑÐ ;Ó<÷ Ø×"Ñ"Ð#:Ó;÷àß
‰#Ð Ó
!ð"Ðö ð 8DØ×#Ñ#Ð':Ð&;¸:Ð$FÓG×LÈ1ñ8
ÐÑ4ð 9FØ ×$Ñ$Ð(;Ð'<¸IÐ%FÓG×LÈ1ñ9
ÐÑ5ô Ø!Ø#Ø!Ü-ñ 
Ø 3× 9Ñ 9Ô ;ÔMÑ ;™˜¸q‹tˆqŠtÑ ;ÒMñ
ô 0ñ 
Ø 4× :Ñ :Ô <ÔNÑ <™˜À‹tˆqŠtÑ <ÒNñ
ñ
ð 
ùó
 Nùó Os   ÈIÈ IÉI%ÉI%)N)r!   Údictr"   zOptional[str]Úreturnr   )
Ú__doc__Ú
__future__r   Útypingr   Úlangsmith.schemasr   r   r   r(   r   ó    r'   Ú<module>r0      s>   ðñõ #å ç RÑ Rð :>ðAØðAØ)6ðAàöAr/   