Skip to content

Llm.Responses

Overview

Available Operations

  • create - Create an agent-powered response with tool support
  • list - List all responses with pagination
  • get - Retrieve response by ID with status and results
  • update - Update a response
  • delete - Permanently delete a response and its data
  • cancel - Cancel an in-progress background response
  • listInputItems - List paginated input items for a response
  • compact - Compact a conversation

create

Creates a new AI agent response using advanced language models with autonomous tool usage capabilities.

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.responses.create({
    model: "meetkai:functionary-urdu-mini-pak",
    input: "What is the capital of France?",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmResponsesCreate } from "@meetkai/mka1/funcs/llmResponsesCreate.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 llmResponsesCreate(sdk, {
    model: "meetkai:functionary-urdu-mini-pak",
    input: "What is the capital of France?",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmResponsesCreate 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.
  useLlmResponsesCreateMutation
} from "@meetkai/mka1/react-query/llmResponsesCreate.js";

Parameters

ParameterTypeRequiredDescription
requestcomponents.ResponsesCreateRequest✔️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<operations.CreateResponseResponse>

Errors

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

list

Retrieves a paginated list of all agent responses for the authenticated user.

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.responses.list({
    after: "resp_abc123",
    before: "resp_xyz789",
    limit: 25,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmResponsesList } from "@meetkai/mka1/funcs/llmResponsesList.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 llmResponsesList(sdk, {
    after: "resp_abc123",
    before: "resp_xyz789",
    limit: 25,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmResponsesList 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.
  useLlmResponsesList,
  useLlmResponsesListSuspense,

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

Parameters

ParameterTypeRequiredDescription
requestoperations.ListResponsesRequest✔️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.ResponseListObject>

Errors

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

get

Retrieves a previously created agent response by its unique ID. When stream=true, returns Server-Sent Events for real-time updates on in-progress background responses.

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.responses.get({
    responseId: "resp_get123",
    include: [
      "file_search_call.results",
      "message.output_text.logprobs",
    ],
    includeObfuscation: false,
    startingAfter: 42,
    stream: false,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmResponsesGet } from "@meetkai/mka1/funcs/llmResponsesGet.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 llmResponsesGet(sdk, {
    responseId: "resp_get123",
    include: [
      "file_search_call.results",
      "message.output_text.logprobs",
    ],
    includeObfuscation: false,
    startingAfter: 42,
    stream: false,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmResponsesGet 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.
  useLlmResponsesGet,
  useLlmResponsesGetSuspense,

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

Parameters

ParameterTypeRequiredDescription
requestoperations.GetResponseRequest✔️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<operations.GetResponseResponse>

Errors

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

update

Update a response's metadata.

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.responses.update({
    responseId: "resp_abc123",
    updateResponseRequest: {
      metadata: {
        "status": "reviewed",
        "reviewer": "john_doe",
      },
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmResponsesUpdate } from "@meetkai/mka1/funcs/llmResponsesUpdate.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 llmResponsesUpdate(sdk, {
    responseId: "resp_abc123",
    updateResponseRequest: {
      metadata: {
        "status": "reviewed",
        "reviewer": "john_doe",
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmResponsesUpdate 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.
  useLlmResponsesUpdateMutation
} from "@meetkai/mka1/react-query/llmResponsesUpdate.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.UpdateResponseRequest✔️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.ResponseObject>

Errors

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

delete

Permanently deletes an agent response and all associated data.

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.responses.delete({
    responseId: "resp_abc123",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

Parameters

ParameterTypeRequiredDescription
requestoperations.DeleteResponseRequest✔️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.DeleteResponseObject>

Errors

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

cancel

Cancels an agent response that is currently processing in the background.

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.responses.cancel({
    responseId: "resp_cancel123",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

Parameters

ParameterTypeRequiredDescription
requestoperations.CancelResponseRequest✔️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.ResponseObject>

Errors

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

listInputItems

Retrieves a paginated list of all input items provided when creating the specified 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.responses.listInputItems({
    responseId: "resp_abc123",
    after: "item_abc123",
    include: [
      "file_search_call.results",
    ],
    limit: 50,
    order: "asc",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmResponsesListInputItems } from "@meetkai/mka1/funcs/llmResponsesListInputItems.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 llmResponsesListInputItems(sdk, {
    responseId: "resp_abc123",
    after: "item_abc123",
    include: [
      "file_search_call.results",
    ],
    limit: 50,
    order: "asc",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmResponsesListInputItems 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.
  useLlmResponsesListInputItems,
  useLlmResponsesListInputItemsSuspense,

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

Parameters

ParameterTypeRequiredDescription
requestoperations.ListInputItemsRequest✔️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.InputItemListObject>

Errors

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

compact

Creates a compacted summary of the conversation history for a response, reducing context size while preserving key information. Returns a compacted response object.

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.responses.compact({
    model: "meetkai:functionary-urdu-mini-pak",
    previousResponseId: "resp_abc123",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmResponsesCompact } from "@meetkai/mka1/funcs/llmResponsesCompact.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 llmResponsesCompact(sdk, {
    model: "meetkai:functionary-urdu-mini-pak",
    previousResponseId: "resp_abc123",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmResponsesCompact 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.
  useLlmResponsesCompactMutation
} from "@meetkai/mka1/react-query/llmResponsesCompact.js";

Parameters

ParameterTypeRequiredDescription
requestcomponents.CompactResponseRequest✔️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.CompactedResponse>

Errors

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