Integration notes — Gemini / embeddings /
LLM
Replace GEMINI_API_URL and calls in [Link] and [Link] with the exact Gemini API
endpoints and client usage you have. Typical steps:
Obtain API key from your Gemini/Google Cloud account and set GEMINI_API_KEY in
backend/.env.
Use official SDK if available (preferred) for authentication and stable request format.
Confirm embedding vector dimensionality and ensure FAISS uses same dim.
For generation (RAG), send retrieved chunks as context in prompt and set instructions
like “Only use the sources” to reduce hallucination.
For multilingual (Hindi) in MVP: easiest approach is to translate Hindi to English on
ingestion. You can request translation by calling Gemini translation or any translation
API and store both original+translated text in chunks. For now: call Gemini's translation
endpoint inside ingest.process_file_bytes for non-English files (or rely on LLM to
handle Hindi at query-time).
Where to improve next (after MVP)
Use Celery or background workers for file processing (long jobs).
Use managed vector DB (Pinecone / Weaviate) for scale.
Better table extraction for complex PDFs (Tabula/Camelot + layout models).
Add currency normalization and exchange rate lookup.
Build UI pages for vendor comparison tables and editable parsed data.
Add user accounts + RBAC + encryption at rest.
Implement unit tests for parsers and integration tests for RAG.
Add multilingual native embeddings & dual-indexing for Hindi.
Troubleshooting & common issues
FAISS dimension mismatch: ensure every embedding from Gemini has same length. If
mismatch, create a small script to check lengths.
pdfplumber not extracting tables properly: try camelot or higher-quality PDFs; scanned
PDFs need OCR.
pytesseract returns garbage: ensure Tesseract binary installed and on PATH; test
tesseract --version.
Requests to Gemini fail: check API key, network, endpoint format, and rate limits.