Feedback Aide API Methods
generateFeedback()
Generates feedback and scores based on the current session's stimulus, response, and rubric.
You would want to use this to send a request to generate feedback where you already have your own user interface and rubric, for example.
This method will stream a fetch request and progressively update the user interface, which has been previously rendered on the page using the attach() method.
Important This process can only be run once for the feedback session. Any subsequent calls will return the previously completed result. To resubmit a session for grading, you must create a new feedback session with a new session ID.
Examples
// Start generating feedback for the current session
const { response, cancel } = feedbackSession.generateFeedback();
// If you are using the session UI instance
const { response, cancel } = sessionUI.generateFeedback();
// Continue waiting for the promise to resolve
response.then((result) => {
console.log(result);
});
// Or cancel the current feedback generation process
cancel();
Arguments
-
modelConfiguration object
The AI model configuration object.
The following properties are supported.
-
model string
The AI model to use for generating feedback.
Note The advanced models will use more credits than the standard model.
Possible values
"standard-essay""advanced-essay""advanced-shortresponse"
-
-
options object
Additional callbacks which can be triggered while generating feedback.
The following properties are supported.
-
onProgress function
Callback function for progress updates.
-
onComplete function
Callback function when the feedback has finished generating.
-
onError function
Callback function for error handling.
-
Return value
Type object
-
response Promise
The current generating feedback promise.
-
cancel function
Cancels the current process for generating feedback.
Caveats
This method is not available when the feedbackSession state is "review".