Evolution of Hermes V3: Building a Conversational AI Data Analyst
swiggy · E-commerce · 2024 · source Agentic: yes · promotional bias: med · summary-only (no fetched source) · extracted with prompt 0.5.6 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: enterprise conversational data analysis
Swiggy needed to evolve Hermes from a basic Slack text-to-SQL assistant into a reliable conversational AI analyst that could handle business metrics, context, explanations, and production quality controls.
Constraints:
- The source article was not fetched for this extraction, so evidence is summary-only.
- Initial Hermes struggled with niche metrics, derived logic, conversational context, explainability, and inconsistent prompts.
- Snowflake SQL history lacked metadata for traditional supervised training approaches.
- Generated SQL needed transparency because incorrect queries could lead to poor business decisions.
- Production deployment needed RBAC, ephemeral Slack replies, audit logs, and SSO controls.
Architecture
Hermes V3 combines SQL2Text-generated prompt examples, vector retrieval over historical query prompts, conversational memory, a ReAct-style agent/orchestrator, metadata retrieval, SQL generation, explanation/confidence layers, automated charter tests, Slack feedback, RBAC, ephemeral responses, audit logs, and SSO identity controls.
Diagram confidence: reconstructed (reconstructed from prose).
flowchart LR slack-interface["Slack interface"] --> conversational-agent-layer["Conversational agent layer"] conversational-agent-layer --> vector-prompt-retriever["Vector prompt retriever"] vector-prompt-retriever --> sql-generator["SQL generator"] sql-generator --> explanation-layer["Explanation layer"] explanation-layer --> slack-interface quality-control-loop["Quality control loop"] --> conversational-agent-layer governance-layer["Governance layer"] --> slack-interface
Components
| Component | Role | Interacts with |
|---|---|---|
Slack interface |
User-facing entry point for natural-language data questions and feedback. | Conversational agent layer |
Conversational agent layer |
Examines history, clarifies requests, rewrites queries, fetches metadata, and executes commands. | Vector prompt retriever |
Vector prompt retriever |
Searches similar generated prompts and injects few-shot examples. | SQL generator |
SQL generator |
Produces SQL from user intent, retrieved examples, and metadata. | Explanation layer |
Explanation layer |
Shows assumptions, logical steps, and confidence scores. | Slack interface |
Quality control loop |
Runs charter tests, collects weekly feedback, analyzes negative responses, and rolls out fixes. | Conversational agent layer |
Governance layer |
Applies RBAC, ephemeral replies, audit logs, and SSO-authenticated Slack controls. | Slack interface |
Data flow
Existing SQL and business context are converted into natural-language prompts, embedded for vector retrieval, injected as few-shot examples when users ask questions, then an agent layer uses conversation history, metadata retrieval, prompt memory, SQL generation, clarification, and explanation layers to return governed Slack responses.
Why this architecture
Swiggy chose retrieval, memory, agentic workflow, and explanations because Hermes needed to move beyond one-shot SQL translation. Historical SQL provided examples, conversation memory supported iterative analysis, and transparency helped users judge generated queries.
Models used: Claude large context models · Vector similarity search · SQL2Text pipeline · ReAct-style reasoning loop · Snowflake · Slack
Scale
- Hermes improved query accuracy from 54% to 93%.“These enhancements improved query accuracy from 54% to 93%”summary, stated
- The reported benchmark used approximately 100 manually tagged queries.“improving accuracy from 54% to 93% on a benchmark of approximately 100 manually tagged queries.”summary, stated
- Fully incorrect queries reportedly fell from 20% to 7%.“the system reduced fully incorrect queries from 20% to just 7%”summary, stated
- Ambiguous prompt accuracy increased by 20-25%.“This structured approach led to a 20-25% increase in query accuracy on ambiguous prompts”summary, stated
- Wide tables were chunked in batches of 75 columns to stay under token limits.“For wide tables, columns are chunked in batches of 75 to stay under token limits”summary, stated
Alternatives considered (roads not taken)
Basic English-to-SQL translation.
Rejected because: It lacked context, explainability, and reliable handling of niche metrics or derived logic.
Traditional supervised training on SQL history.
Rejected because: The SQL query corpus lacked metadata needed for traditional training.
Generic embeddings for column inference.
Rejected because: The redesigned metadata strategy first narrows tables via metric definitions and descriptions, then fetches columns from those specific tables.
Patterns
rag-retrieval (few-shot prompt retrieval)
Hermes retrieves similar historical query prompts and injects them as few-shot examples for SQL generation.
agent-memory (conversation context)
Hermes remembers recent prompts and carries context forward so users can refine questions without restating context.
tool-use-orchestration (agentic SQL workflow)
An agent layer decides whether to clarify, rewrite, retrieve metadata, or execute commands.
observability-tracing (quality feedback)
Weekly Slack feedback and root cause analysis feed continuous quality improvement.
Tradeoffs
Generate few-shot prompts from historical SQL.
Chose SQL2Text plus vector retrieval over Traditional supervised training on unlabeled SQL history.
Rationale: The approach reuses existing SQL and business context despite missing labeled metadata.
Deploy through Slack with privacy controls.
Chose Private DMs plus central help channel over A fully public channel or separate standalone app.
Rationale: The design balances privacy, adoption, support, and community engagement.
Explain generated SQL.
Chose Assumptions, logical steps, and confidence scores over Opaque SQL answers.
Rationale: Users need context to evaluate and trust generated SQL in business decision workflows.
Gotchas (what bit them)
Accuracy claims come from a small benchmark.
Root cause: The 54% to 93% claim used about 100 manually tagged queries and may not cover all real-world complexity.
Resolution: Treat the metric as directional and keep production feedback, tests, and root-cause analysis in the loop.
Long conversations may drift.
Root cause: Conversational memory likely has context-window and context-drift limitations over longer sessions.
Resolution: Use an agent layer to examine history and decide when to clarify, rewrite, or fetch metadata.
Agentic workflows add troubleshooting complexity.
Root cause: Orchestrator logic introduces more moving pieces than a basic text-to-SQL translator.
Resolution: Use explanation layers, quality monitoring, automated tests, and audit logs.
Evaluation
Hermes uses manually tagged query benchmarks, ambiguous-prompt accuracy checks, automated charter test suites, weekly Slack correctness feedback, root-cause analysis for negative responses, and proactive fixes across related metrics.
Metrics: Query accuracy · Fully incorrect query rate · Ambiguous prompt accuracy · Table not found errors · Weekly correctness feedback · Charter test pass rate · Confidence scores
Outcomes
- Reported query accuracy improved from 54% to 93%.
- Fully incorrect queries reportedly dropped from 20% to 7%.
- Ambiguous-prompt accuracy improved by 20-25% and table-not-found errors were virtually eliminated.
- Hermes became the backbone for other internal AI copilots and evolved into a Text to Insights tool.
The summary reports a 100-query manually tagged benchmark, 75-column metadata chunks for wide tables, and expansion beyond Hermes into other internal copilots.