techlist.io

Text To Sql

2 posts

OpenAI2026-01-284 min readCurated summary

Inside OpenAI’s in-house data agent

# Inside OpenAI's In-House Data Agent OpenAI built a bespoke, internal-only AI data agent to help employees go from a data question to an insight in minutes rather than days. Built on GPT-5.2 and the same developer tools OpenAI offers externally (Codex, the Evals API, and the Embeddings API), the agent reasons over OpenAI's data platform, which spans more than 600 petabytes across roughly 70k datasets. The post argues that a capable model alone is not enough: reliable answers depend on layered context, persistent memory, and systematic evaluation. ## Why a Custom Tool Was Needed - At this scale, finding the right table is often the most time-consuming step, since many tables look similar but differ in critical ways, such as whether they include logged-out users. - Even with the right tables, common SQL failures such as many-to-many joins, filter pushdown errors, and unhandled nulls can silently produce wrong results. - The goal is to let analysts focus on defining metrics and making decisions rather than debugging SQL semantics. ## How the Agent Works - It is available wherever employees work: as a Slack agent, through a web interface, inside IDEs, in the Codex CLI via MCP, and through an MCP connector in OpenAI's internal ChatGPT app. - It handles the full analytics workflow: discovering data, writing and running SQL, and publishing notebooks and reports. - It evaluates its own intermediate results. If a query returns zero rows, for example, it investigates, adjusts, and retries while carrying learnings forward. - When a request is ambiguous, it asks clarifying questions, but if no answer comes, it applies sensible defaults such as a 7- or 30-day window. - Recurring analyses, such as weekly business reports and table validations, are packaged as reusable workflows. ## Layered Context The post describes six layers of context that ground the agent's reasoning: - **Table usage:** Schema metadata and lineage show how tables relate, and ingesting historical queries reveals which tables are usually joined. - **Human annotations:** Domain experts curate descriptions that capture business meaning and known caveats. - **Codex enrichment:** Code-level analysis of how each table is produced reveals uniqueness, update frequency, scope, and whether a table includes only first-party ChatGPT traffic. This context refreshes automatically. - **Institutional knowledge:** Slack, Google Docs, and Notion content on launches, incidents, codenames, and metric definitions is embedded with permissions metadata and retrieved at runtime. - **Memory:** Corrections and non-obvious filters are saved globally or per user. In one case, the agent learned how to filter a specific experiment by matching a string defined in an experiment gate, rather than guessing with fuzzy string matching. - **Runtime context:** When information is missing or stale, the agent queries the warehouse live and consults metadata, Airflow, and Spark. A daily offline pipeline aggregates the first three layers into normalized embeddings. At query time, retrieval-augmented generation pulls only the most relevant context, keeping latency low across tens of thousands of tables. ## Evaluation and Trust - Evals are built from curated question-answer pairs, each with a manually written "golden" SQL query. - Grading does not rely on string matching. The system compares both the generated SQL and its result data, and an Evals grader produces a score with an explanation. - The evals run continuously as unit tests during development and as canaries in production to catch regressions. ## Security and Transparency - The agent acts purely as an interface layer and enforces existing permissions, so users can query only the tables they are already authorized to access. - It summarizes its assumptions and execution steps with each answer and links to underlying results so users can verify the analysis. ## Lessons Learned - **Less is more:** Overlapping tools confused the agent, so the team consolidated tool calls. - **Guide the goal, not the path:** Highly prescriptive prompts degraded results. High-level guidance let GPT-5's reasoning choose better execution paths. - **Meaning lives in code:** Schemas and query history miss assumptions and freshness guarantees that are visible in pipeline code, so crawling the codebase with Codex improved the agent's understanding of what each table contains. The team plans to make the agent handle ambiguous questions better, add stronger validation, and integrate it more deeply into existing workflows so it feels like part of how people already work, rather than a separate tool.

Netflix2026-01-273 min readCurated summary

The AI Evolution of Graph Search at Netflix

Netflix is evolving Graph Search from structured DSL queries toward natural-language search using large language models (LLMs). The goal is to let users describe what they want in everyday language while preserving the accuracy and trustworthiness required by Netflix’s complex, federated GraphQL data. Rather than replacing existing applications, Netflix plans to augment them with AI-generated filters and future retrieval-augmented generation capabilities. ## Why Natural-Language Search Is Needed - Graph Search currently relies on a Filter DSL, with applications translating UI interactions into structured queries. - Netflix has hundreds of applications with inconsistent query-building experiences, forcing users to learn different interfaces. - Some indexes contain hundreds of filterable fields, making large forms slow and cumbersome even for subject-matter experts. - Users naturally express goals in language such as “show all movies from the 90s about robots from the US,” not through query builders or DSL syntax. - Natural-language input could reduce friction while allowing each application to retain its own domain-specific presentation. ## Converting Text into Graph Search Filters - The core task is translating an ambiguous natural-language request into a valid Graph Search Filter DSL statement. - Graph Search indexes are defined through GraphQL queries containing typed fields, including booleans, strings, enums, and controlled vocabularies. - Generated filters can combine: - Comparisons such as `>` and `==` - Inclusion or exclusion operators such as `IN` - Logical operators such as `AND` - Netflix evaluates generated queries at three levels: - **Syntactic correctness:** The statement follows the DSL grammar and can be parsed. - **Semantic correctness:** The query uses existing fields, respects field types, and selects valid controlled-vocabulary values. - **Pragmatic correctness:** The filter accurately reflects the user’s intended meaning. ## Context Engineering for the LLM - The LLM needs index metadata to generate semantically valid filters. - Netflix derives much of this context from GraphQL schemas, including: - Field paths - Field descriptions from schema comments - Field types - Valid enum or controlled-vocabulary values - Controlled vocabularies define finite, governed sets of values, such as countries, and prevent generated queries from using invalid alternatives. - Supplying all metadata works for simple examples but does not scale: - Some indexes contain hundreds of fields. - Some vocabularies contain thousands of values. - Larger prompts increase latency and can reduce generation accuracy. - Netflix therefore needs ways to provide the LLM with relevant metadata without overwhelming its context, while still grounding generated queries in the actual schema and allowed values. Netflix’s approach combines schema-aware context, LLM-based query generation, and validation to make natural-language Graph Search practical. The key recommendation is to use AI as an augmentation layer over existing Graph Search applications, with strong grounding and correctness checks rather than treating generated queries as inherently reliable.