Feedback
(llm.feedback)
Overview
Available Operations
- createFeedback - Submit feedback for chat completion
- getFeedbackById - Retrieve feedback by completion ID
- updateFeedback - Update existing feedback
createFeedback
Submit user feedback for a specific chat completion response to track satisfaction and gather insights. Provide the chat completion request ID (chatcmpl-xxx) returned from the original completion, along with an optional rating ('thumbs_up' or 'thumbs_down') and optional detailed feedback text. Feedback is permanently associated with the completion record for analytics, quality monitoring, and model performance tracking. Each completion can only receive feedback once; attempting to create duplicate feedback returns a 409 conflict error.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.feedback.createFeedback({
id: "<id>",
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackCreateFeedback } from "@meetkai/mka1/funcs/llmFeedbackCreateFeedback.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await llmFeedbackCreateFeedback(sdk, {
id: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmFeedbackCreateFeedback failed:", res.error);
}
}
run();React hooks and utilities
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Mutation hook for triggering the API call.
useLlmFeedbackCreateFeedbackMutation
} from "@meetkai/mka1/react-query/llmFeedbackCreateFeedback.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.CreateFeedbackRequestBody | ✔️ | The request object to use for the request. |
options | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<operations.CreateFeedbackResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
getFeedbackById
Retrieve feedback for a specific chat completion by its request ID. Returns the thumbs up/down rating and detailed feedback description if they were provided. Returns 404 if the completion doesn't exist or if no feedback has been submitted yet. Use this to display user feedback, analyze satisfaction patterns, or integrate feedback into your application's UI.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.feedback.getFeedbackById({
id: "<id>",
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackGetFeedbackById } from "@meetkai/mka1/funcs/llmFeedbackGetFeedbackById.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await llmFeedbackGetFeedbackById(sdk, {
id: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmFeedbackGetFeedbackById failed:", res.error);
}
}
run();React hooks and utilities
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Query hooks for fetching data.
useLlmFeedbackGetFeedbackById,
useLlmFeedbackGetFeedbackByIdSuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchLlmFeedbackGetFeedbackById,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateLlmFeedbackGetFeedbackById,
invalidateAllLlmFeedbackGetFeedbackById,
} from "@meetkai/mka1/react-query/llmFeedbackGetFeedbackById.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetFeedbackByIdRequest | ✔️ | The request object to use for the request. |
options | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<operations.GetFeedbackByIdResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
updateFeedback
Update or modify existing feedback for a chat completion. Change the rating from thumbs up to thumbs down (or vice versa), update the feedback description, or clear either field by passing null. All fields are optional in the request body: omit a field to keep its current value, provide a new value to update it, or pass null to clear it. Useful for allowing users to revise their feedback or add additional comments after initial submission.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.feedback.updateFeedback({
id: "<id>",
requestBody: {},
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackUpdateFeedback } from "@meetkai/mka1/funcs/llmFeedbackUpdateFeedback.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await llmFeedbackUpdateFeedback(sdk, {
id: "<id>",
requestBody: {},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmFeedbackUpdateFeedback failed:", res.error);
}
}
run();React hooks and utilities
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Mutation hook for triggering the API call.
useLlmFeedbackUpdateFeedbackMutation
} from "@meetkai/mka1/react-query/llmFeedbackUpdateFeedback.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.UpdateFeedbackRequest | ✔️ | The request object to use for the request. |
options | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<operations.UpdateFeedbackResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |