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.
- class ares.visualization.response_visualizer.ResponseVisualizer[source]
Bases:
objectVisualizer for ARES evaluation results in chat format.
- detect_evaluation_type(results: list[dict[str, Any]]) str[source]
Detect the type of evaluation file.
- Returns:
Individual turn-based evaluations (keyword/prompt) - ‘mixed’: Mix of multi-turn and single-turn evaluations - ‘goal’: Goal-level aggregated evaluations - ‘conversation’: Conversation-level evaluations - ‘single_turn’: Single turn responses without conversation structure
- Return type:
‘multi_turn’
- extract_conversations_from_goal(results: list[dict[str, Any]]) list[dict[str, Any]][source]
Extract conversations from goal-level evaluation format.
- generate_conversation_html_from_messages(conv_data: dict[str, Any], conv_num: int, total_convs: int) str[source]
Generate HTML for a conversation from goal/conversation evaluation format.
- generate_conversation_html_multi_turn(conv_id: str, turns: list[dict[str, Any]], conv_num: int, total_convs: int) str[source]
Generate HTML for a multi-turn conversation.
Generate HTML footer.
- generate_html_header(title: str = 'ARES Response Viewer') str[source]
Generate HTML header with CSS styling.
- generate_sidebar(items: list[Any], eval_type: str) str[source]
Generate sidebar navigation.
Note: Uses list.append() + ‘
- ‘.join() for HTML generation.
If performance becomes an issue with very large outputs, consider using io.StringIO for incremental string building.
- generate_single_turn_html(item: dict[str, Any], item_num: int, total_items: int) str[source]
Generate HTML for a single-turn response.
- group_by_conversation(results: list[dict[str, Any]]) dict[str, list[dict[str, Any]]][source]
Group turns by conversation ID for multi-turn evaluations.
- static load_evaluation_file(filepath: Path) list[dict[str, Any]][source]
Load evaluation JSON file.
- 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 evaluation file.
- Parameters:
filepath – Path to evaluation JSON file
output_file – Optional output HTML file path
max_items – Optional maximum number of items to visualize
evaluator_name – Optional name of the evaluator (e.g., ‘keyword’, ‘conversation_eval’)
- Returns:
Path to generated HTML file
Module contents
ARES Visualization Module for displaying evaluation results in chat-like format.
- class ares.visualization.ResponseVisualizer[source]
Bases:
objectVisualizer for ARES evaluation results in chat format.
- detect_evaluation_type(results: list[dict[str, Any]]) str[source]
Detect the type of evaluation file.
- Returns:
Individual turn-based evaluations (keyword/prompt) - ‘mixed’: Mix of multi-turn and single-turn evaluations - ‘goal’: Goal-level aggregated evaluations - ‘conversation’: Conversation-level evaluations - ‘single_turn’: Single turn responses without conversation structure
- Return type:
‘multi_turn’
- extract_conversations_from_goal(results: list[dict[str, Any]]) list[dict[str, Any]][source]
Extract conversations from goal-level evaluation format.
- generate_conversation_html_from_messages(conv_data: dict[str, Any], conv_num: int, total_convs: int) str[source]
Generate HTML for a conversation from goal/conversation evaluation format.
- generate_conversation_html_multi_turn(conv_id: str, turns: list[dict[str, Any]], conv_num: int, total_convs: int) str[source]
Generate HTML for a multi-turn conversation.
Generate HTML footer.
- generate_html_header(title: str = 'ARES Response Viewer') str[source]
Generate HTML header with CSS styling.
- generate_sidebar(items: list[Any], eval_type: str) str[source]
Generate sidebar navigation.
Note: Uses list.append() + ‘
- ‘.join() for HTML generation.
If performance becomes an issue with very large outputs, consider using io.StringIO for incremental string building.
- generate_single_turn_html(item: dict[str, Any], item_num: int, total_items: int) str[source]
Generate HTML for a single-turn response.
- group_by_conversation(results: list[dict[str, Any]]) dict[str, list[dict[str, Any]]][source]
Group turns by conversation ID for multi-turn evaluations.
- static load_evaluation_file(filepath: Path) list[dict[str, Any]][source]
Load evaluation JSON file.
- 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 evaluation file.
- Parameters:
filepath – Path to evaluation JSON file
output_file – Optional output HTML file path
max_items – Optional maximum number of items to visualize
evaluator_name – Optional name of the evaluator (e.g., ‘keyword’, ‘conversation_eval’)
- Returns:
Path to generated HTML file