Ë
    tPêjà  ã                   óú   — U d Z ddlmZmZ ddlmZ ddlmZ dZee	d<   dZ
ee	d<   d	ed
z  deeef   d
z  ded
z  fd„Zdeeef   ded
z  fd„Zdeeef   d
z  ded
z  fd„Zdeded
z  fd„Zdeeef   ded
z  fd„Zy
)a  Save-time validation of team/key logging configs the runtime cannot honor.

Team callbacks arrive as a single ``AddTeamCallback``, key callbacks arrive as a
``logging`` list inside the key metadata, so both shapes funnel into the same
per-integration checks here.
é    )ÚMappingÚSequence)ÚMappingProxyType)ÚFinalÚnewrelicÚ_NEWRELIC_CALLBACKÚ	newrelic_Ú_NEWRELIC_VAR_PREFIXÚcallback_nameNÚcallback_varsÚreturnc                 óP   — |sy t        |«      }|�|S | t        k7  ry t        |«      S ©N)Ú_langfuse_environment_errorr   Ú_newrelic_config_error)r   r   Ú	env_errors      úz/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/litellm/proxy/common_utils/callback_config_validation.pyÚcallback_config_errorr      s5   € ÙØÜ2°=ÓA€IØÐØÐØÔ*Ò*ØÜ! -Ó0Ð0ó    c                 óŒ   — | j                  d«      }|€yddlm} 	  ||«       y# t        $ r}t	        |«      cY d}~S d}~ww xY w)zÐReject langfuse_environment values Langfuse ingestion would drop.

    Accepting an invalid value here would 200 the config write and then
    silently lose every trace for that key/team at request time.
    Úlangfuse_environmentNr   )Ú#validate_langfuse_environment_value)ÚgetÚ=litellm.litellm_core_utils.initialize_dynamic_callback_paramsr   Ú
ValueErrorÚstr)r   Úvaluer   Úes       r   r   r      sO   € ð !×$Ñ$Ð%;Ó<€EØ€}ØõðÙ+¨EÔ2ð øô ò Ü�1‹v�ûðús   œ% ¥	A®
>¸A¾AÚmetadatac                 ó¬   — | sy| j                  d«      }t        |t        «      rt        |t        t        f«      ryt        d„ d„ |D «       D «       d«      S )z@Validate every ``logging`` entry of a team/key metadata payload.NÚloggingc              3   ó&   K  — | ]	  }|€Œ|–— Œ y ­wr   © )Ú.0Úerrors     r   ú	<genexpr>z0logging_metadata_config_error.<locals>.<genexpr>7   s   è ø€ Òd�5ÐRWÑRcŒÑdùs   ‚Šc              3   ó2   K  — | ]  }t        |«      –— Œ y ­wr   )Ú_logging_entry_error)r$   Úentrys     r   r&   z0logging_metadata_config_error.<locals>.<genexpr>7   s   è ø€ ÒN¸UÔ1°%×8ÑNùs   ‚)r   Ú
isinstancer   r   ÚbytesÚnext)r   Úentriess     r   Úlogging_metadata_config_errorr.   /   sN   € áØØ—\‘\ )Ó,€GÜ�gœxÔ(¬J°wÄÄeÀÔ,MØÜÙdÑNÀgÔNÔdØóð r   r)   c                 óH  — t        | t        «      sy | j                  d«      }| j                  d«      }t        |t        «      rt        |t        «      sy t	        |t        |j                  «       D ��ci c]  \  }}t        |«      t        |«      “Œ c}}«      «      S c c}}w )Nr   r   )r*   r   r   r   r   r   Úitems)r)   r   r   Úkeyr   s        r   r(   r(   <   s�   € Ü�eœWÔ%ØØ Ÿ9™9 _Ó5€MØ Ÿ9™9 _Ó5€MÜ�m¤SÔ)´¸MÌ7Ô1SØÜ ØÜÀ×ATÑATÓAV×W±:°3¸œ#˜c›(¤C¨£JÑ.ÓWÓXóð ùãWs   Á3Bc                 ó  — t        d„ | D «       «      syddlm} ddlm}  |«       sy| j                  d«      }|�3|j                  «       |vr!d|›d	d
j                  t        |«      «      › d�S | j                  d«      }|�|r|dk(  ryy)ax  Per-team New Relic routing runs on the OTel v2 path only.

    Accepting the config with the flag off would silently ship the team's traffic
    through the operator's env-configured agent instead of the team's account. A
    region outside the fixed table, or a region without a key, would likewise be
    accepted and then silently ignored or misrouted at request time.
    c              3   óF   K  — | ]  }|j                  t        «      –— Œ y ­wr   )Ú
startswithr
   )r$   r1   s     r   r&   z)_newrelic_config_error.<locals>.<genexpr>Q   s   è ø€ ÒM¸ˆs�~‰~Ô2×3ÑMùs   ‚!Nr   )Úis_otel_v2_enabled)Ú NEWRELIC_OTLP_ENDPOINT_BY_REGIONzOPer-team New Relic routing requires the proxy to run with LITELLM_OTEL_V2=true.Únewrelic_regionzUnknown newrelic_region z. Supported regions: z, ú.Únewrelic_api_keyÚNonezOnewrelic_region requires newrelic_api_key; the region rides the team's own key.)	ÚanyÚ&litellm.integrations.otel.model.configr5   Ú*litellm.integrations.otel.presets.newrelicr6   r   ÚlowerÚjoinÚsorted)r   r5   r6   ÚregionÚapi_keys        r   r   r   I   s    € ô ÑM¸}ÔMÔMØåIÝ[áÔØ`à!×%Ñ%Ð&7Ó8€FØÐ˜fŸl™l›nÐ4TÑTà& v jð 1"Ø"&§)¡)¬FÐ3SÓ,TÓ"UÐ!VÐVWðYð	
ð #×&Ñ&Ð'9Ó:€GØÐ¡7¨g¸Ò.?Ø`Ør   )Ú__doc__Úcollections.abcr   r   Útypesr   Útypingr   r   Ú__annotations__r
   r   r   r   Úobjectr.   r(   r   r#   r   r   ú<module>rI      sÝ   ðò÷ .Ý "Ý à&Ð �EÓ &Ø)Ð �eÓ )ð1¨¨t©ð 1ÀGÈCÐQTÈHÑDUÐX\ÑD\ð 1ÐadÐgkÑakó 1ð¨w°s¸C°xÑ/@ð ÀSÈ4ÁZó ð(
¨G°C¸°KÑ,@À4Ñ,Gð 
ÈCÐRVÉJó 
ð
 ð 
¨3°©:ó 
ð¨'°#°s°(Ñ*;ð ÀÀdÁ
ô r   