Skip to content

Llm.Feedback

Overview

Available Operations

createCompletionFeedback

Submit user feedback for a specific chat completion to track satisfaction and model performance. Each completion can only receive feedback once.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.feedback.createCompletionFeedback({
    id: "chatcmpl-abc123def456",
    rating: "thumbs_up",
    description: "The response was accurate and helpful.",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackCreateCompletionFeedback } from "@meetkai/mka1/funcs/llmFeedbackCreateCompletionFeedback.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 llmFeedbackCreateCompletionFeedback(sdk, {
    id: "chatcmpl-abc123def456",
    rating: "thumbs_up",
    description: "The response was accurate and helpful.",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFeedbackCreateCompletionFeedback 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.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmFeedbackCreateCompletionFeedbackMutation
} from "@meetkai/mka1/react-query/llmFeedbackCreateCompletionFeedback.js";

Parameters

ParameterTypeRequiredDescription
requestcomponents.CreateFeedbackRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.CreateFeedbackResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

getCompletionFeedback

Retrieves the existing feedback rating and description for a specific chat completion.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.feedback.getCompletionFeedback({
    id: "chatcmpl-abc123def456",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackGetCompletionFeedback } from "@meetkai/mka1/funcs/llmFeedbackGetCompletionFeedback.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 llmFeedbackGetCompletionFeedback(sdk, {
    id: "chatcmpl-abc123def456",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFeedbackGetCompletionFeedback 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.

tsx
import {
  // Query hooks for fetching data.
  useLlmFeedbackGetCompletionFeedback,
  useLlmFeedbackGetCompletionFeedbackSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchLlmFeedbackGetCompletionFeedback,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateLlmFeedbackGetCompletionFeedback,
  invalidateAllLlmFeedbackGetCompletionFeedback,
} from "@meetkai/mka1/react-query/llmFeedbackGetCompletionFeedback.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.GetCompletionFeedbackRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.GetFeedbackResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

updateCompletionFeedback

Updates or modifies existing feedback for a specific chat completion. Useful for allowing users to revise their initial submissions.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.feedback.updateCompletionFeedback({
    id: "chatcmpl-abc123def456",
    requestBody: {
      rating: "thumbs_down",
      description: "Could be more detailed.",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackUpdateCompletionFeedback } from "@meetkai/mka1/funcs/llmFeedbackUpdateCompletionFeedback.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 llmFeedbackUpdateCompletionFeedback(sdk, {
    id: "chatcmpl-abc123def456",
    requestBody: {
      rating: "thumbs_down",
      description: "Could be more detailed.",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFeedbackUpdateCompletionFeedback 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.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmFeedbackUpdateCompletionFeedbackMutation
} from "@meetkai/mka1/react-query/llmFeedbackUpdateCompletionFeedback.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.UpdateCompletionFeedbackRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.UpdateFeedbackResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

batchGetCompletionFeedback

Retrieves feedback for multiple chat completions in a single batch request.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.feedback.batchGetCompletionFeedback({
    ids: [
      "chatcmpl-abc123def456",
      "chatcmpl-missing123",
    ],
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackBatchGetCompletionFeedback } from "@meetkai/mka1/funcs/llmFeedbackBatchGetCompletionFeedback.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 llmFeedbackBatchGetCompletionFeedback(sdk, {
    ids: [
      "chatcmpl-abc123def456",
      "chatcmpl-missing123",
    ],
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFeedbackBatchGetCompletionFeedback 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.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmFeedbackBatchGetCompletionFeedbackMutation
} from "@meetkai/mka1/react-query/llmFeedbackBatchGetCompletionFeedback.js";

Parameters

ParameterTypeRequiredDescription
requestcomponents.BatchGetFeedbackRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.BatchGetFeedbackResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

createResponseFeedback

Submit user feedback for a specific agent response to track satisfaction and model performance. Each response can only receive feedback once.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.feedback.createResponseFeedback({
    id: "resp-xyz789",
    rating: "thumbs_down",
    description: "The response missed key details.",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackCreateResponseFeedback } from "@meetkai/mka1/funcs/llmFeedbackCreateResponseFeedback.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 llmFeedbackCreateResponseFeedback(sdk, {
    id: "resp-xyz789",
    rating: "thumbs_down",
    description: "The response missed key details.",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFeedbackCreateResponseFeedback 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.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmFeedbackCreateResponseFeedbackMutation
} from "@meetkai/mka1/react-query/llmFeedbackCreateResponseFeedback.js";

Parameters

ParameterTypeRequiredDescription
requestcomponents.CreateFeedbackRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.CreateFeedbackResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

getResponseFeedback

Retrieves the existing feedback rating and description for a specific agent response.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.feedback.getResponseFeedback({
    id: "resp-xyz789",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackGetResponseFeedback } from "@meetkai/mka1/funcs/llmFeedbackGetResponseFeedback.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 llmFeedbackGetResponseFeedback(sdk, {
    id: "resp-xyz789",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFeedbackGetResponseFeedback 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.

tsx
import {
  // Query hooks for fetching data.
  useLlmFeedbackGetResponseFeedback,
  useLlmFeedbackGetResponseFeedbackSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchLlmFeedbackGetResponseFeedback,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateLlmFeedbackGetResponseFeedback,
  invalidateAllLlmFeedbackGetResponseFeedback,
} from "@meetkai/mka1/react-query/llmFeedbackGetResponseFeedback.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.GetResponseFeedbackRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.GetFeedbackResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

updateResponseFeedback

Updates or modifies existing feedback for a specific agent response. Useful for allowing users to revise their initial submissions.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.feedback.updateResponseFeedback({
    id: "resp-xyz789",
    requestBody: {
      rating: "thumbs_up",
      description: "Updated after retry, now good.",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackUpdateResponseFeedback } from "@meetkai/mka1/funcs/llmFeedbackUpdateResponseFeedback.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 llmFeedbackUpdateResponseFeedback(sdk, {
    id: "resp-xyz789",
    requestBody: {
      rating: "thumbs_up",
      description: "Updated after retry, now good.",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFeedbackUpdateResponseFeedback 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.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmFeedbackUpdateResponseFeedbackMutation
} from "@meetkai/mka1/react-query/llmFeedbackUpdateResponseFeedback.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.UpdateResponseFeedbackRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.UpdateFeedbackResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

batchGetResponseFeedback

Retrieves feedback for multiple agent responses in a single batch request.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.feedback.batchGetResponseFeedback({
    ids: [
      "resp-xyz789",
      "resp-missing123",
    ],
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackBatchGetResponseFeedback } from "@meetkai/mka1/funcs/llmFeedbackBatchGetResponseFeedback.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 llmFeedbackBatchGetResponseFeedback(sdk, {
    ids: [
      "resp-xyz789",
      "resp-missing123",
    ],
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFeedbackBatchGetResponseFeedback 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.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmFeedbackBatchGetResponseFeedbackMutation
} from "@meetkai/mka1/react-query/llmFeedbackBatchGetResponseFeedback.js";

Parameters

ParameterTypeRequiredDescription
requestcomponents.BatchGetFeedbackRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.BatchGetFeedbackResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

startExport

Starts a background job to export all feedback data to parquet files in S3/R2. Only one export can run simultaneously.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.feedback.startExport();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackStartExport } from "@meetkai/mka1/funcs/llmFeedbackStartExport.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 llmFeedbackStartExport(sdk);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFeedbackStartExport 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.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmFeedbackStartExportMutation
} from "@meetkai/mka1/react-query/llmFeedbackStartExport.js";

Parameters

ParameterTypeRequiredDescription
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.StartExportFeedbackResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

getExportStatus

Checks the status and progress of the currently running or most recently completed feedback export job.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.feedback.getExportStatus();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmFeedbackGetExportStatus } from "@meetkai/mka1/funcs/llmFeedbackGetExportStatus.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 llmFeedbackGetExportStatus(sdk);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmFeedbackGetExportStatus 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.

tsx
import {
  // Query hooks for fetching data.
  useLlmFeedbackGetExportStatus,
  useLlmFeedbackGetExportStatusSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchLlmFeedbackGetExportStatus,
  
  // Utility to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateAllLlmFeedbackGetExportStatus,
} from "@meetkai/mka1/react-query/llmFeedbackGetExportStatus.js";

Parameters

ParameterTypeRequiredDescription
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions 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.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.GetExportStatusResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*