Saltar al contenido

Playground

Extracción de factura: ¿número e importe?

¿Cuál es el número y el importe de la factura? Clairic extrae ambos del texto. Si el total a pagar dice «to be confirmed», el importe vuelve null: Clairic devuelve null cuando la entrada no determina un valor; el número sí se extrae.

Los resultados de ejemplo no cambian con el modelo seleccionado.

Facturación de Clairic: cada 4 KB de contenido de petición cuenta como un bloque, y menos de 4 KB también; 2 créditos por bloque. Se cobra una vez por petición, sin importar cuántos campos extraigas.

Solicitud

state
text/plain
INVOICE INV-2291From: Northwind SupplyTo: Contoso LtdIssued: 2026-09-02Total due: 1080.00

Campos

fields
application/json
{  "invoice_number": {    "type": "text",    "instructions": "The invoice id printed on the document."  },  "amount": {    "type": "number",    "instructions": "The total amount due. Do not invent a currency symbol."  }}

Resultados

Datos de ejemplo
Comparar dos ejemplos

Estos dos ejemplos difieren en un solo detalle. El resultado cambia con ellos.

Qué cambióFactura completa → importe ausente

Estos resultados son datos de ejemplo, no una ejecución en vivo. Inicia sesión para probarlos con tu contenido.
invoice_number: INV-4402 → INV-2291 amount: null → 1080
invoice_numbertext
INV-2291Valor
Confidence del proveedor0.99
Probabilidad de que falte0.01
amountnumber
1080Valor
Confidence del proveedor0.96
Probabilidad de que falte0.02

Copiar el código

Configura SYSTEM_ONE_API_KEY. El fragmento usa un ID de modelo publicado en el catálogo.

JSON de la solicitud
application/json
{"model":"clairic","state":"INVOICE INV-2291\nFrom: Northwind Supply\nTo: Contoso Ltd\nIssued: 2026-09-02\nTotal due: 1080.00","fields":{"invoice_number":{"type":"text","instructions":"The invoice id printed on the document."},"amount":{"type":"number","instructions":"The total amount due. Do not invent a currency symbol."}}}
cURL · POST /v1/systemone
sh
curl "https://system-one.dev/v1/systemone" \  -H "Authorization: Bearer $SYSTEM_ONE_API_KEY" \  -H 'Content-Type: application/json' \  -H 'Idempotency-Key: saved-operation-id' \  --data '{"model":"clairic","state":"INVOICE INV-2291\nFrom: Northwind Supply\nTo: Contoso Ltd\nIssued: 2026-09-02\nTotal due: 1080.00","fields":{"invoice_number":{"type":"text","instructions":"The invoice id printed on the document."},"amount":{"type":"number","instructions":"The total amount due. Do not invent a currency symbol."}}}'
TypeScript
TypeScript
// npm install @system-one-ai/core@0.8.0 @system-one-ai/adapter-system-one@0.7.0 @system-one-ai/transport-fetch@0.8.0import { createSystemOne } from '@system-one-ai/core';import { systemOneAdapter } from '@system-one-ai/adapter-system-one';import { createFetchTransport } from '@system-one-ai/transport-fetch';const client = createSystemOne({  baseURL: "https://system-one.dev/v1",  apiKey: process.env.SYSTEM_ONE_API_KEY!,  model: "clairic",  adapter: systemOneAdapter,  transport: createFetchTransport(),  timeoutMs: 30_000,  maxRetries: 0,});const result = await client.extract({  model: "clairic",  state: "INVOICE INV-2291\nFrom: Northwind Supply\nTo: Contoso Ltd\nIssued: 2026-09-02\nTotal due: 1080.00",  fields: {    "invoice_number": {      "type": "text",      "instructions": "The invoice id printed on the document."    },    "amount": {      "type": "number",      "instructions": "The total amount due. Do not invent a currency symbol."    }  },}, { headers: { 'Idempotency-Key': crypto.randomUUID() } });result.answers.invoice_number.valueresult.answers.amount.valueresult.response.requestId;