ExtractT
(llm.extract)
Overview
Available Operations
- createExtractSchema - Create reusable extraction schema template
- getExtractSchema - Get extraction schema by ID
- updateExtractSchema - Update extraction schema by ID
- deleteExtractSchema - Delete extraction schema by ID
createExtractSchema
Create and store a reusable JSON Schema template for structured data extraction. Define the schema structure, add a descriptive name (1-100 chars), optional description (max 500 chars), and custom metadata for your extraction use case. Once created, the schema can be referenced by ID for consistent extraction across multiple files. Useful for building libraries of extraction templates for different document types (invoices, receipts, forms, contracts, etc.). The schema is validated before storage to ensure it's a valid JSON Schema structure.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.extract.createExtractSchema({
name: "<value>",
schema: {
"key": "<value>",
"key1": "<value>",
"key2": "<value>",
},
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmExtractCreateExtractSchema } from "@meetkai/mka1/funcs/llmExtractCreateExtractSchema.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 llmExtractCreateExtractSchema(sdk, {
name: "<value>",
schema: {
"key": "<value>",
"key1": "<value>",
"key2": "<value>",
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmExtractCreateExtractSchema 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.
useLlmExtractCreateExtractSchemaMutation
} from "@meetkai/mka1/react-query/llmExtractCreateExtractSchema.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.CreateExtractSchemaRequestBody | ✔️ | 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.CreateExtractSchemaResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
getExtractSchema
Retrieve a stored extraction schema and its metadata.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.extract.getExtractSchema({
schemaId: "<id>",
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmExtractGetExtractSchema } from "@meetkai/mka1/funcs/llmExtractGetExtractSchema.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 llmExtractGetExtractSchema(sdk, {
schemaId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmExtractGetExtractSchema 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.
useLlmExtractGetExtractSchema,
useLlmExtractGetExtractSchemaSuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchLlmExtractGetExtractSchema,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateLlmExtractGetExtractSchema,
invalidateAllLlmExtractGetExtractSchema,
} from "@meetkai/mka1/react-query/llmExtractGetExtractSchema.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetExtractSchemaRequest | ✔️ | 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.GetExtractSchemaResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
updateExtractSchema
Update an existing extraction schema and its metadata.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.extract.updateExtractSchema({
schemaId: "<id>",
requestBody: {},
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmExtractUpdateExtractSchema } from "@meetkai/mka1/funcs/llmExtractUpdateExtractSchema.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 llmExtractUpdateExtractSchema(sdk, {
schemaId: "<id>",
requestBody: {},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmExtractUpdateExtractSchema 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.
useLlmExtractUpdateExtractSchemaMutation
} from "@meetkai/mka1/react-query/llmExtractUpdateExtractSchema.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.UpdateExtractSchemaRequest | ✔️ | 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.UpdateExtractSchemaResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |
deleteExtractSchema
Remove a stored extraction schema.
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.extract.deleteExtractSchema({
schemaId: "<id>",
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmExtractDeleteExtractSchema } from "@meetkai/mka1/funcs/llmExtractDeleteExtractSchema.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 llmExtractDeleteExtractSchema(sdk, {
schemaId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("llmExtractDeleteExtractSchema 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.
useLlmExtractDeleteExtractSchemaMutation
} from "@meetkai/mka1/react-query/llmExtractDeleteExtractSchema.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.DeleteExtractSchemaRequest | ✔️ | 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.DeleteExtractSchemaResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.APIError | 4XX, 5XX | */* |