ares.visualization package

Submodules

ares.visualization.html_header module

ares.visualization.response_visualizer module

Response Visualizer for ARES evaluation results.

Generates HTML visualizations of evaluation results in chat-like format, supporting both multi-turn conversations and single-turn responses.

Performance design

For large result sets (10k–50k items) inlining all conversation HTML into a single file produces files that are tens of megabytes and take many seconds to parse. Instead we:

  1. Serialize the raw data items as a compact JSON blob in a <script> tag.

  2. Write one empty <div id="conv-N"> placeholder per item — a few bytes each.

  3. A small vanilla-JS renderer fills the currently active card on demand when the user clicks a sidebar entry. All other cards remain empty DOM nodes.

This keeps the HTML file at O(N × ~200 bytes) for the skeleton regardless of response length, and renders each card in < 1 ms in the browser.

class ares.visualization.response_visualizer.ResponseVisualizer[source]

Bases: object

Visualizer for ARES evaluation results in chat format.

detect_evaluation_type(results: list[dict[str, Any]]) → str[source]

Detect the type of evaluation file.

extract_conversations_from_goal(results: list[dict[str, Any]]) → list[dict[str, Any]][source]

Extract conversation items from goal-level evaluation format.

generate_html_header(title: str = 'ARES Response Viewer') → str[source]
generate_sidebar(items: list[Any], eval_type: str) → str[source]

Generate sidebar navigation HTML.

group_by_conversation(results: list[dict[str, Any]]) → dict[str, list[dict[str, Any]]][source]

Group turn-level results by conversation_id.

static load_evaluation_file(filepath: Path) → list[dict[str, Any]][source]

Load evaluation JSON or JSONL file.

JSONL files (one JSON object per line) are written by ARES when --run-tagged / -r is used. Plain .json files contain a single JSON document (list or dict) and were the original format.

static render_markdown(text: str) → str[source]

Convert markdown formatting to HTML.

visualize(filepath: str | Path, output_file: str | Path | None = None, max_items: int | None = None, evaluator_name: str | None = None) → Path[source]

Generate HTML visualization from an evaluation JSON or JSONL file.

Module contents

ARES Visualization Module for displaying evaluation results in chat-like format.

class ares.visualization.ResponseVisualizer[source]

Bases: object

Visualizer for ARES evaluation results in chat format.

detect_evaluation_type(results: list[dict[str, Any]]) → str[source]

Detect the type of evaluation file.

extract_conversations_from_goal(results: list[dict[str, Any]]) → list[dict[str, Any]][source]

Extract conversation items from goal-level evaluation format.

generate_html_header(title: str = 'ARES Response Viewer') → str[source]
generate_sidebar(items: list[Any], eval_type: str) → str[source]

Generate sidebar navigation HTML.

group_by_conversation(results: list[dict[str, Any]]) → dict[str, list[dict[str, Any]]][source]

Group turn-level results by conversation_id.

static load_evaluation_file(filepath: Path) → list[dict[str, Any]][source]

Load evaluation JSON or JSONL file.

JSONL files (one JSON object per line) are written by ARES when --run-tagged / -r is used. Plain .json files contain a single JSON document (list or dict) and were the original format.

static render_markdown(text: str) → str[source]

Convert markdown formatting to HTML.

visualize(filepath: str | Path, output_file: str | Path | None = None, max_items: int | None = None, evaluator_name: str | None = None) → Path[source]

Generate HTML visualization from an evaluation JSON or JSONL file.