Skip to content
Glossary

Retrieval-Augmented Generation (RAG)

Retrieval-Augmented Generation (RAG) is an AI pattern that looks up your data first, then uses what it found to generate a response. It helps reduce unsupported answers, but errors remain possible.

In context

A language model cannot reliably know your current products, prices or policies from training alone. RAG adds a retrieval step before generation so the model can use information from your store. Missing, outdated or irrelevant source data can still lead to a poor answer.

One common vector-based pipeline has three stages: embed content into a vector store; on a query, retrieve the most semantically similar chunks; then generate a response using those retrieved facts as context. The model still needs instructions and checks to help it stay within the evidence. Other RAG systems retrieve through lexical search, databases or APIs, sometimes combined with vectors.

Updating the knowledge source does not require retraining the model. Changed products must finish syncing and indexing before retrieval can use them. Check sync status and test representative questions after important catalog or policy changes.

How Zubby uses this

Zubby's current implementation uses retrieval alongside tools and conversation context. It embeds products (title + description + collection + variant + metafields) and your policy docs into a store-scoped pgvector index with 1536-dimension embeddings. Hybrid retrieval (vector + keyword) and re-ranking supply relevant matches to the prompt context.

The agent is instructed not to answer what it can't ground in the retrieved context, and a guardrail checks shipping, returns, and order-tracking commitments before they reach the shopper. That reduces invented prices, stock, and policies; it does not make errors impossible. For example, if a warranty policy is missing, test whether the agent requests clarification or hands off rather than supplying an unsupported warranty period. Add the approved source, wait for indexing, and repeat the same question to verify the change.

The Zubby knowledge base