Sample Requests (experimental) allows you to automatically forward a percentage of your API requests and responses to a webhook endpoint for analysis, monitoring, and quality assurance.
View request logs in the Requesty Console.
Overview
The Sample Requests feature enables you to capture a configurable percentage of chat completion requests and responses, forwarding them to your webhook URL for detailed analysis. This is useful for:- Quality Monitoring: Review AI responses for quality assurance
- Analytics: Analyze request patterns and response characteristics
How to use
Request sampling is configured using thesample object within the requesty field when sending chat completion requests:
Parameters
webhook_url(required): The HTTPS endpoint URL where sampled requests and responses will be sent via HTTP POSTsample_ratio(required): A float between 0 and 1 (inclusive) representing the percentage of requests to sample0.0: No requests sampled0.1: 10% of requests sampled1.0: 100% of requests sampled
feedback object containing string key-value pairs. And the entire object will be attached as feedback to the logs of the sampled request. All keys can only contain [a-z, A-Z, 0-9, -, _] and are up to 128 chars and all values must be valid strings representing either float, int64 or strings of the same constraints.
A concrete example
Chat completion requestrequest and response conform to OpenAI Chat Completion API.
Verifying sampled webhooks
If your organization has a webhook signing secret, each sampled webhook is signed with it. Thewebhook-id header matches the payload’s request_id, and the X-Requesty-Event header is sample.request. See Webhook Signatures for how to verify the signature.