Llm.Usage
Overview
Available Operations
- completions - Get completions usage
- responses - Get responses usage
- conversations - Get conversations usage
- embeddings - Get embeddings usage
- extract - Get extract usage
- classify - Get classify usage
- vectorStores - Get vector stores usage
completions
Retrieve usage metrics for chat completions, aggregated from the ChatCompletion table.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.usage.completions({
startTime: 931664,
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmUsageCompletions } from "@meetkai/mka1/funcs/llmUsageCompletions.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await llmUsageCompletions(sdk, {
startTime: 931664,
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmUsageCompletions 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.
useLlmUsageCompletions,
useLlmUsageCompletionsSuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchLlmUsageCompletions,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateLlmUsageCompletions,
invalidateAllLlmUsageCompletions,
} from "@meetkai/mka1/react-query/llmUsageCompletions.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetCompletionsUsageRequest | ✔️ | 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.GetCompletionsUsageResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
responses
Retrieve usage metrics for agent responses, aggregated from the Response table.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.usage.responses({
startTime: 177134,
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmUsageResponses } from "@meetkai/mka1/funcs/llmUsageResponses.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await llmUsageResponses(sdk, {
startTime: 177134,
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmUsageResponses 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.
useLlmUsageResponses,
useLlmUsageResponsesSuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchLlmUsageResponses,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateLlmUsageResponses,
invalidateAllLlmUsageResponses,
} from "@meetkai/mka1/react-query/llmUsageResponses.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetResponsesUsageRequest | ✔️ | 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.GetResponsesUsageResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
conversations
Retrieve usage metrics for conversation operations.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.usage.conversations({
startTime: 491612,
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmUsageConversations } from "@meetkai/mka1/funcs/llmUsageConversations.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await llmUsageConversations(sdk, {
startTime: 491612,
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmUsageConversations 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.
useLlmUsageConversations,
useLlmUsageConversationsSuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchLlmUsageConversations,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateLlmUsageConversations,
invalidateAllLlmUsageConversations,
} from "@meetkai/mka1/react-query/llmUsageConversations.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetConversationsUsageRequest | ✔️ | 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.GetConversationsUsageResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
embeddings
Retrieve usage metrics for embedding operations.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.usage.embeddings({
startTime: 314280,
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmUsageEmbeddings } from "@meetkai/mka1/funcs/llmUsageEmbeddings.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await llmUsageEmbeddings(sdk, {
startTime: 314280,
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmUsageEmbeddings 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.
useLlmUsageEmbeddings,
useLlmUsageEmbeddingsSuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchLlmUsageEmbeddings,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateLlmUsageEmbeddings,
invalidateAllLlmUsageEmbeddings,
} from "@meetkai/mka1/react-query/llmUsageEmbeddings.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetEmbeddingsUsageRequest | ✔️ | 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.GetEmbeddingsUsageResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
extract
Retrieve usage metrics for extract operations.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.usage.extract({
startTime: 354327,
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmUsageExtract } from "@meetkai/mka1/funcs/llmUsageExtract.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await llmUsageExtract(sdk, {
startTime: 354327,
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmUsageExtract 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.
useLlmUsageExtract,
useLlmUsageExtractSuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchLlmUsageExtract,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateLlmUsageExtract,
invalidateAllLlmUsageExtract,
} from "@meetkai/mka1/react-query/llmUsageExtract.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetExtractUsageRequest | ✔️ | 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.GetExtractUsageResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
classify
Retrieve usage metrics for classify operations.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.usage.classify({
startTime: 358473,
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmUsageClassify } from "@meetkai/mka1/funcs/llmUsageClassify.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await llmUsageClassify(sdk, {
startTime: 358473,
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmUsageClassify 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.
useLlmUsageClassify,
useLlmUsageClassifySuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchLlmUsageClassify,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateLlmUsageClassify,
invalidateAllLlmUsageClassify,
} from "@meetkai/mka1/react-query/llmUsageClassify.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetClassifyUsageRequest | ✔️ | 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.GetClassifyUsageResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
vectorStores
Retrieve usage metrics for vector storage operations.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.usage.vectorStores({
startTime: 142664,
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmUsageVectorStores } from "@meetkai/mka1/funcs/llmUsageVectorStores.js";
// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
serverURL: "https://api.example.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await llmUsageVectorStores(sdk, {
startTime: 142664,
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmUsageVectorStores 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.
useLlmUsageVectorStores,
useLlmUsageVectorStoresSuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchLlmUsageVectorStores,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateLlmUsageVectorStores,
invalidateAllLlmUsageVectorStores,
} from "@meetkai/mka1/react-query/llmUsageVectorStores.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetVectorStoresUsageRequest | ✔️ | 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.GetVectorStoresUsageResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |