The Ratings API lets users leave structured feedback on individual bot messages. Every rating consists of a thumbs-up/thumbs-down value, an optional plain-text comment, and an optional issue tag that categorizes the type of problem encountered. The system enforces a one-rating-per-user-per-message constraint — submitting a second rating for the same message updates the existing record rather than creating a duplicate. Ratings drive the guardrail system and feed into the admin metrics dashboard.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/HugoX2003/nisira-assistant/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/ratings/
Submit or update a rating for a bot message. Only"bot" sender messages can be rated — attempting to rate a user message returns a 400 error. If the authenticated user has already rated the target message, the existing record is updated (update_or_create). Use value: "clear" to remove an existing rating.
Request Body
The database ID of the
Message record to rate. Obtain this from the message_id field in POST /api/chat/ responses, or from id in the messages array returned by GET /api/conversations/<id>/messages/.The rating value. Must be one of:
"like"— positive feedback"dislike"— negative feedback"clear"— remove an existing rating
Optional free-text comment explaining the rating. Maximum 500 characters.
Categorical issue tag for dislike ratings. Must be one of the values listed in the Issue Tags section below. Pass
"auto" to have the system detect the tag from the comment text using keyword matching.Response
ID of the message that was rated.
ID of the conversation containing the rated message.
The stored rating value (
"like" or "dislike"), or null if the rating was cleared.Action taken:
"created", "updated", "removed", or "noop".ISO 8601 timestamp of when the rating was last modified.
The issue tag that was stored.
Details of the async feedback event that was enqueued for downstream processing (telemetry, retraining pipelines, etc.). Only present when a rating was created or updated.
Example
- cURL — Like
- cURL — Dislike with tag
- Response
Issue Tags
Issue tags provide a structured vocabulary for categorizing negative feedback. They are only meaningful ondislike ratings, but can be stored on like ratings as well (with "none" as the default).
| Tag value | Label | When to use |
|---|---|---|
none | Sin etiqueta | No specific issue — default for all ratings |
irrelevante | Irrelevante | Response did not address the question asked |
sin_evidencia | Sin evidencia | Response made claims without citing supporting documents |
tardio | Tardío | Response took too long to arrive (latency issue) |
alucinacion | Alucinación | Response contained invented facts, non-existent references, or hallucinated content |
accion_incorrecta | Acción incorrecta | The recommended action or procedure was wrong |
otro | Otro | Any other issue not covered by the above categories |
You can also pass
"auto" as the issue_tag value. The backend will attempt to detect the appropriate tag by scanning the comment field for Spanish-language keywords (e.g., “irrelev”, “sin fuente”, “alucina”, “invent”). If no keyword matches, it falls back to "otro".GET /api/ratings/summary/
Returns an aggregate statistical summary of all ratings in the system. This endpoint is restricted to staff users (is_staff=True).
Response
Total number of ratings across all users and messages.
Total number of positive ratings.
Total number of negative ratings.
Difference between likes and dislikes (
likes - dislikes).Proportion of likes to total ratings (0.0–1.0). Used by the guardrail system as a quality threshold.
Dictionary mapping each
issue_tag value to its count across all dislike ratings.Per-day rating totals for the last 14 days, each entry with
date, total, likes, dislikes.The 10 most recently updated ratings with full detail:
id, message_id, conversation_id, value, comment, issue_tag, updated_at, username.Counts of
RatingFeedbackEvent records by status: {pending, failed, processed}.The most recent
ExperimentRun record, or null if no experiments exist.Example
GET /api/ratings/export/
Exports all rating records as JSON (default) or CSV. Restricted to staff users (is_staff=True).
Query Parameters
Output format. Must be
"json" or "csv".CSV columns
Whenexport_format=csv, the response is a downloadable file with the following columns: rating_id, message_id, conversation_id, username, value, issue_tag, comment, updated_at.
Example
- JSON export
- CSV export
Experiments & Guardrails
These endpoints are used to track A/B experiment runs that compare a variant RAG configuration against a baseline, and to check whether the system is operating within quality guardrail thresholds. All require JWT authentication with staff privileges.GET /api/experiments/
Returns a paginated list of allExperimentRun records ordered by most recent first.
Maximum number of experiment records to return. Omit to return all.
GET /api/experiments/latest/
Returns the single most recentExperimentRun record. Returns 404 if no experiments exist.
POST /api/experiments/create/
Creates a new experiment run record and automatically evaluates it against configurable guardrail thresholds. If any delta (precision, faithfulness, or latency) breaches its threshold,guardrail_passed is set to false and guardrail_reason is populated. Returns 201 Created on success.
Name of the experiment.
Name of the variant being tested.
Who ran the experiment.
Optional free-text notes about the run.
Baseline Precision@k score (0–1).
Variant Precision@k score (0–1).
Baseline faithfulness score (0–1).
Variant faithfulness score (0–1).
Baseline average latency in seconds.
Variant average latency in seconds.
Minimum acceptable delta precision. Experiments with lower deltas are blocked.
Minimum acceptable delta faithfulness.
Maximum acceptable latency increase in seconds.
GET /api/guardrails/status/
Evaluates the current system state against all guardrail conditions and returns a pass/fail summary. Checks: the latest experiment’sguardrail_passed flag, any failed feedback events in the queue, and whether satisfaction_rate is above the configured threshold.
Minimum acceptable satisfaction rate (0.0–1.0). The guardrail fails if the current rate is below this value.