Skip to main content
POST
/
api
/
v1
/
llm
/
extract
Python (SDK)
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"
  }
}

Authorizations

Authorization
string
header
required

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>.

Body

multipart/form-data
model
string
required

ID of the model to use for extraction

schema
string
required

JSON Schema object or JSON string defining the structure of data to extract

file
file
required

The file to extract structured data from

metadata
string

Optional metadata as JSON object or JSON string

prompt
string

Optional custom system prompt to guide extraction

Response

200 - application/json

OK

Response from the extraction endpoint containing the extracted structured data and metadata about the extraction process.

success
boolean
required

Indicates whether the extraction request was successful

metadata
object
required

Metadata about the extraction request and execution

data
any

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.