Skip to content

Commit 085abe6

Browse files
authored
Merge branch 'main' into qatest_push_to_hub
2 parents eea7afd + 2770824 commit 085abe6

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

‎giskard/core/core.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
from enum import Enum
99
from pathlib import Path
1010

11-
from griffe import Docstring
12-
from griffe.docstrings.dataclasses import (
11+
from griffe import (
12+
Docstring,
1313
DocstringSection,
14+
DocstringSectionKind,
1415
DocstringSectionParameters,
1516
DocstringSectionReturns,
1617
)
17-
from griffe.enumerations import DocstringSectionKind
1818

1919
from ..utils.artifacts import serialize_parameter
2020

@@ -26,7 +26,7 @@
2626
from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, Union
2727

2828
logger = logging.getLogger(__name__)
29-
DEMILITER = f"\n{'='*20}\n"
29+
DEMILITER = f"\n{'=' * 20}\n"
3030

3131

3232
class Kwargs:

‎giskard/rag/report.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import matplotlib
88
import numpy as np
99
import pandas as pd
10-
from IPython.core.display import HTML
1110

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

137136
if embed:
137+
from IPython.core.display import HTML
138+
138139
return HTML(f'<iframe srcdoc="{escape(html)}" width=100% height=800px></iframe>')
139140
return html
140141

‎pyproject.toml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ml_runtime = [
8181
]
8282
test = [
8383
"google.generativeai",
84-
"nemoguardrails>=0.9.0",
84+
"nemoguardrails>=0.9.0, <0.11.0", # 0.11.0 ensure align with langchain<0.3.0
8585
"onnxruntime<1.20.0",
8686
"openai>=1",
8787
"polyfactory",
@@ -174,7 +174,8 @@ dependencies = [
174174
"markdown", # needed for display of scan results in notebook
175175
"colorama", # needed for the scan
176176
"num2words>=0.5.13",
177-
"griffe>=0.36.9, <0.49.0",
177+
"griffe>=1.0.0,<2.0.0",
178+
"ipython",
178179
]
179180

180181
[project.optional-dependencies]

‎tests/rag/test_report.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from unittest.mock import Mock, patch
33

44
import numpy as np
5+
import pytest
56
from bokeh.plotting import figure
67

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

100101

102+
@pytest.mark.parametrize("embed", [False, True])
103+
def test_report_to_html(embed):
104+
"""Test that to_html works correctly with different embed parameter values."""
105+
testset, answers, metrics_results = _create_test_data()
106+
107+
report = RAGReport(testset, answers, metrics_results)
108+
report.to_html(embed=embed)
109+
110+
101111
def test_report_save_load(tmp_path):
102112
testset, answers, metrics_results = _create_test_data(with_documents=True)
103113
llm_client = Mock()

0 commit comments

Comments
 (0)