The OpenTextShield API includes feedback endpoints to collect user feedback on classification results.
Submit feedback about classification results.
Request Body:
{
"content": "Original text that was classified",
"feedback": "User feedback about the classification",
"thumbs_up": true,
"thumbs_down": false,
"user_id": "optional_user_identifier",
"model": "ots-mbert"
}Response:
{
"message": "Feedback received successfully",
"feedback_id": "uuid-feedback-id"
}Download feedback CSV file for a specific model.
Parameters:
model_name: Model name (e.g., "ots-mbert")
Response:
- CSV file with feedback data
- Headers: FeedbackID, Timestamp, UserID, Content, Feedback, ThumbsUp, ThumbsDown, Model
curl -X POST "http://localhost:8002/feedback/" \
-H "Content-Type: application/json" \
-d '{
"content": "URGENT! Click this link now!",
"feedback": "Correctly identified as spam",
"thumbs_up": true,
"thumbs_down": false,
"user_id": "user123",
"model": "ots-mbert"
}'curl "http://localhost:8002/feedback/download/ots-mbert" -o feedback.csvRun the feedback API tests:
# Python test script
python3 test_feedback_api.py
# cURL test script
./test_feedback_curl.shFeedback is stored in CSV files in the feedback/ directory:
- File format:
feedback_{model_name}.csv - Example:
feedback/feedback_ots-mbert.csv
The API returns appropriate HTTP status codes:
200: Success400: Invalid model name or bad request404: Feedback file not found500: Internal server error