from openapi import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.extract.create_schema(name="Invoice Extraction", schema={
"type": "object",
"properties": {
"invoice_number": {
"type": "string",
},
"vendor_name": {
"type": "string",
},
"total_amount": {
"type": "number",
},
"date": {
"type": "string",
"format": "date",
},
},
"required": [
"invoice_number",
"total_amount",
],
}, description="Schema for extracting invoice data from PDF documents", metadata={
"document_type": "invoice",
})
# Handle response
print(res){
"success": true,
"data": {
"id": "schema_invoice_123",
"name": "Invoice Extraction",
"description": "Schema for extracting invoice data from PDF documents",
"schema": {
"type": "object",
"properties": {
"invoice_number": {
"type": "string"
},
"vendor_name": {
"type": "string"
},
"total_amount": {
"type": "number"
},
"date": {
"type": "string",
"format": "date"
}
},
"required": [
"invoice_number",
"total_amount"
]
},
"metadata": {
"document_type": "invoice"
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
}Crea y almacena una plantilla de esquema JSON reutilizable para la extracción de datos estructurados.
from openapi import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.extract.create_schema(name="Invoice Extraction", schema={
"type": "object",
"properties": {
"invoice_number": {
"type": "string",
},
"vendor_name": {
"type": "string",
},
"total_amount": {
"type": "number",
},
"date": {
"type": "string",
"format": "date",
},
},
"required": [
"invoice_number",
"total_amount",
],
}, description="Schema for extracting invoice data from PDF documents", metadata={
"document_type": "invoice",
})
# Handle response
print(res){
"success": true,
"data": {
"id": "schema_invoice_123",
"name": "Invoice Extraction",
"description": "Schema for extracting invoice data from PDF documents",
"schema": {
"type": "object",
"properties": {
"invoice_number": {
"type": "string"
},
"vendor_name": {
"type": "string"
},
"total_amount": {
"type": "number"
},
"date": {
"type": "string",
"format": "date"
}
},
"required": [
"invoice_number",
"total_amount"
]
},
"metadata": {
"document_type": "invoice"
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "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>.
Definición de esquema para crear una plantilla de extracción reutilizable. Los esquemas de extracción definen la estructura y las reglas de validación para la extracción de datos de archivos.
Nombre del esquema de extracción. Debe tener entre 1 y 100 caracteres. Se utiliza para identificar y hacer referencia al esquema.
1 - 100Esquema JSON que define la estructura de los datos a extraer. Especifica los campos, tipos y reglas de validación para los datos extraídos.
Show child attributes
Descripción opcional del esquema. Máximo 500 caracteres. Ayuda a documentar el propósito y uso del esquema.
500Metadatos opcionales para el esquema. Puede almacenar información adicional como versión, autor o propiedades personalizadas.
Show child attributes
¿Esta página le ayudó?