Analysts want an answer, not a ticket to the data team. This organization cannot send its schemas to a public model API. We split the system in two: one service finds the relevant tables, the other writes the SQL, runs it on Trino, and keeps the conversation.
Question in, SQL out. Retrieval narrows the schemas. Trino runs the query. The example is illustrative.Scored every night at 01:00
2 servicesRetrieval of schemas, and an API that writes and runs the query
5 schemasThe retrieval cap. Fifteen chunks of context come back with them
TrinoThe engine that executes the generated SQL
01:00A Jenkins job scores the night's cases with Gemma 27B
01 · The path of a question
Only the relevant tables go to the model
Sending a whole warehouse catalog into a prompt blows the context window and mixes columns that share a name. The retrieval service stores schemas and known question-SQL pairs in Milvus and returns the closest five schemas, plus up to fifteen chunks. The API then accepts a chat completion, can stream the reply, stores the conversation in PostgreSQL, and lets the analyst mark an answer good or bad. The SQL runs on Trino.
Two services and a nightly check. Retrieve, answer, then score intent, execution, and the rows that came back.
02 · What the nightly job scores
Intent, execution, and the result
The example below is illustrative. The real check compares a generated query with a known case on three things. Pick one.
03 · How it runs
Deployed on the client's own machines
Retrieval, separate from execution
One service indexes and searches schemas. The other owns the chat API. They deploy independently, through Helm.
A conversation, not a single call
The API lists past chats, opens a new one, streams a completion, and stores feedback on the answer.
Judged while the office sleeps
Jenkins runs at 01:00. It deploys the project and scores cases with an on-prem Gemma 27B judge: intent, whether the SQL executes, and how close the rows are.
Restarts that leave the model loaded
The surrounding model platform has a fast restart: application containers come back without reloading the large model weights.
Work with Software+AI
Need answers from a warehouse that cannot leave the building?
We design the retrieval, the API, and the evaluation, and we leave the models on your infrastructure.