Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion giskard/rag/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import matplotlib
import numpy as np
import pandas as pd
from IPython.core.display import HTML

from ..llm.client.base import LLMClient
from ..llm.embeddings.base import BaseEmbedding
Expand Down Expand Up @@ -135,6 +134,8 @@ def to_html(self, filename=None, embed=False):
return

if embed:
from IPython.core.display import HTML

return HTML(f'<iframe srcdoc="{escape(html)}" width=100% height=800px></iframe>')
return html

Expand Down
44 changes: 22 additions & 22 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ dependencies = [
"colorama", # needed for the scan
"num2words>=0.5.13",
"griffe>=1.0.0,<2.0.0",
"ipython",
]

[project.optional-dependencies]
Expand Down
10 changes: 10 additions & 0 deletions tests/rag/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from unittest.mock import Mock, patch

import numpy as np
import pytest
from bokeh.plotting import figure

from giskard.rag import QATestset, RAGReport
Expand Down Expand Up @@ -98,6 +99,15 @@ def test_report_plots():
assert len(histograms["Question"]["simple"]) == 4


@pytest.mark.parametrize("embed", [False, True])
def test_report_to_html(embed):
"""Test that to_html works correctly with different embed parameter values."""
testset, answers, metrics_results = _create_test_data()

report = RAGReport(testset, answers, metrics_results)
report.to_html(embed=embed)


def test_report_save_load(tmp_path):
testset, answers, metrics_results = _create_test_data(with_documents=True)
llm_client = Mock()
Expand Down
Loading