Skip to main content

FiftyFive Tech

Email Us sales@fiftyfivetech.io
Get in Touch
Case Study | Unifying document and database access through AI

Unifying document and database access through AI

Enterprise AI RAG NL2SQL

FiftyFive delivered a full-cycle custom software development engagement for the client, building a unified AI query system. The work covered system architecture, AI/ML engineering, RAG and NL2SQL development, orchestration logic, and backend integration, delivered as a production-ready MVP within the client's delivery timelines.

Build Your Platform With Us
The Client

Client overview

The client is an enterprise organization that needed a scalable, AI-driven way to reach its data. Knowledge sat in PDF documents while operational records sat in PostgreSQL, forcing teams to work across two disconnected systems. The client engaged FiftyFive for a full-cycle custom software development engagement to unify both sources behind one natural language interface for faster analytics and operational decision-making.

The Need

Challenges

Building one natural language interface over both PDF documents and a PostgreSQL database meant solving retrieval, query translation, and routing in a single system. Each had to work accurately, and fast enough to ship as an MVP on a fixed timeline.

  • Two data paradigms, one entry point. Unstructured document retrieval and structured database querying follow different mechanics. The system had to serve both from a single interface without the user knowing which path a question would take.
  • Semantic search across PDF content. Documents had to be chunked and converted into vector embeddings so that meaning, not keyword overlap, drove retrieval, with relevant passages surfacing reliably from large document sets.
  • Natural language to executable SQL. Plain-English questions had to become valid, executable PostgreSQL statements that ran against live schema and returned correct tabular results, not approximations.
  • Query routing without agent memory. The system needed to classify each incoming query and send it to the right pipeline dynamically, without the stateful agent memory the original architecture assumed.
  • Latency, compute, and accuracy together. Every layer added inference cost. The architecture had to cut latency and compute overhead while holding response accuracy steady.
  • Production-ready MVP under time constraints. Delivery timelines ruled out a long build. The architecture had to be simplified without closing off the more advanced design later.
Our Approach

Solution

FiftyFive built a unified AI query system that answers a single natural language question from either enterprise documents or the production database. A lightweight classification layer reads each query and routes it to a Retrieval-Augmented Generation pipeline for PDF content or to an NL2SQL pipeline for PostgreSQL records. The originally planned agentic architecture was replaced with modular function orchestration, which cut system complexity, removed agent memory overhead, and brought the MVP to production faster. The modules stay independent, so agent capabilities can be layered on later without rebuilding the core.

RAG pipeline for document knowledge

FiftyFive built the document path so that meaning drives retrieval rather than keyword matching.

  • Vertex AI text-embedding-004 generates embeddings for document content.
  • Milvus stores and retrieves semantic chunks as the vector database.
  • Gemini Pro re-ranks retrieved documents and generates the final response.

NL2SQL module for structured records

FiftyFive built the database path to turn plain-English questions into queries the database can run.

  • Gemini Pro converts natural language into PostgreSQL queries.
  • Queries execute directly against PostgreSQL.
  • Results return as structured tabular output with an accompanying explanation.

Function-based orchestration layer

FiftyFive designed a lightweight orchestration layer that decides where each query goes.

  • Prompt-engineered classification logic routes queries between the RAG and SQL pipelines.
  • Routing is dynamic and stateless, with no agent memory to maintain.
  • The layer stays thin, keeping compute overhead and response latency low.

Modular architecture built for what comes next

FiftyFive replaced the planned agentic architecture with modular function orchestration to meet MVP goals.

  • Lower architectural complexity and faster deployment.
  • Modules remain separable, supporting future agent integration.
  • Operational efficiency and cost control hold as the system grows.
Technology

Technologies

Embeddings

Vertex AI text-embedding-004

Vector database

Milvus

LLM — re-ranking and response generation

Gemini Pro

LLM — natural language to SQL

Gemini Pro

Relational database

PostgreSQL

Retrieval approach

Retrieval-Augmented Generation (RAG)

Orchestration

Function-based orchestration with prompt-engineered classification
The Impact

Results

FiftyFive delivered a unified AI-powered query system that answers natural language questions from both PDF documents and PostgreSQL records. Teams reach document knowledge and structured data from one interface, without switching tools or knowing where the answer lives.

Faster MVP delivery

FiftyFive simplified the architecture into function-based orchestration, accelerating MVP deployment within the client's strict delivery timelines.

Lower compute overhead

The function-based design minimized compute overhead by removing the agent memory layer the original agentic architecture required.

Quicker query responses

Eliminating agent memory overhead improved query response speed across both document retrieval and structured database access paths.

Scalable modular architecture

The modular build supports future agent integration while maintaining operational efficiency and cost control as enterprise usage grows.

Support

FAQs

AI searches internal documents by converting them into vector embeddings stored in a vector database, then retrieving the passages closest in meaning to a question. This approach, known as Retrieval-Augmented Generation, lets employees ask plain-English questions and get answers grounded in company PDFs, reports, and contracts.

Yes. A custom AI system connects directly to company documents and databases, so answers come from internal data rather than a model's general training. The system retrieves the relevant records or passages for each question first, then generates a response based only on that retrieved content.

Yes. Natural language to SQL, often called NL2SQL, uses a language model to turn a plain-English question into a SQL query, run it against the database, and return the result as a table with an explanation. Teams get answers without writing queries or waiting on analysts.

Yes. A unified AI query system classifies each question and routes it to the right pipeline: semantic retrieval for PDFs and reports, SQL generation for database records. Users ask one question in one interface and never need to know which source holds the answer.

AI assistants give wrong answers when they generate from general training data instead of company sources. Grounding fixes this: the system retrieves actual documents or database records first, then answers only from that retrieved content. Re-ranking retrieved results before generation improves accuracy further.

Document search finds meaning in unstructured content such as PDFs, using embeddings and semantic retrieval. Database querying generates SQL to pull exact figures from structured tables. Documents answer what a policy says; databases answer how many, how much, and when. A unified system handles both.

Connecting AI to company databases is safe when access is scoped correctly. Generated queries should run under read-only, least-privilege credentials against approved tables, with validation and logging in place. The AI translates intent into a query; the database still enforces its own permissions.

General chatbots answer from public training data and cannot see internal systems. A custom AI assistant connects to company documents and databases, returning answers grounded in current records with controlled access. Organizations handling confidential, regulated, or operational data usually need a custom build rather than an off-the-shelf tool.

Build time depends on document volume, database complexity, integration scope, and accuracy targets. Architecture choice matters most: a lightweight, function-based design ships faster than a full agent-based one while still delivering production-ready results. Starting with an MVP on the highest-value data sources is quickest.

Cost depends on data volume, embedding and inference usage, vector database hosting, integrations, and accuracy requirements. Ongoing compute is a real cost line, so simpler architectures reduce both build and running spend. A scoped estimate needs your data sources, expected query volume, and security requirements.

Yes, when the architecture is modular. Separating retrieval, query generation, and routing lets each component scale independently, and lets new capabilities be added later without rebuilding the core. Vector indexing absorbs growing document volumes, while structured queries scale with existing database infrastructure.

Enterprises typically work with a custom software development partner that combines AI/ML engineering, data engineering, and system architecture, since these builds span embeddings, vector databases, SQL generation, and backend integration. FiftyFive Technologies delivers these engagements from offices in India, the UK, Sweden, and the UAE.

Get in touch

Contact Us

Book a call or fill out the form below and we’ll get back to you once we’ve processed your request.

    By submitting this form, you agree that FiftyFive Technologies may process your information to review your request and contact you. Read our Privacy Policy for more details.