Kredal Docs
How to

Configure AI Extraction

Enable Gemini-powered document extraction, consistency flags, and narrative drafts.

Kredal's AI layer is optional and server-side only. Without a key, the app runs normally and AI features are silently skipped. With a key, three things activate:

  1. Document extraction — uploads of trade licenses, passports, Emirates IDs, tenancy agreements, and bank statements are read into structured data automatically after upload (and on demand via the scan button on each document).
  2. Cross-document consistency flags — the scoring engine's xdoc_* rules compare extracted data against the company profile (name mismatches, expired documents). See the scoring reference.
  3. Narrative drafting — a "Draft with AI" assistant on the questionnaire's source-of-funds section.

Enable it

  1. Create a Gemini API key in Google AI Studio.

  2. Add it to kredal-app/.env.local:

    GEMINI_API_KEY=<your-key>
  3. For production, add the same variable to the Vercel project (mark it sensitive).

  4. Optional: pin a model with GEMINI_MODEL (defaults to gemini-2.0-flash).

How results are handled

  • Extracted JSON lands on documents.extracted_text with a parse_confidence (0–1).
  • Confidence ≥ 0.7 → status parsed; below → needs_review (visible on the document card with an AI n% chip). Extraction failures also mark needs_review — never silent.
  • Re-run any extraction with the scan button after replacing a document.

Boundaries (by design — see ADR 0009)

  • The readiness score's logic stays deterministic; AI only supplies extracted fields.
  • Narrative drafts are labelled, editable, and saved only when the founder applies and saves them; they never affect the score.
  • The key is server-only. Never prefix it NEXT_PUBLIC_.
  • Free-tier limits (~15 requests/minute) are fine for pilots; the client retries with backoff on rate limits.

On this page