Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reporting: tidy config details, add payload audit info #936

Merged
merged 2 commits into from
Oct 11, 2024
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
11 changes: 10 additions & 1 deletion garak/analyze/report_digest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import json
import markdown
import os
import pprint
import re
import sys

Expand Down Expand Up @@ -63,6 +64,7 @@ def plugin_docstring_to_description(docstring):

def compile_digest(report_path, taxonomy=_config.reporting.taxonomy):
evals = []
payloads = []
setup = defaultdict(str)
with open(report_path, "r", encoding="utf-8") as reportfile:
for line in reportfile:
Expand All @@ -75,6 +77,12 @@ def compile_digest(report_path, taxonomy=_config.reporting.taxonomy):
run_uuid = record["run"]
elif record["entry_type"] == "start_run setup":
setup = record
elif record["entry_type"] == "payload_init":
payloads.append(
record["payload_name"]
+ " "
+ pprint.pformat(record, sort_dicts=True, width=60)
)

calibration = garak.analyze.calibration.Calibration()
calibration_used = False
Expand All @@ -85,10 +93,11 @@ def compile_digest(report_path, taxonomy=_config.reporting.taxonomy):
"garak_version": garak_version,
"start_time": start_time,
"run_uuid": run_uuid,
"setup": repr(setup),
"setup": pprint.pformat(setup, sort_dicts=True, width=60),
"probespec": setup["plugins.probe_spec"],
"model_type": setup["plugins.model_type"],
"model_name": setup["plugins.model_name"],
"payloads": payloads,
}
)

Expand Down
26 changes: 19 additions & 7 deletions garak/analyze/templates/digest_header.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,25 @@ h2,h3,h4 {padding-top: 10px; padding-bottom: 10px}
<h1>garak run: {{reportfile}}</h1>
<button class="accordion">⚙️ view config</button>
<div style="border:solid black 1px; padding: 5px; margin: 5px" class="panel">
<h2>config</h2>
<p>filename: {{reportfile}}</p>
<p>garak version: {{garak_version}}</p>
<p>generator: {{model_type}}.{{model_name}}</p>
<p>started at: {{start_time}}</p>
<p>run config: {{setup}}</p>
<p>probe spec: {{probespec}}</p>
<h2>config details</h2>
<pre>
filename: {{reportfile}}

garak version: {{garak_version}}

generator: {{model_type}}.{{model_name}}

probe spec: {{probespec}}

run started at: {{start_time}}

run config: {{setup}}

{% for payload in payloads %}
payload: {{payload}}

{% endfor %}
</pre>
</div>

{%if model_name %}
Expand Down
Loading