Reading Time

Calculates the reading time of the model response

Required Parameters: Prompt, Response

Interpretation: score represnts the reading time in minutes for the prompt response. if the score is greater than threshold, the test will fail

Code Example:

prompt = '''Write an article on Artificial Intelligence'''

response = '''In the realm of technological innovation, few fields hold as much promise and excitement as Artificial Intelligence (AI). Often portrayed in science fiction as sentient robots or super-intelligent machines, AI in reality encompasses a diverse range of technologies that enable machines to simulate human intelligence. From self-driving cars to personalized recommendations on streaming platforms, AI is already woven into the fabric of our daily lives, and its impact is only set to grow.
At its core, AI involves the development of algorithms and systems that can perform tasks which typically require human intelligence. These tasks include learning from data, recognizing patterns, making decisions, and even understanding natural language. Machine Learning, a subset of AI, has been particularly transformative. It allows computers to learn from vast amounts of data and improve their performance without being explicitly programmed.
One of the key strengths of AI lies in its ability to process and analyze data at a scale and speed beyond human capability. This has led to groundbreaking applications in various industries. In healthcare, AI is being used to analyze medical images for early detection of diseases such as cancer. It can sift through massive datasets to identify trends and insights that aid researchers and doctors in providing better care.
Financial institutions rely on AI algorithms for fraud detection, risk assessment, and algorithmic trading. Chatbots powered by AI are becoming ubiquitous in customer service, offering quick and efficient responses to queries. Smart home devices use AI to understand and adapt to users' preferences, creating more comfortable and energy-efficient living spaces.
However, the rapid advancement of AI also raises important questions and challenges. Ethical considerations surrounding AI, such as privacy, bias in algorithms, and the potential for job displacement, need careful attention. Ensuring transparency and accountability in AI systems is crucial to building trust among users.
Looking ahead, the future of AI holds immense possibilities. As researchers delve deeper into areas like Artificial General Intelligence (AGI) aiming to create machines with human-like cognitive abilities, the boundaries of what AI can achieve continue to expand.
In conclusion, Artificial Intelligence stands at the forefront of the technological revolution, reshaping industries and the way we interact with machines. While presenting exciting opportunities, it also demands thoughtful and responsible development to harness its full potential for the benefit of society.'''

evaluator.add_test(
    test_names=["reading_time_guardrail"],
    data={'prompt':prompt,
          'response': response,

    },

).run()

evaluator.print_results()

Last updated