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
| Field | Type | Required | Description |
|---|---|---|---|
model | string | ✔️ | 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. |
schema | components.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. |
metadata | components.DirectExtractionRequestMetadata | ➖ | Optional 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. |
file | string | ✔️ | 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. |
prompt | string | ➖ | Optional 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. |