from mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.extract.extract(model="meetkai:functionary-urdu-mini-pak", schema="[object Object]", file={
"file_name": "example.file",
"content": open("example.file", "rb"),
}, prompt="Extract invoice number, vendor, total, and date from this invoice.")
# 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"
}
}Extracts structured data from files using a custom inline JSON schema.
from mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.extract.extract(model="meetkai:functionary-urdu-mini-pak", schema="[object Object]", file={
"file_name": "example.file",
"content": open("example.file", "rb"),
}, prompt="Extract invoice number, vendor, total, and date from this invoice.")
# 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"
}
}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>.
ID of the model to use for extraction
JSON Schema object or JSON string defining the structure of data to extract
The file to extract structured data from
Optional metadata as JSON object or JSON string
Optional custom system prompt to guide 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?