AI Assistant for a Project-Management SaaS
Text-to-SQL, Hybrid RAG and Session Documents in One Chat
My Role
- Custom SQL chain: schema sent without sample rows
- Uploaded files indexed per session, deleted after
- Hybrid dense plus BM25 retrieval over docs
Approach at a Glance
Details- 1Text-to-SQL over the Product Database
- 2Hybrid RAG over Documentation
- 3Per-Session Document RAG
- 4Synthetic Data for Development
- 5Demo and Handover
Executive Summary
An AI assistant for a project-management SaaS, a tool in the same space as Jira, that lets users ask questions in plain language and get answers from three different sources in one chat:
- Their own project data: epics, stories, sprints, teams, priorities and statuses, queried live from the product's database with text-to-SQL.
- The product's documentation: answered with hybrid retrieval that combines semantic and keyword search.
- Files they upload during the chat: indexed for that session only and deleted when it ends.
The assistant answered with 0.93 accuracy of relevant answers overall, and 0.89 on text-to-SQL questions. I led the work as an independent consultant, in a team with one developer. The assistant was handed over and integrated into the client's product.
Client Profile
The client builds a project-management platform. Its data model is rich: workspaces and project spaces, initiatives and epics with phases and health statuses, stories with subtasks, comments and labels, teams, sprints and retrospectives. Users wanted to ask questions like "which epics are at risk this sprint?" without building reports or filters.
That meant combining very different kinds of knowledge:
- Structured data that changes constantly and has to be queried exactly, through dozens of related tables.
- Product documentation for "how do I…" questions.
- Ad-hoc documents a user brings into the conversation, which must not leak into other sessions.
Technical Approach
-
Text-to-SQL over the Product Database – GPT-4 turns the question and the chat history into SQL, runs it on PostgreSQL and writes the answer from the result. The database is mapped through an SQLAlchemy model of the product schema, and the prompt never exposes internal IDs. The standard SQL chain overflowed the context window on this many tables, so I built a custom chain that sends the schema without sample rows.
-
Hybrid RAG over Documentation – Product docs are indexed in Pinecone with both dense embeddings and BM25 sparse vectors, using a BM25 encoder fitted on the docs. Before retrieval, a history-aware step rewrites follow-up questions into standalone ones.
-
Per-Session Document RAG – Users can upload PDF, TXT or CSV files mid-conversation. Chunks are tagged with the session ID, retrieved only within that session and deleted when the session ends. A fetch-then-delete workaround made this possible on the vector database's free tier, which couldn't delete by metadata. Without an uploaded file, the assistant falls back to the general knowledge base.
-
Synthetic Data for Development – Development and testing used synthetic data covering the product's tables, so no customer data was needed.
-
Demo and Handover – A Streamlit interface for demos and testing. The components were then handed over for integration into the client's product.
Business Outcome
The client's users can ask about their projects, the product and their own documents in one conversation, without building reports or searching the docs. The assistant reached 0.93 accuracy of relevant answers and 0.89 on text-to-SQL, and was integrated into the client's product.
Technologies
Planning something similar?
Tell me about it on a short call. New projects can start within 2 weeks