from mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.extract.extract_with_schema(schema_id="schema_invoice_123", model="meetkai:functionary-urdu-mini-pak", file={
"file_name": "example.file",
"content": open("example.file", "rb"),
}, prompt="Extract the structured invoice fields.")
# Handle response
print(res){
"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.
from mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.extract.extract_with_schema(schema_id="schema_invoice_123", model="meetkai:functionary-urdu-mini-pak", file={
"file_name": "example.file",
"content": open("example.file", "rb"),
}, prompt="Extract the structured invoice fields.")
# Handle response
print(res){
"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"
}
}Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.
The unique identifier of the extraction schema to use for this extraction
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?