{% extends "base.html" %} {% block title %}Prompt Analytics - AISBF Dashboard{% endblock %} {% macro format_tokens(value) %} {% if value is none or value == 0 %}0{% else %} {% set val = value | float %} {% if val >= 1000000000 %} {{ "%.2f"|format(val / 1000000000) }}B {% elif val >= 1000000 %} {{ "%.2f"|format(val / 1000000) }}M {% elif val >= 1000 %} {{ "%.2f"|format(val / 1000) }}K {% else %} {{ "%.0f"|format(val) }} {% endif %} {% endif %} {% endmacro %} {% macro pct(part, total) %} {% if total and total > 0 %} {{ "%.0f"|format((part / total) * 100) }}% {% else %} 0% {% endif %} {% endmacro %} {% block content %}

Prompt Analytics

Native AISBF prompt analysis for prompt-security findings, request composition, blocking posture, and model/provider exposure. {% if is_config_admin %} This view can compare global traffic with user-scoped runs when filters are applied. {% else %} This view is limited to your own requests and does not expose global visitor activity. {% endif %}

📊 Analytics 🧠 Prompt Analytics {% if is_config_admin %} 👣 Traffic & Visits {% endif %} 💾 Response Cache ⏱️ Rate Limits

Filter by Date Range

Filter by Provider, Model, Rotation, Autoselect, or User

{% if from_date %}{% endif %} {% if to_date %}{% endif %}
{% if is_admin %}
{% endif %}
{% set details = prompt_analysis_details or {} %} {% set posture = details.posture or {} %} {% set total_runs = prompt_analysis_overview.total_runs if prompt_analysis_overview else 0 %} {% if prompt_analysis_overview and prompt_analysis_overview.total_runs > 0 %}
Analyzed Requests
{{ prompt_analysis_overview.total_runs }}
Blocked Requests
{{ prompt_analysis_overview.blocked_runs }}
{{ pct(prompt_analysis_overview.blocked_runs, prompt_analysis_overview.total_runs) }} of analyzed runs
High Risk
{{ prompt_analysis_overview.high_risk_runs }}
{{ pct(prompt_analysis_overview.high_risk_runs, prompt_analysis_overview.total_runs) }} flagged as high risk
Avg Prompt / Context Tokens
{{ "%.0f"|format(prompt_analysis_overview.avg_prompt_tokens) }} / {{ "%.0f"|format(prompt_analysis_overview.avg_effective_context) }}
Prompt body versus effective context footprint
Runs With Tools
{{ posture.runs_with_tools or 0 }}
{{ pct(posture.runs_with_tools or 0, total_runs) }} included tool definitions
Runs With System Prompt
{{ posture.runs_with_system_prompt or 0 }}
{{ pct(posture.runs_with_system_prompt or 0, total_runs) }} had an explicit system layer
Avg Findings / Avg Risk Score
{{ "%.1f"|format(posture.avg_findings_count or 0) }} / {{ "%.0f"|format(posture.avg_risk_score or 0) }}
Average detector density per analyzed request

Prompt Risk Timeline

Run volume, high-risk detections, and blocking decisions over time.

Scope

Visible Dataset
{% if is_config_admin %}{% if global_only == '1' %}Global-only{% elif selected_user %}Selected user{% else %}All visible scopes{% endif %}{% else %}Current user only{% endif %}
{% if is_config_admin %} Apply the user filter or enable Global requests only to separate user-owned prompt analysis from global admin traffic. {% else %} Prompt analytics are already scoped to your own requests, with no traffic or visitor telemetry exposed here. {% endif %}

Top Prompt Findings

{% if prompt_analysis_overview.findings %} {% for finding in prompt_analysis_overview.findings %} {% endfor %}
CategorySeverityCount
{{ finding.category }}{{ finding.severity }}{{ finding.count }}
{% else %}

No findings were recorded in this range.

{% endif %}

Risk Level Mix

{% if details.risk_breakdown %} {% for row in details.risk_breakdown %} {% endfor %}
RiskRunsShare
{{ row.risk_level }}{{ row.count }}{{ pct(row.count, total_runs) }}
{% else %}

No risk distribution available.

{% endif %}

Providers Under Prompt Pressure

{% if details.provider_breakdown %} {% for provider in details.provider_breakdown %} {% endfor %}
ProviderRunsBlockedHigh Risk
{{ provider.provider_id }} {{ provider.runs }} {{ provider.blocked }} {{ provider.high_risk }}
{% else %}

No provider breakdown available.

{% endif %}

Most Analyzed Models

{% if details.model_breakdown %} {% for model in details.model_breakdown %} {% endfor %}
ModelRunsBlockedHigh Risk
{{ model.model_name }} {{ model.runs }} {{ model.blocked }} {{ model.high_risk }}
{% else %}

No model breakdown available.

{% endif %}

Dominant Prompt Segment

{% if details.segment_breakdown %} {% for row in details.segment_breakdown %} {% endfor %}
SegmentRunsShare
{{ row.role }}{{ row.count }}{{ pct(row.count, total_runs) }}
{% else %}

No segment mix available.

{% endif %}

Prompt Shapes

{% if details.shape_breakdown %} {% for row in details.shape_breakdown %} {% endfor %}
ShapeRunsShare
{{ row.prompt_shape }}{{ row.count }}{{ pct(row.count, total_runs) }}
{% else %}

No prompt-shape data available.

{% endif %}

Recent Prompt Analysis Runs

{% if details.recent_runs %}
{% for run in details.recent_runs %} {% endfor %}
When Provider Model Risk Blocked Prompt / Context Shape Signals Findings
{{ run.created_at }} {{ run.provider_id }}
{{ run.model_name }}
{% if run.rotation_id or run.autoselect_id %}
{% if run.rotation_id %}Rotation: {{ run.rotation_id }}{% endif %} {% if run.rotation_id and run.autoselect_id %} | {% endif %} {% if run.autoselect_id %}Autoselect: {{ run.autoselect_id }}{% endif %}
{% endif %}
{{ run.risk_level }}
score {{ run.risk_score }}
{% if run.blocked %}Yes{% else %}No{% endif %} {{ format_tokens(run.prompt_tokens) }} / {{ format_tokens(run.effective_context) }}
{{ run.prompt_shape }}
largest: {{ run.largest_segment_role }}
{% if run.has_system_prompt %}system{% endif %} {% if run.has_tools %}tools{% endif %} {% if not run.has_system_prompt and not run.has_tools %}base{% endif %}
{{ run.findings_count }} total
H {{ run.high_count }} / M {{ run.medium_count }} / I {{ run.info_count }}
{% if run.findings %}
{% for finding in run.findings %}
{{ finding.category }} ({{ finding.severity }}) x{{ finding.count }}
{% endfor %}
{% endif %}
{% else %}

No recent prompt-analysis runs matched the current filters.

{% endif %}
{% else %}

No prompt analysis data available yet.

{% endif %}
Back to Dashboard Analytics {% if is_admin %} Rate Limits Response Cache {% endif %}
{% endblock %}