Golden examples are high-quality query-response pairs that demonstrate ideal assistant behavior. They are used to improve response quality through RAG (Retrieval-Augmented Generation) by providing the LLM with relevant examples during query processing.
curl -X POST https://api.example.com/feedback/golden-examples/ \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "original_query": "What are the SLA targets for P1 incidents?", "golden_response": "P1 incidents have the following SLA targets:\n- Response time: 30 minutes\n- Resolution time: 4 hours\n- Update frequency: Every 2 hours\n\nThese targets apply during business hours (9am-5pm EST). Outside business hours, add 1 hour to each target.", "original_response": "P1 incidents should be resolved within 4 hours." }'
curl -X PUT https://api.example.com/feedback/golden-examples/9e9f8891-9647-62f0-c938-028fe3102cg9 \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "golden_response": "P1 incidents have the following SLA targets:\n- Response time: 30 minutes\n- Resolution time: 4 hours\n- Update frequency: Every 2 hours\n- Escalation: After 2 hours if no progress\n\nThese targets apply during business hours (9am-5pm EST). Outside business hours, add 1 hour to each target.", "is_active": true }'
{ "id": "9e9f8891-9647-62f0-c938-028fe3102cg9", "feedback_id": null, "source_type": "manual", "approval_type": "manual", "original_query": "What are the SLA targets for P1 incidents?", "original_response": "P1 incidents should be resolved within 4 hours.", "golden_response": "P1 incidents have the following SLA targets:\n- Response time: 30 minutes\n- Resolution time: 4 hours\n- Update frequency: Every 2 hours\n- Escalation: After 2 hours if no progress\n\nThese targets apply during business hours (9am-5pm EST). Outside business hours, add 1 hour to each target.", "qdrant_point_id": "point_67890_updated", "created_by": "admin-123", "creator_email": "[email protected]", "is_active": true, "created_at": "2026-03-01T10:30:00Z", "updated_at": "2026-03-01T11:45:00Z"}
Updating the golden_response will re-embed the example in the vector database, which may take a few seconds.
Here’s a complete workflow for managing golden examples:
Python
import requestsBASE_URL = "https://api.example.com"HEADERS = {"Authorization": "Bearer YOUR_TOKEN"}# 1. Create a new golden exampleresponse = requests.post( f"{BASE_URL}/feedback/golden-examples/", headers=HEADERS, json={ "original_query": "How do I reset my password?", "golden_response": "To reset your password:\n1. Go to the login page\n2. Click 'Forgot Password'\n3. Enter your email\n4. Check your inbox for the reset link\n5. Follow the link and create a new password\n\nThe reset link expires in 24 hours." })example = response.json()print(f"Created example: {example['id']}")# 2. List all active examplesresponse = requests.get( f"{BASE_URL}/feedback/golden-examples/", headers=HEADERS, params={"is_active": True, "limit": 50})data = response.json()print(f"Active examples: {data['total']}")# 3. Update an exampleresponse = requests.put( f"{BASE_URL}/feedback/golden-examples/{example['id']}", headers=HEADERS, json={ "golden_response": "To reset your password:\n1. Go to the login page\n2. Click 'Forgot Password'\n3. Enter your email\n4. Check your inbox for the reset link (check spam folder)\n5. Follow the link and create a new password\n\nThe reset link expires in 24 hours. If you don't receive the email, contact support." })print("Example updated")# 4. Archive old example instead of deletingresponse = requests.put( f"{BASE_URL}/feedback/golden-examples/{example['id']}", headers=HEADERS, json={"is_active": False})print("Example archived")