Send Generation Feedback Using Models API
Send feedback about a generative AI provider’s response using the Feedback REST endpoint or Apex class. For example, you can send feedback about a generated email containing misinformation about a product.
When you send a request with a prompt, the response can return one or more generation objects, each with a unique ID. Use this identifier (or your own unique identifier value) to provide feedback to the feedback REST endpoint or the feedback Apex class. This feedback can include additional details about explicit feedback or telemetry data.
Each feedback call requires at least two IDs: one that identifies this unique piece of feedback (id
) and one that identifies the target of this feedback (generationId
). You can provide information about the feedback sentiment (feedback
), free-form feedback text (feedbackText
), and any other use-case-specific data (appFeedback
). The Models API doesn’t do any semantic validation on this information and is only meant for you to identify and filter the feedback in the datastore.
Feedback data is stored in Data Cloud. See Einstein Audit and Feedback Data.
In this example, the client sends feedback when the user specified a thumbs down for an incomplete response. The sample code shows the request body when making an HTTP POST request to the /feedback
endpoint.
See Submit Feedback REST Endpoint.
In this Apex example, the client sends feedback when the user is satisfied with the response.
- Models API Developer Guide: Access Models API with REST
- Models API Developer Guide: Access Models API with Apex
- Models API Reference: Submit Feedback REST Endpoint
- Models API Reference: submitFeedback Apex method
- Salesforce Help: Einstein Audit and Feedback Data