As AI models become increasingly integrated into everyday applications, ensuring their outputs are safe, inclusive, and aligned with ethical standards is essential. AI-generated content must avoid explicit harm while fostering trust, fairness, and cultural awareness to remain suitable for diverse audiences.Safety in AI extends beyond preventing offensive content, it encompasses bias mitigation, respect for societal norms, and adherence to ethical and legal standards. A well-moderated AI system enhances user confidence, minimising risks of discrimination, misinformation, or inappropriate language, while ensuring AI remains reliable, socially responsible, and widely accessible.To achieve this, the following evaluations systematically assess AI-generated content. These assessments create a structured framework to ensure that AI-driven communication is ethical, respectful, and suitable for all users:
Export your API key and Secret key into your environment variables.
Copy
from fi.evals import Evaluatorfrom fi.testcases import TestCasefrom fi.evals.templates import Toneevaluator = Evaluator( fi_api_key="your_api_key", fi_secret_key="your_secret_key", fi_base_url="https://api.futureagi.com")tone_eval = Tone()test_case = TestCase( input=''' Dear Sir, I hope this email finds you well. I look forward to any insights or advice you might have whenever you have a free moment''')result = evaluator.evaluate(eval_templates=[tone_eval], inputs=[test_case], model_name="turing_flash")tone_result = result.eval_results[0].metrics[0].value
Identifies content with gender bias or sexist language. Checks for use of stereotypes or discriminatory language or the content has imbalanced representation or assumptions based on gender.Click here to read the eval definition of Sexist
Input: The text content to check for sexist content
Output: Returns either “Passed” or “Failed”, where “Passed” indicates no sexist content detected, “Failed” indicates presence of gender bias or discriminatory language
Evaluates content for toxic, harmful, or aggressive language. Such as use of profanity, threats, or abusive language. Content that could harm user relationships or escalate conflicts.Click here to read the eval definition of Toxicity
Identifies biases in the output, including gender, racial, cultural, or ideological biases. An ideal AI generated response must be neutral language use without favouring or discriminating against any group.Click here to read the eval definition of Bias Detection
Input: The text content to analyse for cultural appropriateness
Output: Returns either “Passed” or “Failed”, where “Passed” indicates culturally appropriate content, “Failed” indicates potential cultural insensitivity
from fi.evals import Evaluatorfrom fi.testcases import TestCasefrom fi.evals.templates import CulturalSensitivityevaluator = Evaluator( fi_api_key="your_api_key", fi_secret_key="your_secret_key", fi_base_url="https://api.futureagi.com")cultural_eval = CulturalSensitivity()test_case = TestCase( input="This is a sample text to check for cultural sensitivity")result = evaluator.evaluate(eval_templates=[cultural_eval], inputs=[test_case], model_name="turing_flash")sensitivity_result = result.eval_results[0].metrics[0].value # Returns "Passed" or "Failed"
from fi.evals import Evaluatorfrom fi.testcases import TestCasefrom fi.evals.templates import SafeForWorkTextevaluator = Evaluator( fi_api_key="your_api_key", fi_secret_key="your_secret_key", fi_base_url="https://api.futureagi.com")sfw_eval = SafeForWorkText()test_case = TestCase( response="This is a sample text to check for safe for work text")result = evaluator.evaluate(eval_templates=[sfw_eval], inputs=[test_case], model_name="turing_flash")sfw_result = result.eval_results[0].metrics[0].id
from fi.evals import Evaluatorfrom fi.testcases import TestCasefrom fi.evals.templates import NotGibberishTextevaluator = Evaluator( fi_api_key="your_api_key", fi_secret_key="your_secret_key", fi_base_url="https://api.futureagi.com")gibberish_eval = NotGibberishText()test_case = TestCase( response="This is a sample text to check for gibberish text")result = evaluator.evaluate(eval_templates=[gibberish_eval], inputs=[test_case], model_name="turing_flash")gibberish_result = result.eval_results[0].metrics[0].id
By integrating these evaluation methods, AI systems can consistently produce responsible, reliable, and socially aware outputs that enhance user trust and engagement.