Product search needs semantic, structured, and hybrid queries because natural-language requests can contain descriptive intent and field filters.
2
Hasura connects relational and vector data sources behind one GraphQL API, which lets an application generate and execute context queries for RAG.
3
A read-only Hasura role prevents an LLM-generated malicious insert mutation from changing the product database.
Summary
Simrat Hanspal explains how to build a product-search RAG pipeline that handles descriptive queries, structured filters, and combinations of both. Product descriptions can be searched semantically in a vector database, while fields such as price and category can be queried as structured data. Hasura connects these sources and exposes them through one GraphQL API. In the demo, a Streamlit application sends a natural-language request to a language model, receives a GraphQL query, and executes it through Hasura. The demo covers essential-oil semantic search, a price filter, and a hybrid request for diffusers priced between $500 and $1,000. Hanspal also demonstrates a security failure: an unrestricted role allows the generated GraphQL mutation to insert a product. Creating a role with select permission causes the same mutation to fail. The talk makes the security requirement concrete rather than treating grounding as only a retrieval problem.
Product search has descriptive and structured intent
Hanspal begins with e-commerce product search, where keyword queries often miss the user's full intent. A request can describe a product, such as essential oils for relaxation, or specify structured fields such as price and category. Some requests combine both forms. This means a product-search system needs to handle semantic similarity, relational filters, and queries that apply both at once. Natural language gives users more expressive queries, but it also means the application must interpret their intent before retrieving context.
RAG gives the model access to data outside its training
Hanspal says large language models are frozen in time and cannot solve tasks involving data they have not seen. One way to expose that unseen data is to provide context alongside the question. This retrieval-augmented generation pipeline can produce answers that are more accurate and grounded. For product search, the retrieved context comes from product data rather than from the model's existing knowledge. The pipeline still needs production safeguards because a natural-language request can be used to ask for data or actions that the application should not allow.
Natural-language data access needs stricter security
Traditional data-driven applications usually have relatively stable data structures, while the application changes to support new functions. RAG applications need to adapt retrieval to each user's natural-language query. Hanspal says natural language has no structural limitations, which creates room for malicious requests. A secure data API therefore needs to control what the generated query can read or change. The risk is especially direct when a language model generates executable GraphQL rather than only returning text.
One GraphQL API can cover all three retrieval modes
Hasura connects multiple data sources and exposes them through a single GraphQL API. Hanspal describes three retrieval modes: semantic search over product descriptions in a vector database, structured search over fields in a relational database, and hybrid search containing both. Structured requests require converting natural language into SQL or GraphQL. With Hasura, the application does not need separate data APIs for each mode. The same API can query the connected sources and return the context needed by the RAG pipeline.
The demo turns a natural-language request into GraphQL
Hanspal's Streamlit application accepts user input, calls a language model, generates a GraphQL query, and executes that query through Hasura. In the semantic example, the request is "show me essential oils for relaxation." The generated query identifies the descriptive part and searches the vector database. In the structured example, a request for products below $500 becomes a price filter with a less-than condition. The application then displays the products returned by the query.
Hybrid retrieval combines vector similarity with a price filter
For the hybrid example, Hanspal asks for essential oil diffusers priced from $500 to $1,000. The generated GraphQL query identifies "essential oil diffuser" as the semantic search text and applies the price range as a structured condition. Hasura returns the combined results through the same API. In the demo setup, the vector database also contains price and category fields. Hanspal says Hasura's event system automatically vectorized newly inserted records from the product table and saved them in the vector database.
An unrestricted role lets a generated mutation write data
The security test sends a malicious request asking to insert a hair-oil product with a name, price, category, description, and product ID. The model generates an insert mutation, and the mutation succeeds because the current role allows it. Hanspal checks the table and finds that the product was inserted. He presents this as unintended behavior. The example shows that preventing harmful actions requires database permissions around the generated query, rather than relying on the model to reject the request.
Hanspal creates a new role called product search and gives it only search, or select, permission across the product columns. He then submits another malicious insert request. The language model still generates an insert mutation, so changing the prompt or relying on generation alone would not solve the problem. This time, Hasura rejects the mutation because the role lacks insert permission. The read-only role allows the application to retrieve product context while blocking a write operation generated from an untrusted request.
"One of the ways to expose the unseen data to large language model is by providing context to the question alongside the question."00:56
Who should watch
You are building product search or another RAG application that must combine vector similarity with relational filters.
Your application lets a language model generate database queries and you need a concrete permission model to prevent writes.
You have data in multiple sources and want one API for semantic, structured, and hybrid retrieval.