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:
- 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).
- 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. - Narrative drafting — a "Draft with AI" assistant on the questionnaire's source-of-funds section.
Enable it
-
Create a Gemini API key in Google AI Studio.
-
Add it to
kredal-app/.env.local:GEMINI_API_KEY=<your-key> -
For production, add the same variable to the Vercel project (mark it sensitive).
-
Optional: pin a model with
GEMINI_MODEL(defaults togemini-2.0-flash).
How results are handled
- Extracted JSON lands on
documents.extracted_textwith aparse_confidence(0–1). - Confidence ≥ 0.7 → status
parsed; below →needs_review(visible on the document card with anAI n%chip). Extraction failures also markneeds_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.