Route first: a classifier or LLM decides whether the question needs SQL (structured), document search (unstructured), or both.
Structured path: text-to-SQL with the schema and a few examples in the prompt, a read-only database role, query validation (SELECT only, row limits, timeouts), then summarize the result.
Unstructured path: standard RAG with citations.
Combine: expose both as tools, let the LLM merge results in the final answer, and show the SQL and sources used.
Risks: wrong joins and hallucinated columns, so validate against the schema, retry with the error message, and evaluate on a set of question-to-SQL pairs.
Loading…