The latest stable version of VS Code is 1.96.4 (as of January 2026)...
[citation:1] ← Citation source marker
**You should see**:
- Model response includes citation sources (`[citation:1]`, etc.)
- Response content is up-to-date, not old version from training data
### Step 5: Test Different Thresholds
Try adjusting `grounding_threshold` and observe model behavior changes:
```json
// Low threshold (frequent searches)
"grounding_threshold": 0.1
// High threshold (rare searches)
"grounding_threshold": 0.7After each adjustment, test with the same question and observe:
- Whether it searches (check if response has citations)
- Search count (multiple
citations) - Response speed
You should see:
- Low threshold: More frequent searches, but slightly slower response
- High threshold: Fewer searches, but potentially inaccurate answers
Checkpoint ✅
Click to expand verification checklist
Complete the following checks to confirm correct configuration:
- [ ] Configuration file contains
web_searchconfiguration - [ ]
default_modeset to"auto" - [ ]
grounding_thresholdis between0.0and1.0 - [ ] Make a request requiring real-time information, model returns response with citations
- [ ] After adjusting threshold, model search behavior changes
If all pass, Google Search Grounding is correctly enabled!
Troubleshooting
Problem 1: Model Not Searching
Symptoms: After enabling auto mode, the model still doesn't search, and no citation sources appear.
Causes:
- Threshold too high (e.g.,
0.9), model needs very high confidence to search - Question itself doesn't require searching (e.g., programming problems)
Solutions:
- Lower
grounding_thresholdto0.2or below - Test with questions that clearly need real-time information (e.g., "What's the weather today", "Latest news")
Problem 2: Too Frequent Searches, Slow Responses
Symptoms: Every question triggers a search, response time significantly increases.
Causes:
- Threshold too low (e.g.,
0.1), model triggers searches too frequently - Question type itself requires real-time information (e.g., stock prices, news)
Solutions:
- Raise
grounding_thresholdto0.5or higher - If the task doesn't need real-time information, change
default_modeto"off"
Problem 3: Configuration File Format Error
Symptoms: Plugin reports error, cannot load configuration.
Cause: JSON format error (e.g., extra commas, mismatched quotes).
Solution: Use a JSON validation tool to check the configuration file, ensure correct format.
# Validate JSON format
cat ~/.config/opencode/antigravity.json | python3 -m json.toolSummary
- Google Search Grounding enables Gemini models to search real-time web information
- Enable with
web_search.default_mode: "auto", disable with"off" grounding_thresholdcontrols search frequency: lower values mean more frequent searches- Default threshold
0.3works for most scenarios, adjust based on experience - Model will cite sources in responses, marked as
[citation:1], etc.
Next Lesson Preview
Next, we'll learn about Dual Quota System.
You'll learn:
- How the two independent quota pools (Antigravity and Gemini CLI) work
- How to switch between quota pools to maximize utilization
- Best practices for quota pooling
Appendix: Source Code Reference
Click to view source code locations
Last updated: 2026-01-23
| Feature | File Path | Lines |
|---|---|---|
| Google Search Config Schema | src/plugin/config/schema.ts | 303-319 |
| Google Search Type Definitions | src/plugin/transform/types.ts | 85-88 |
| Google Search Injection Logic | src/plugin/transform/gemini.ts | 402-419 |
| Google Search Config Loading | src/plugin/config/loader.ts | 173-184 |
| Google Search Config Application | src/plugin.ts | 1194-1196 |
Key Configuration Options:
web_search.default_mode:"auto"or"off", defaults to"off"web_search.grounding_threshold:0.0-1.0, defaults to0.3
Key Functions:
applyGeminiTransforms(): Applies all Gemini transformations, including Google Search injectionnormalizeGeminiTools(): Normalizes tool format, preservesgoogleSearchRetrievaltoolwrapToolsAsFunctionDeclarations(): Wraps tools asfunctionDeclarationsformat
How It Works:
- Plugin reads
web_search.default_modeandweb_search.grounding_thresholdfrom configuration file - When
mode === "auto", injectsgoogleSearchRetrievaltool in the request'stoolsarray:json{ "googleSearchRetrieval": { "dynamicRetrievalConfig": { "mode": "MODE_DYNAMIC", "dynamicThreshold": 0.3 // grounding_threshold } } } - Gemini model decides whether to call the search tool based on the threshold
- Search results are included in the response, marked with citation sources (
[citation:1], etc.)