Grounding and Enterprise Retrieval
Explore how grounding connects AI-generated answers to relevant external and enterprise sources while enforcing strict access controls and versioning. Understand how to select, rank, and fuse evidence from authorized internal policies and public data to produce accurate claims. Practice tracing retrieval decisions through permissions, metadata, and citation verification to ensure trustworthy and compliant responses in real-world scenarios.
We'll cover the following...
A public travel article recommends a 20:00 dinner cutoff. An old internal policy also says 20:00. The current internal policy says after 21:00 and requires an itemized receipt.
Which one answers an employee’s reimbursement question? Grounding connects generated claims to external evidence. Answering correctly also requires selecting evidence the caller may access and preserving the conditions that make it applicable.
In an FDE interview, tracing those decisions is more useful than drawing a vector database beside a model.
Which evidence answers?
At Nacre Labs, employee u7 asks: “Can I claim dinner for a same-day field visit returning at 21:30?” The question concerns policy effective on 2026-10-28. Trusted caller context establishes that u7 belongs to employees, with no finance membership.
The corpus contains five sources:
W1: A public travel article recommending a 20:00 cutoff. It has no authority over Nacre’s employee entitlements.
P3: A superseded employee policy with a 20:00 cutoff and $25 cap.
P4: The current employee policy, effective 2026-10-01. Its section is “Same-day field visits.”
P4-FAQ: A current employee passage explaining expense submission, without establishing eligibility.
F2: A finance-only exception memo outside
u7’s authorized scope.
The required evidence is the applicable internal rule, its effective version, and the supplied trip facts. The request supplies the return time and same-day field-visit status; it supplies neither an expense amount nor proof that a receipt exists. A useful answer must preserve that distinction.
Public or enterprise?
Grounding connects generated claims to external evidence. Grounding with Google Search supports questions requiring public sources; retrieval over enterprise data supports questions requiring proprietary records and internal definitions. Public search does not establish access to those records.
For Nacre, a recently fetched W1 remains the wrong authority. Conversely, an internal search result can be obsolete: P3 remains internal even after P4 supersedes it. Source authority and freshness therefore need separate checks.
A question can require both source classes. For example, an employee might ask how Nacre’s allowance compares with published travel guidance. Keep the claims separate:
Internal entitlement: Supported by the applicable Nacre policy.
Public comparison: Supported by identified public guidance.
Difference between them: Derived from those two sources, without letting public guidance override the internal rule.
Google grounding mechanics
For public questions, enable Grounding with Google Search through the Gemini API’s google_search tool. With google-genai installed, credentials configured externally, and GEMINI_MODEL set to a Search-grounding-compatible model:
import osfrom google import genaifrom google.genai import typeswith genai.Client() as client:response = client.models.generate_content(model=os.environ['GEMINI_MODEL'],contents='What public travel guidance applies to late dinners?',config=types.GenerateContentConfig(tools=[types.Tool(google_search=types.GoogleSearch())]),)metadata = response.candidates[0].grounding_metadata
The supplied documentation confirms that Google Search grounding uses publicly available web data. The exact mapping among grounding_metadata.grounding_chunks, grounding_supports, grounding_chunk_indices, and segment offsets remains unverified by the available passages. A ...