CoolFace
Apppublic

abdulnim/GRC_framework

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
0likes
utils.cpython-310.pyc16 linesDownload Raw Back to __pycache__
1o

2�!�eU>�3@sHgd�gd�gd�gd�gd�gd�gd�gd�gd�d	�	Zd4Zdedefd
d�Zidd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�d#d$�d%d&�d'd(�d)d*�d+d,�d-d.�d/d0�id1d2�d3d4�d5d6�d7d8�d9d:�d;d<�d=d>�d?d@�dAdB�dCdD�dEdF�dGdH�dIdJ�dKdL�dMdN�dOdP�dQdR��dSdTdUdVd��ZiddWdXdYdZ��dd[dXd\d]��dd^dXd_d`da��ddbdcdd��ddbdcde��ddbdfdg��ddhdidjdk��ddldmdndodp��ddqdrdldsdt��d#dudvdldwdx��d!dydsdldzdld{��d%dmd|dldld}��d'd~dd�d���d)d�d�d�d���d+dld~d�d���d-d�dsd�d���d1d�dld�d���id3d�dldld���d5d�dcdcd���d7dldcdcd���d9d�dcdcd���d;d�d�dld���d=d�d�dld���d?d�d�d�d���dAdld�d�d���dCd�dldcd���dEd�dld�d���dGd�dld�d���dIdldcdld���dKdwd�dld���dMdcd�dsd���dOdwdcdcd���dQdld�d�d���d�d�dwdld����d�dwdld��d�dcdld��d�dld�d��d���Zd�S)�)�sentiment_analysis�emotion_detection�political_bias_detection�stress_level_detection�empathy_level_assessment�mood_detection�toxicity_detection)�Consent_and_Transparency�
Data_Security�Privacy_Assessment�Environmental_Impact)�Content_Moderation�Reporting_Mechanism�Content_Guidelines�User_Education)�Privacy_Policy�Data_Retention�Consent_Mechanism)�5Ethical_AI�Bais_MitigationZFairness_Assestment�Explainability)ZModel_development�Data_QualityrZ+Fairness_AssestmentExplainabilityUser_Input)�Corporate_Ethics�Board_Management�Stakeholder_Engagement)�System_Reliability�Quality_Assurance�Stress_Testing�Fail_Safe_Procedures)�Renewable_Resources�Waste_Reduction�Energy_Efficiency�Sustainable_Practices)	zAI AuditZGDPRZToxicityZLegal�ContextZ6GovernanceZRiskManagementZ7RobustnessZSustainabilityz�You are a data analysis assistant capable of {analysis_type} analysis. {specific_instruction} Respond with your analysis in JSON format. The JSON schema should include '{json_schema}'.�
analysis_type�returncCsHt�|d�}t�|i�}d�dd�|��D��}d|�d|�d|�d�S)	Nz/Perform the analysis as per the specified type.z, cSs g|]\}}d|�d|���qS)�'z': �)�.0�key�valuer&r&�B/home/abdul/01MachineLearning/Freelance/sri/GRC_framework/utils.py�8<listcomp>Is z%get_system_prompt.<locals>.<listcomp>z&You are a data analyst API capable of z analysis. z� Please respond with your analysis directly in JSON format (without using Markdown code blocks or any other formatting). Always include confidence_score:number (0-1) with two decimals for result based on analysisThe JSON schema should include: {z}.)�ANALYSIS_TYPES�get�JSON_SCHEMAS�join�items)r#Zspecific_instruction�json_schemaZjson_schema_strr&r&r*�get_system_promptFs��r2rz�Analyze the sentiment of the provided text. Determine whether the sentiment is positive, negative, or neutral and provide a confidence score.rz�Detect and identify the primary emotions expressed in the provided text. Provide a score for the intensity of the detected emotion.rzmDetect any political bias in the provided text, identifying leaning towards particular ideologies or parties.rzWAnalyze the text to assess stress levels, identifying triggers and intensity of stress.rzcAssess the level of empathy expressed in the text, identifying empathetic responses and tendencies.rzbDetect the mood of the individual based on textual cues, ranging from happy to sad, calm to angry.rz�Identify and assess the level of toxicity in the provided text. Determine whether the text contains harmful, offensive, or inappropriate content and provide a score indicating the severity of the toxicityrzfEvaluate how consent is obtained and the level of transparency provided to users regarding data usage.r	zqAssess the measures in place for data security, including vulnerabilities and compliance with security standards.r9zsAnalyze the overall privacy practices, including policy compliance, data minimization, and user data accessibility.rzoAssess the environmental impact of data processing practices, including carbon footprint and energy efficiency.rzmEvaluate the effectiveness of content moderation practices, including automated and human moderation efforts.r
z_Assess the ease and effectiveness of reporting mechanisms for inappropriate or harmful content.rzbAnalyze the clarity and comprehensiveness of content guidelines and their enforcement consistency.rzzEvaluate the availability and accessibility of educational resources for users regarding appropriate content and behavior.rzLAnalyze the clarity and compliance of a privacy policy with legal standards.rzbEvaluate the data retention practices, including periods, deletion policies, and legal compliance.rzeAssess the clarity and effectiveness of the consent mechanism in place for data collection and usage.ZGDPR_CompliancezoEvaluate the level of GDPR compliance in data handling, protection measures, and breach notification protocols.rzqAssess adherence to ethical standards in AI practices, including identification and mitigation of ethical issues.ZBias_MitigationzCEvaluate the presence and mitigation of bias in data or algorithms.ZFairness_AssessmentziAssess fairness in AI systems, identifying affected groups and providing recommendations for improvement.rzCEvaluate the transparency and explainability of AI models to users.ZModel_Developmentz`Analyze the process of model development, including team composition and ethical considerations.rzTAssess the quality of data used, focusing on accuracy, completeness, and timeliness.Z10User_InputzFEvaluate the mechanisms for and impact of user feedback on the system.rziAssess the ethical practices within a corporation, including employee training and ethics code adherence.rzgEvaluate the effectiveness and diversity of board management and its compliance with ethical standards.rzeAnalyze stakeholder engagement practices, including inclusion, feedback mechanisms, and satisfaction.ZRisk_ManagementzVAssess the identification, mitigation, and monitoring of risks within an organization.rz^Evaluate the reliability and resilience of a system, including uptime and redundancy measures.rzbAssess the quality assurance practices, including compliance with standards and testing frequency.rzOAnalyze the system's robustness through stress testing and identify weaknesses.rzPEvaluate the effectiveness of fail-safe procedures in place for system failures.zMAssess the use of renewable resources and sustainability goals in operations.zPEvaluate waste management practices, reduction rates, and recycling initiatives.zWAnalyze energy consumption and efficiency, including energy-saving measures and audits.zVEvaluate the adoption of sustainable practices, including training and overall impact.z$string (positive, negative, neutral)znumber (0-1)zCarray of strings (specific text portions contributing to sentiment))Z	sentiment�confidence_scoreZ
text_snippetsz!string (primary emotion detected)z6array of objects (secondary emotions and their scores))Zemotionr3Zsecondary_emotionszstring (left, right, neutral)z+array of strings (elements indicating bias)z-number (quantifying degree of political bias))�biasr3Zbias_indicatorsZpolitical_alignment_score�stringzarray of strings)Zstress_levelZstress_triggers)Z
empathy_levelZempathetic_responses�number)ZmoodZmood_intensityz string (none, low, medium, high)zEarray of strings (specific words or phrases contributing to toxicity)zUarray of objects (additional contextual elements influencing toxicity interpretation))Ztoxicity_levelZtoxicity_flagsZcontextual_factors�booleanzstring (low, medium, high)z?array of strings (information not clearly presented or missing)zstring (poor, average, good))Zconsent_obtainedZtransparency_levelZmissing_informationZuser_understandingz"string (secure, at risk, breached)z<array of strings (specific areas of potential vulnerability)z6string (compliant, partially compliant, non-compliant))Zsecurity_statusZvulnerability_pointsZdata_encryptionZcompliance_statusz&number (metric tons of CO2 equivalent)zstring (low, moderate, high)znumber (0-100))Zcarbon_footprintZenergy_efficiencyZsustainable_practicesZenvironmental_impact_scorezstring (positive, negative)zstring (none, limited, full))Zoverall_privacy_statusZprivacy_policy_complianceZdata_minimizationZuser_data_accessibilityZ
anonymizationz3array of strings (types of content being moderated))Zmoderation_effectivenessZmoderated_content_typesZautomated_moderationZhuman_moderationz"string (easy, moderate, difficult)zstring (fast, average, slow)z string (detailed, minimal, none))Zreporting_easeZ
response_timeZreport_feedbackz'string (clear, somewhat clear, unclear)z(string (comprehensive, partial, lacking)z!string (consistent, inconsistent))�clarityZcomprehensivenessZenforcement_consistencyzstring (high, medium, low))Zeducational_resources_availableZresource_accessibilityZuser_comprehension_levelz6array of strings (specific rights mentioned in policy))r8Z11complianceZuser_rightsz(string (opt-in, opt-out, not applicable))Zmechanism_clarityZuser_controlZ12opt_in_outz<string (fully compliant, partially compliant, non-compliant))Zcompliance_levelZdata_protection_officerZbreach_notification)Zethical_standards_adherenceZethical_issues_identifiedZmitigation_measures)Zbias_identifiedZ13bias_typesZmitigation_strategies)Zfairness_levelZaffected_groupsZimprovement_recommendationszstring (transparent, opaque))Zmodel_transparencyZexplanation_comprehensibilityZuser_friendly_explanationsz&string (structured, ad-hoc, undefined)z!array of strings (roles involved))Zdevelopment_processZteam_compositionZethics_considerationsz&string (complete, partial, incomplete)zstring (up-to-date, outdated))Zaccuracy_levelZcompletenessZ14timelinessz8string (responsive, moderately responsive, unresponsive))Zuser_feedback_mechanismZfeedback_responsivenessZuser_input_impactzstring (exists, partial, none))Zethics_codeZemployee_trainingZethics_violationsz(string (effective, average, ineffective)z!string (compliant, non-compliant))Zboard_structureZboard_diversityZboard_ethics_compliancez2string (inclusive, partially inclusive, exclusive))Zstakeholder_inclusionZfeedback_mechanismZstakeholder_satisfaction)Zrisk_identificationZrisk_mitigation_strategiesZrisk_monitoring)Zuptime_percentageZsystem_resilienceZredundancy_measuresz#string (frequent, occasional, rare))Zquality_standardsZtesting_frequencyZquality_assurance_compliance)Zstress_test_pass_rateZidentified_weaknessesZimprovement_actionsz#string (regular, occasional, never)z4string (effective, partially effective, ineffective))Zprocedures_definedZexecution_frequencyZ
effectivenessrzstring (high, moderate, low))Zresource_usageZrenewable_resource_percentageZsustainability_goalsz!string (effective, average, poor))Zwaste_management_practicesZreduction_rateZrecycling_initiatives)Zenergy_consumptionZenergy_saving_measuresZenergy_auditz"string (widespread, partial, none))Zpractice_adoptionZsustainability_trainingZsustainability_impact)rr r!N)�ai_audit_analysis_categoriesZSTANDARD_PROMPT_TEMPLATE�strr2r,r.r&r&r&r*�<module>s�15�>�������16���
�������������"�#�$�'�(�)�*�-�.�/�0�3�:��������������%��+��1��7��@��F��K��P��W��\��a��h��m��r��w��~�����	���������������&���+���0���5���<���B�����