import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.extract.extractWithSchema({
schemaId: "schema_invoice_123",
requestBody: {
model: "meetkai:functionary-urdu-mini-pak",
file: "(binary)",
prompt: "Extract the structured invoice fields.",
},
});
console.log(result);
}
run();{
"success": true,
"data": {
"invoice_number": "INV-2024-001",
"vendor_name": "Acme Corporation",
"total_amount": 1250,
"date": "2024-01-15"
},
"metadata": {
"model": "meetkai:functionary-urdu-mini-pak",
"filename": "invoice.pdf",
"fileSize": 125000,
"extractedAt": "2024-01-15T10:30:00Z",
"schemaId": "schema_invoice_123",
"schemaName": "Invoice Extraction"
}
}Extracts structured data from files using a previously saved extraction schema template.
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.extract.extractWithSchema({
schemaId: "schema_invoice_123",
requestBody: {
model: "meetkai:functionary-urdu-mini-pak",
file: "(binary)",
prompt: "Extract the structured invoice fields.",
},
});
console.log(result);
}
run();{
"success": true,
"data": {
"invoice_number": "INV-2024-001",
"vendor_name": "Acme Corporation",
"total_amount": 1250,
"date": "2024-01-15"
},
"metadata": {
"model": "meetkai:functionary-urdu-mini-pak",
"filename": "invoice.pdf",
"fileSize": 125000,
"extractedAt": "2024-01-15T10:30:00Z",
"schemaId": "schema_invoice_123",
"schemaName": "Invoice Extraction"
}
}Authenticate with your MKA1 API key at the API gateway: Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, also send X-On-Behalf-Of to identify the end user making the request.
Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.
The unique identifier of the extraction schema to use for this extraction
The extraction request parameters
ID of the model to use for extraction. You can use provider:model format or just the model name with a default provider. Vision-capable models are recommended for processing images and PDFs.
1The file to extract structured data from. Supports various formats including images and documents. The file content will be analyzed by the model according to the referenced extraction schema.
Optional custom system prompt to guide the extraction process. Use this to provide specific instructions about how to interpret the file or handle edge cases.
OK
Response from the extraction endpoint containing the extracted structured data and metadata about the extraction process.
Indicates whether the extraction request was successful
Metadata about the extraction request and execution
Show child attributes
The extracted structured data conforming to the provided JSON Schema. This is the result of analyzing the file and extracting information according to the schema definition.
Was this page helpful?