Skip to main content
ExtractPrompt stores named, versioned AI extraction prompt templates that drive the document-extraction pipeline when ingesting invoices and documents. Each record is scoped to a type (e.g. the extraction category), carries the raw prompt text, a monotone version counter, an is_active flag, and an is_default flag marking the system-wide fallback. Records are either workspace-scoped (a workspace-level customisation) or global (no workspace FK, is_default = true). The entity is owned exclusively by the extraction pipeline and seed layer; no user-facing PATCH endpoint exists.
Internal object. Not currently exposed on the public REST API. The operations below describe the intended contract.

API operations

Data model

Attributes

Relationships

System-computed

  • id (pk): generated by gen_random_uuid() at INSERT time; immutable.
  • version: defaults to 1; incremented by the extraction pipeline or seed layer on prompt revision — not auto-incremented by the DB.
  • is_active: defaults to false; toggled by the pipeline when promoting a new prompt version.
  • is_default: defaults to false; set by the seed layer for system-wide baseline prompts.
  • created_at: set by MikroORM onCreate hook; never subsequently mutated.
  • updated_at: set by MikroORM onCreate hook on first persist; refreshed on every subsequent onUpdate event.
  • workspace FK: set null automatically by the DB (ON DELETE SET NULL) when the parent workspace is deleted.

Example

Source: /Users/maximechampoux/platform/apps/api/src/database/entities/ExtractPrompt.ts · domain: ingestion · tier: Infrastructure