Skip to content

Llm.Conversations ​

Overview ​

Available Operations ​

create ​

Create a conversation to store and retrieve conversation state across Response API calls.

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.conversations.create({
    createConversationRequest: {
      metadata: {
        "session_id": "sess_abc123",
        "user_type": "premium",
      },
    },
  });

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmConversationsCreate } from "@meetkai/mka1/funcs/llmConversationsCreate.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 llmConversationsCreate(sdk, {
    createConversationRequest: {
      metadata: {
        "session_id": "sess_abc123",
        "user_type": "premium",
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmConversationsCreate 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.
  useLlmConversationsCreateMutation
} from "@meetkai/mka1/react-query/llmConversationsCreate.js";

Parameters ​

ParameterTypeRequiredDescription
requestoperations.ConversationsCreateRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖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.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response ​

Promise<components.ConversationObject>

Errors ​

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

list ​

List all conversations for the authenticated user with pagination support.

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.conversations.list({
    after: "conv_abc123",
    order: "desc",
    metadata: {
      "user_type": "premium",
    },
    search: "weather forecast",
  });

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmConversationsList } from "@meetkai/mka1/funcs/llmConversationsList.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 llmConversationsList(sdk, {
    after: "conv_abc123",
    order: "desc",
    metadata: {
      "user_type": "premium",
    },
    search: "weather forecast",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmConversationsList 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.
  useLlmConversationsList,
  useLlmConversationsListSuspense,

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

Parameters ​

ParameterTypeRequiredDescription
requestoperations.ConversationsListRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖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.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response ​

Promise<components.ConversationListObject>

Errors ​

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

get ​

Get a conversation by ID.

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.conversations.get({
    conversationId: "conv_abc123",
  });

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

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

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

Parameters ​

ParameterTypeRequiredDescription
requestoperations.ConversationsRetrieveRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖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.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response ​

Promise<components.ConversationObject>

Errors ​

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

update ​

Update a conversation'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.conversations.update({
    conversationId: "conv_abc123",
    update: {
      metadata: {
        "session_id": "sess_abc123",
        "user_type": "premium",
        "status": "active",
      },
    },
  });

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmConversationsUpdate } from "@meetkai/mka1/funcs/llmConversationsUpdate.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 llmConversationsUpdate(sdk, {
    conversationId: "conv_abc123",
    update: {
      metadata: {
        "session_id": "sess_abc123",
        "user_type": "premium",
        "status": "active",
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmConversationsUpdate 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.
  useLlmConversationsUpdateMutation
} from "@meetkai/mka1/react-query/llmConversationsUpdate.js";

Parameters ​

ParameterTypeRequiredDescription
requestoperations.ConversationsUpdateRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖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.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response ​

Promise<components.ConversationObject>

Errors ​

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

delete ​

Delete a conversation. Items in the conversation will not be deleted.

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.conversations.delete({
    conversationId: "conv_abc123",
  });

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

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

Parameters ​

ParameterTypeRequiredDescription
requestoperations.ConversationsDeleteRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖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.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response ​

Promise<components.ConversationDeletedObject>

Errors ​

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

listItems ​

List all items for a conversation with the given ID.

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.conversations.listItems({
    conversationId: "conv_abc123",
    after: "item_abc123",
    include: [
      "content",
      "metadata",
    ],
    limit: 50,
    order: "desc",
  });

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmConversationsListItems } from "@meetkai/mka1/funcs/llmConversationsListItems.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 llmConversationsListItems(sdk, {
    conversationId: "conv_abc123",
    after: "item_abc123",
    include: [
      "content",
      "metadata",
    ],
    limit: 50,
    order: "desc",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmConversationsListItems 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.
  useLlmConversationsListItems,
  useLlmConversationsListItemsSuspense,

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

Parameters ​

ParameterTypeRequiredDescription
requestoperations.ConversationsItemsListRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖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.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response ​

Promise<operations.ConversationsItemsListResponseBody>

Errors ​

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

createItems ​

Create items in a conversation with the given ID.

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.conversations.createItems({
    conversationId: "conv_abc123",
    createItemsRequest: {
      items: [
        {
          type: "message",
          role: "user",
          content: "What is the weather today?",
        },
      ],
    },
  });

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmConversationsCreateItems } from "@meetkai/mka1/funcs/llmConversationsCreateItems.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 llmConversationsCreateItems(sdk, {
    conversationId: "conv_abc123",
    createItemsRequest: {
      items: [
        {
          type: "message",
          role: "user",
          content: "What is the weather today?",
        },
      ],
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmConversationsCreateItems 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.
  useLlmConversationsCreateItemsMutation
} from "@meetkai/mka1/react-query/llmConversationsCreateItems.js";

Parameters ​

ParameterTypeRequiredDescription
requestoperations.ConversationsItemsCreateRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖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.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response ​

Promise<operations.ConversationsItemsCreateResponseBody>

Errors ​

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

deleteItems ​

Delete multiple items from a conversation with the given ID.

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.conversations.deleteItems({
    conversationId: "conv_abc123",
    requestBody: {
      itemIds: [
        "item_abc123",
      ],
    },
  });

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmConversationsDeleteItems } from "@meetkai/mka1/funcs/llmConversationsDeleteItems.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 llmConversationsDeleteItems(sdk, {
    conversationId: "conv_abc123",
    requestBody: {
      itemIds: [
        "item_abc123",
      ],
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmConversationsDeleteItems 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.
  useLlmConversationsDeleteItemsMutation
} from "@meetkai/mka1/react-query/llmConversationsDeleteItems.js";

Parameters ​

ParameterTypeRequiredDescription
requestoperations.ConversationsItemsDeleteManyRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖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.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response ​

Promise<components.ConversationObject>

Errors ​

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

getItem ​

Get a single item from a conversation with the given IDs.

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.conversations.getItem({
    conversationId: "conv_abc123",
    itemId: "item_abc123",
  });

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

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

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

Parameters ​

ParameterTypeRequiredDescription
requestoperations.ConversationsItemsRetrieveRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖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.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response ​

Promise<operations.ConversationsItemsRetrieveResponseBody>

Errors ​

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

deleteItem ​

Delete an item from a conversation with the given ID.

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.conversations.deleteItem({
    conversationId: "conv_abc123",
    itemId: "item_abc123",
  });

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

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

Parameters ​

ParameterTypeRequiredDescription
requestoperations.ConversationsItemsDeleteRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖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.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response ​

Promise<components.ConversationObject>

Errors ​

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