Skip to content

DirectExtractionRequest

Request parameters for direct extraction with an inline schema. Extracts structured data from a file according to the provided JSON Schema definition.

Example Usage

typescript
import { DirectExtractionRequest } from "@meetkai/mka1/models/components";

let value: DirectExtractionRequest = {
  model: "openai:gpt-4o",
  schema: {
    "type": "object",
    "properties": {
      "invoice_number": {
        "type": "string",
      },
      "total_amount": {
        "type": "number",
      },
      "date": {
        "type": "string",
      },
    },
  },
  file: "<value>",
};

Fields

FieldTypeRequiredDescription
modelstring✔️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.
schemacomponents.Schema✔️JSON Schema object defining the structure of data to extract from the file. Can be provided as a JSON object or a JSON string (for FormData submissions). The model will extract data matching this schema structure.
metadatacomponents.DirectExtractionRequestMetadataOptional metadata providing additional context for the extraction. Can be a JSON object or JSON string. Use this to provide hints, domain knowledge, or additional instructions to improve extraction accuracy.
filestring✔️The file to extract structured data from. Supports various formats including images (PNG, JPG, etc.) and documents (PDF, etc.). The file content will be analyzed by the model.
promptstringOptional custom system prompt to guide the extraction process. Use this to provide specific instructions about how to interpret the file or what to prioritize during extraction.