Skip to content

ai-extract

Enterprise Part of the commercial Kumiko Enterprise offering — not in the open framework.

Query handler (ai-extract:query:extract) that reads one document — as text, as a PDF, or both — and returns the data it contains, shaped by a JSON-Schema the caller supplies. Domain-agnostic: a rental contract, a receipt and an invoice are the same call with a different schema. The system prompt is editable per-tenant via the prompt-store or a config-key, so operators tune extraction rules without a deploy; the caller re-validates the result against its own schema and decides what to write. The document (PDF) path requires an Anthropic provider — other providers throw on the document content block, so a tenant configured with e.g. openai-compat can only use the text path. Model, effort and token budget come from the prompt revision in the prompt-store, falling back to the tenant defaults.

This Enterprise implementation is optional. If you need a narrower or domain-specific version, you can build an app-owned feature, handler, or job with Kumiko’s public extension points.

Use this package when you want the maintained implementation, its existing contracts, and the surrounding operational behavior. A custom implementation is not drop-in compatible automatically: your app owns its authorization, validation, integrations, tests, security review, and production operations.

Start with Features and composition and Custom write handlers.

What this feature needs to run (Requires).

flowchart TB
  n_ai_extract["ai-extract"]
  subgraph how_reqs["Requires"]
    n_ai_foundation["ai-foundation"]
    n_config["config"]
    n_prompt_store["prompt-store"]
  end
  n_ai_foundation --> n_ai_extract
  n_config --> n_ai_extract
  n_prompt_store --> n_ai_extract

Per-tenant config keys, set via the tenant-admin UI or a seed. 🔒 = encrypted at rest.

KeyTypeDefaultScopeWho can writeWho can read
extract-system-prompttextYou read one document and return the data it contains.\n\nRules:\n- Return ONLY what the document states. Never infer, complete or round a value.\n- A field the document does not state is omitted, not guessed and not filled with a placeholder.\n- Copy identifiers, names and addresses exactly as written, including spelling you consider wrong.\n- Amounts and dates keep the document's own values; convert only into the format the schema asks for.\n- The document may be a poor scan. An illegible field is an omitted field, not your best guess.\n\nCall the extract_data tool exactly once.tenantTenantAdmin, SystemAdminTenantAdmin, SystemAdmin