๐ Key Points
- The Ceiling Concept: Generative AI can only summarize the context it is explicitly given. If the retriever fetches irrelevant data, the AI will confidently summarize irrelevant data.
- Test in Isolation: Always test your Retriever inside Prompt Builder before attaching it to a live Agentforce agent.
- Filters over Prompts: Fix hallucinated or incorrect answers by tuning chunk sizes and adding Metadata Filters, not by rewriting your prompt template.
- Data Cloud Credits: Re-indexing data consumes Data Cloud credits. Tune your search logic on a small, representative dataset before scaling to your entire knowledge base.
- Index Maintenance: Stale indexes degrade answer quality quietly over time. You must establish a clear cadence for re-indexing when new documents are published.
๐งช How to Properly Test Retrieval Quality
Debugging RAG (Retrieval-Augmented Generation) through a live Agentforce conversation is a massive mistake. It is slow, and it conflates two completely different failure modes: retrieval failure (finding the wrong data) versus reasoning failure (the AI misunderstanding the data).
To isolate the issue, follow this strict testing hierarchy:
THE RETRIEVAL ISOLATION TEST ============================ 1. Open Prompt Builder (Do NOT test in the Agent interface). 2. Gather 10 real-world questions that actual users ask. 3. Run the questions through the Retriever. 4. Inspect the raw text chunks returned for each question. 5. Score each chunk: Relevant (1) or Not Relevant (0). ├─ If Score is < 7/10 → Tune chunking, add filters, or change index type. └─ If Score is > 7/10 → Now you are allowed to tweak the prompt. 6. Re-score and record the "Before & After" metrics to prove your fix worked.
๐งญ 360 Card: The Retrieval Baseline Strategy
- Rule: Always score retrieval in strict isolation before an agent is ever allowed to use it. Document the baseline number.
- Gain: You tune the correct layer of the architecture and have hard data to prove that your architectural changes actually improved the AI.
- Price: Building a truly representative test set requires analyzing historical user data and deeply understanding what your users actually ask.
- Limits: Indexing data costs Data Cloud credits. Endless tuning cycles with massive datasets will burn through your allocated usage.
- Mirror (The Bad Way): Testing strictly through the conversational UI is slow and makes it impossible to know if the LLM hallucinated, or if the search index simply failed to deliver the facts.
๐ก Core Q&A & Self-Check
The prompt is the last place you should look, not the first. By passing ten test queries directly into the retriever and inspecting the returned chunks, you can determine if the system is suffering from a data retrieval issue. If the data is wrong, no amount of prompt wording can magically produce a correct answer.
Instead of prompt engineering, you should tune your chunking strategy (making chunks larger or smaller), switch your Index Type (moving from Vector to Hybrid to better capture exact keywords like SKUs), or add Metadata Filters. Filters usually yield the biggest single improvement because unfiltered vector searches will confidently return semantically adjacent, but factually incorrect, content.
Chunk, Embed, Index, Retrieve.
It automatically generates the Search Index and the Retriever, utilizing Hybrid Search by default.