App for Visualisation

raga-llm-hub comes with an inbuilt visualization app which can be launched as a localhost browser app (currently not available for Colab)

Install raga-llm-hub[ui] to enable the UI component.

To launch the browser app pass the evaluator result to launch_app() function. For example

pip install raga-llm-hub[ui]

from raga_llm_hub import RagaLLMEval, launch_app
evaluator = RagaLLMEval(api_keys={"OPENAI_API_KEY": "Paste Key Here"})

prompt = "Where and when was leonardo da vinci born?"
response = "Leonardo Da Vinci was born in Vinci, Italy in 1452."
expected_response = "In Vinci, in 1452"
context = [
    "Leonardo da Vinci (1452–1519) was an Italian polymath of the Renaissance period, renowned for his diverse talents in painting, sculpture, architecture, engineering, science, and invention.",
    "Born in Vinci, Italy, in 1452, Leonardo's artistic prowess is epitomized by iconic works such as the Mona Lisa and The Last Supper, which are globally recognized masterpieces.",
    "Apart from his artistic achievements, Leonardo made significant contributions to science, conducting pioneering studies in anatomy, engineering, mathematics, and physics. His anatomical drawings, ahead of their time, remain invaluable to medical science.",
    "Leonardo da Vinci's engineering designs were visionary, encompassing ideas for flying machines, military weaponry, and architectural innovations. While many of his inventions were not realized in his lifetime, they continue to inspire scientists and inventors today.",
    "Leonardo's interdisciplinary approach to knowledge and his relentless curiosity exemplify Renaissance humanism, emphasizing the potential of human intellect and creativity. His legacy continues to captivate people worldwide, leaving an enduring mark on Western culture and inspiring generations beyond his death in 1519.",
]

evaluator.add_test(
    test_names=["faithfulness_test"],
    data={
        "response": pos_response,
        "context": context_string,
    },
    arguments={"model": "gpt-4", "threshold": 0.5},
).add_test(
    test_names=["faithfulness_test"],
    data={
        "response": neg_response,
        "context": context_string,
    },
    arguments={"model": "gpt-4", "threshold": 0.5},
)

evaluator.run() # execute the test

results = evaluator.get_results() # store the result in a variable

launch_app(results) # Launch the visualization as a localhost on the browser

Test Result Overview Visualization

Details of Test Execution - 2nd page

Last updated