About the client
The client's teams worked across two disconnected systems. Knowledge lived in PDF documents; operational records lived in a PostgreSQL database. Answering a business question often meant searching documents in one place and querying data in another. The client engaged FiftyFive for a full-cycle build of one natural-language interface over both sources, on a fixed MVP timeline.
How do you let people ask one question of documents and a database?
- Two retrieval mechanics. Unstructured documents need semantic search; structured records need exact queries. Users should not have to know which applies.
- Meaning, not keywords. Documents had to be chunked and embedded so relevant passages surface from large document sets.
- Correct SQL. Plain-English questions had to become valid PostgreSQL that runs against the live schema and returns exact results.
- Routing without agent memory. Each query had to be classified and sent to the right pipeline, without the stateful agent memory the original architecture assumed.
- Cost and time. Every layer adds inference cost and latency, and the timeline ruled out a long build, without closing off a more advanced design later.
What FiftyFive built
FiftyFive covered system architecture, AI engineering, the RAG and NL2SQL pipelines, orchestration logic and backend integration. The central design decision was to replace the originally planned agentic architecture with modular function orchestration. That removed the agent memory layer and simplified the system, while keeping modules independent so agent capabilities can be added later.
How the solution works
Query classification and routing
- A thin orchestration layer uses prompt-engineered classification to decide whether each question needs document knowledge or database records, then calls the matching pipeline.
- Routing is stateless: no conversation or agent memory is kept between queries.
RAG pipeline for documents
- PDF content is chunked and embedded with Vertex AI text-embedding-004.
- Milvus stores and retrieves the semantic chunks.
- Gemini Pro re-ranks the retrieved passages and writes the final answer.
NL2SQL pipeline for records
- Gemini Pro converts the question into a PostgreSQL query.
- The query runs directly against the database, and results come back as a table with a plain-language explanation.
Designed to extend
- Because classification, retrieval and SQL generation are separate functions, each can be improved or replaced on its own, and an agent layer can be added on top later without rebuilding the core.
Technology stack
What the solution enabled
Business transformation
Pipelines, RAG and NL2SQL, in one interface
No agent memory between queries
Re-ranks passages and writes SQL
One interface, two sources
Natural-language questions answered from either PDF documents or PostgreSQL records.
A working RAG pipeline
Embedding, vector retrieval, re-ranking and generation over enterprise documents.
A working NL2SQL pipeline
Generated SQL executed against PostgreSQL, returned as tables with explanations.
A simpler architecture, on time
Stateless function orchestration in place of the planned agentic design, delivered within the client's MVP timeline.
Technical questions
How do you route a natural-language question to either RAG or text-to-SQL?
In this MVP, FiftyFive Technologies placed a prompt-engineered classification step in front of two pipelines. The classifier decides whether a question needs document knowledge or database records, then calls the RAG pipeline (Vertex AI embeddings, Milvus, Gemini Pro) or the NL2SQL pipeline (Gemini Pro generating PostgreSQL). Routing is stateless, so no agent memory is required.
Why replace an agentic design with function orchestration for an MVP?
The original architecture assumed an agent with stateful memory. For a fixed MVP timeline, FiftyFive Technologies replaced it with independent functions called by a lightweight router. This removed the memory layer and reduced complexity, while keeping the modules separate so agent capabilities can be layered on later.