o
    ưiU	                     @   s   d Z ddlmZmZmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZmZ e Zejdd	geeged
eeefdedededefddZejdd	geeged
eeefdedededefddZdS )z
COMPLIANCE CHECK ENDPOINTS

Endpoints for checking regulatory compliance of LLM request logs.

/compliance/eu-ai-act - Check EU AI Act compliance
/compliance/gdpr      - Check GDPR compliance
    )	APIRouterDependsRequest)UserAPIKeyAuth)user_api_key_auth)ComplianceChecker)management_endpoint_wrapper)ComplianceCheckRequestComplianceResponsez/compliance/eu-ai-actZ
compliance)tagsdependenciesZresponse_modeldatahttp_requestuser_api_key_dictreturnc                    .   t | }| }ttdd |D d|dS )a  
    Check EU AI Act compliance for a spend log entry.

    Checks:
    - Art. 9: Guardrails applied (any guardrail)
    - Art. 5: Content screened before LLM (pre-call guardrails)
    - Art. 12: Audit record complete (user_id, model, timestamp, guardrail_results)
    c                 s       | ]}|j V  qd S NZpassed.0c r   n/home/app/Keep/.python/lib/python3.10/site-packages/litellm/proxy/management_endpoints/compliance_endpoints.py	<genexpr>/       z-check_eu_ai_act_compliance.<locals>.<genexpr>z	EU AI ActZ	compliantZ
regulationchecks)r   Zcheck_eu_ai_actr
   allr   r   r   checkerr   r   r   r   check_eu_ai_act_compliance      r!   z/compliance/gdprc                    r   )a  
    Check GDPR compliance for a spend log entry.

    Checks:
    - Art. 32: Data protection applied (pre-call guardrails)
    - Art. 5(1)(c): Sensitive data protected (masked/blocked or no issues)
    - Art. 30: Audit record complete (user_id, model, timestamp, guardrail_results)
    c                 s   r   r   r   r   r   r   r   r   L   r   z(check_gdpr_compliance.<locals>.<genexpr>ZGDPRr   )r   Z
check_gdprr
   r   r   r   r   r   check_gdpr_compliance5   r"   r#   N)__doc__Zfastapir   r   r   Zlitellm.proxy._typesr   Z$litellm.proxy.auth.user_api_key_authr   Zlitellm.proxy.compliance_checksr   Z&litellm.proxy.management_helpers.utilsr   Z(litellm.types.proxy.compliance_endpointsr	   r
   Zrouterpostr!   r#   r   r   r   r   <module>   sT    	