o
    rlj                     @   s    d dl Z d dlmZ dd ZdS )    N)genaic              
   C   s   t d}|s	dS z tj|d}d|  d| d| d}|jjd|d	}|j W S  tyC } zt	d
|  W Y d }~dS d }~ww )NGEMINI_API_KEYzAI explanation unavailable.)api_keyz
You are an ad-tech Invalid Traffic (IVT) analysis assistant.

Explain the following IVT validation result in 1-2 short sentences.

Risk Score: z

Verdict: z
Contributing Features: z

Important:
- Do not change or recalculate the risk score.
- Do not change the verdict.
- Only explain why the traffic was classified this way.
- Keep the explanation simple and technical.
zgemini-2.5-flash)modelcontentszAI explanation error: )
osgetenvr   Clientmodelsgenerate_contenttextstrip	Exceptionprint)
risk_scoreverdictcontributing_featuresr   clientpromptresponsee r   explain/ai_explainer.pygenerate_explanation   s,   
r   )r   googler   r   r   r   r   r   <module>   s    