Ë
    uPêj‚  ã                   óº   — d dl mZmZmZ d dlmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ erd dlmZ d dlmZ eZeez  ZneZeZd	ed
edefd„Zd	edededz  fd„Zy)é    )ÚTYPE_CHECKINGÚAnyÚFinal)Úredact_secretsÚverbose_router_logger)ÚMAX_EXCEPTION_MESSAGE_LENGTH)Ú/_async_get_cooldown_deployments_with_debug_info)Ú	AlertType)ÚRouterRateLimitError)ÚSpan)ÚRouterÚlitellm_router_instanceÚrequest_kwargsÚerror_traceback_strc              ƒ   ó8  K  — | €yt        | d«      sy| j                  €yd|v ryt        |dd«      }t        |«      }|�||z  }|d|dt         › �z  }t        |«      }| j                  j                  d|› d�dt        j                  i ¬	«      ƒ d{  –—†  y7 Œ­w)
ac  
    Only runs if router.slack_alerting_logger is set
    Sends a Slack / MS Teams alert for the LLM API call failure. Only if router.slack_alerting_logger is set.

    Parameters:
        litellm_router_instance (_Router): The LitellmRouter instance.
        original_exception (Any): The original exception that occurred.

    Returns:
        None
    NÚslack_alerting_loggerÚproxy_server_requestÚlitellm_debug_infoz

zLLM API call failed: `ú`ÚHigh)ÚmessageÚlevelÚ
alert_typeÚalerting_metadata)	Úhasattrr   ÚgetattrÚstrr   r   Ú
send_alertr
   Úllm_exceptions)r   r   r   Úoriginal_exceptionr   Úexception_strs         úf/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/litellm/router_utils/handle_error.pyÚsend_llm_exception_alertr#      sÑ   è ø€ ð" Ð&ØäÐ*Ð,CÔDØà×4Ñ4Ð<Øà Ñ/ð 	ä 'Ð(:Ð<PÐRVÓ WÐÜÐ*Ó+€MØÐ%ØÐ+Ñ+ˆØ�tÐ/Ð0MÔ1MÐNÐOÐPÑP€Mô # =Ó1€Mà
!×
7Ñ
7×
BÑ
BØ(¨¨°qÐ9ØÜ×+Ñ+Øð	 Có ÷ ò ús   ‚BBÂBÂBÚmodelÚparent_otel_spanNc              ƒ   óX  K  — t        j                  d|«       | j                  |¬«      }| j                  j	                  ||¬«      }t        | |¬«      ƒ d{  –—† }t        j                  d||«       |xs g D �cg c]  }|d   ‘Œ	 }}t        ||| j                  |¬«      S 7 ŒJc c}w ­w)	zV
    Raises a RouterRateLimitError if no deployment is found for the given model.
    z?get_available_deployment for model: %s, No deployment available)Ú
model_name)Ú	model_idsr%   )r   r%   NzDNo deployment found for model: %s, cooldown_list with debug info: %sr   )r$   Úcooldown_timeÚenable_pre_call_checksÚcooldown_list)r   ÚinfoÚget_model_idsÚcooldown_cacheÚget_min_cooldownr	   r   r*   )r   r$   r%   r(   Ú_cooldown_timeÚ_cooldown_listÚcooldown_modelÚcooldown_list_idss           r"   Ú#async_raise_no_deployment_exceptionr4   G   sÍ   è ø€ ô ×ÑÐ`ÐbgÔhØ.×<Ñ<ÈÐ<ÓN€IØ3×BÑB×SÑSØÐ.>ð Tó €Nô #RØ 7Ø)ô#÷ €Nô ×ÑØNÐPUÐWeôð JXÒI]Ð[]Ö_°n ¨qÓ 1Ð_ÐÐ_ÜØØ$Ø6×MÑMØ'ô	ð ðúò  `ùs$   ‚AB*ÁB#Á#B*Á<B%ÂB*Â%B*)Útypingr   r   r   Úlitellm._loggingr   r   Úlitellm.constantsr   Ú&litellm.router_utils.cooldown_handlersr	   Ú)litellm.types.integrations.slack_alertingr
   Úlitellm.types.routerr   Úopentelemetry.tracer   Ú_SpanÚlitellm.routerr   Ú_RouterÚLitellmRouterÚdictr   r#   r4   © ó    r"   ú<module>rC      s‚   ðß ,Ñ ,ç BÝ :õõ @Ý 5áÝ1å0à€MØ�3‰;�Dà€MØ€Dð-Ø*ð-àð-ð ó-ð`Ø*ðØ36ðØJNÐQUÉ+ôrB   