Feedback#

User feedback for answer quality and satisfaction metrics

Submit answer feedback#

POST/answer/feedback

Submit user feedback (rating, optional comment) for an answer generated by the Answer Agent.

Feedback is tied to the project_id extracted from authentication context. Used by the widget to collect user satisfaction data for answer quality metrics.

Typical flow:

  1. User receives answer from Answer Agent
  2. User clicks thumbs up/down (rating 0 or 1, scale 1)
  3. Optionally adds comment
  4. Widget submits feedback to this endpoint

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Request Body#

Example:

{
    "rating": 1,
    "scale": 1,
    "comment": "Very helpful answer with accurate product information",
    "query": "What are the best winter jackets?",
    "answer": "Based on your inventory, the best winter jackets include...",
    "classification": {
        "route_type": "question",
        "improved_query": "string",
        "semantic_query": "string",
        "confidence": 0
    },
    "reasoning": "string",
    "result_data": {},
    "session_id": "sess_abc123xyz"
}

Code Examples#

curl -X POST "https://searchaf.antfly.io/api/v1/answer/feedback" \\
    -H "Authorization: Bearer YOUR_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
    "rating": 1,
    "scale": 1,
    "comment": "Very helpful answer with accurate product information",
    "query": "What are the best winter jackets?",
    "answer": "Based on your inventory, the best winter jackets include...",
    "classification": {
        "route_type": "question",
        "improved_query": "string",
        "semantic_query": "string",
        "confidence": 0
    },
    "reasoning": "string",
    "result_data": {},
    "session_id": "sess_abc123xyz"
}'

Responses#

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2024-01-01T00:00:00Z"
}