Scan report reference
Scan reports provide detailed information about security vulnerabilities detected during LLM security scans.
- class giskard.scanner.report.ScanReport(issues, model=None, dataset=None, detectors_names=None, as_html: bool = True)[source]
Bases:
object
- generate_rails(filename=None, colang_version='1.0')[source]
Generates Rails from the scan report.
Saves or returns the Rails representation of the scan report.
- Parameters:
filename (Optional[str]) – If provided, the Rails will be written to the file.
colang_version (Optional[str]) – The version of the CoLang to use. Supported versions are
1.0
and2.x
.
- generate_test_suite(name=None)[source]
Automatically generates a test suite from the scan results.
This method provides a way to generate a test suite automatically, based on the issues detected by the scan. The test suite can be used to reproduce the issues.
- Parameters:
name (Optional[str]) – The name of the test suite. If not provided, a default name will be used. You can also change the name later by accessing the
name
attribute of the returned test suite.- Returns:
A test suite containing tests from the scan results.
- Return type:
- generate_tests(with_names=False)[source]
Automatically generates tests from the scan results.
This method provides a way to generate a list of tests automatically, based on the issues detected by the scan. Usually you will want to generate a test suite directly, see
generate_test_suite()
for more details.- Parameters:
with_names (Optional[bool]) – Whether to return the test names as well. If
True
, the method will return a list of tuples.- Returns:
A list of Giskard test objects.
- Return type:
list
- to_avid(filename=None)[source]
Renders the scan report as an AVID report.
Saves or returns the AVID representation of the scan report.
- Parameters:
filename (Optional[str]) – If provided, the AVID report will be written to the file.
- to_dataframe()[source]
Returns the scan report as a pandas DataFrame.
- Returns:
A pandas DataFrame containing the scan report details.
- Return type:
pd.DataFrame
- to_html(filename=None, embed=False)[source]
Renders the scan report as HTML.
Saves or returns the HTML representation of the scan report.
- Parameters:
filename (Optional[str]) – If provided, the HTML will be written to the file.
embed (Optional[bool]) – Whether to configure the HTML to be embedded in an iframe.
- to_json(filename=None)[source]
Renders the scan report as json
- Parameters:
filename (Optional[str]) – If provided, the json will be written to the file.
- to_markdown(filename=None, template='summary')[source]
Renders the scan report as markdown.
Saves or returns the markdown representation of the scan report.
- Parameters:
filename (Optional[str]) – If provided, the markdown will be written to the file.
template (Optional[str]) – The template to use. Currently, only
summary
is supported.
- to_mlflow(mlflow_client: MlflowClient = None, mlflow_run_id: str = None, summary: bool = True, model_artifact_path: str = '')[source]
Logs the scan results to MLflow.
Log the current scan results in an HTML format to the active MLflow run.
- to_wandb(run: 'wandb.wandb_sdk.wandb_run.Run' | None = None) None [source]
Logs the scan results to the WandB run.
Log the current scan results in an HTML format to the active WandB run.
- Parameters:
run – WandB run.
- update_rails_config(filename)[source]
Updates the Rails configuration file.
- Parameters:
filename (str) – The path to the Rails configuration file.