Skip to content

Add mocks for Grounding with Google Maps responses.#60

Merged
rlazo merged 1 commit into
mainfrom
ddb-grounding-for-maps-mocks
Jan 27, 2026
Merged

Add mocks for Grounding with Google Maps responses.#60
rlazo merged 1 commit into
mainfrom
ddb-grounding-for-maps-mocks

Conversation

@DellaBitta
Copy link
Copy Markdown
Contributor

Mock responses for Google Maps grounding. The responses are very similar for Vertex AI and Google AI, but I've created a distinct mock file for each for better coverage.

@github-actions
Copy link
Copy Markdown

Coverage Diff

GenerateContentResponse: 60 -> 61 🔵
| candidates: 55 -> 56 🔵
| | content: 54 -> 55 🔵
| | | parts: 50 -> 51 🔵
| | | | text: 40 -> 41 🔵
| | | role: 43 -> 44 🔵
| | finishReason: 49 -> 50 🔵
| | | STOP: 45 -> 46 🔵
| | groundingMetadata: 5 -> 6 🔵
| | | groundingChunks: 4 -> 5 🔵
| | | | maps: 0 -> 1 ✅
| | | | | placeId: 0 -> 1 ✅
| | | | | title: 0 -> 1 ✅
| | | | | uri: 0 -> 1 ✅
| | | groundingSupports: 5 -> 6 🔵
| | | | confidenceScores: 1 -> 2 🔵
| | | | groundingChunkIndices: 5 -> 6 🔵
| | | | segment: 5 -> 6 🔵
| | | | | endIndex: 5 -> 6 🔵
| | | | | startIndex: 5 -> 6 🔵
| | | | | text: 5 -> 6 🔵
| | | retrievalQueries: 0 -> 1 ✅
| | safetyRatings: 31 -> 32 🔵
| | | category: 31 -> 32 🔵
| | | | HARM_CATEGORY_HATE_SPEECH: 29 -> 30 🔵
| | | | HARM_CATEGORY_DANGEROUS_CONTENT: 30 -> 31 🔵
| | | | HARM_CATEGORY_HARASSMENT: 31 -> 32 🔵
| | | | HARM_CATEGORY_SEXUALLY_EXPLICIT: 29 -> 30 🔵
| | | probability: 31 -> 32 🔵
| | | | NEGLIGIBLE: 30 -> 31 🔵
| | | probabilityScore: 13 -> 14 🔵
| | | severity: 13 -> 14 🔵
| | | | HARM_SEVERITY_NEGLIGIBLE: 13 -> 14 🔵
| | | severityScore: 13 -> 14 🔵
| createTime: 12 -> 13 🔵
| modelVersion: 18 -> 19 🔵
| responseId: 13 -> 14 🔵
| usageMetadata: 32 -> 33 🔵
| | candidatesTokenCount: 28 -> 29 🔵
| | candidatesTokensDetails: 14 -> 15 🔵
| | | modality: 14 -> 15 🔵
| | | | TEXT: 12 -> 13 🔵
| | | tokenCount: 14 -> 15 🔵
| | promptTokenCount: 32 -> 33 🔵
| | promptTokensDetails: 15 -> 16 🔵
| | | modality: 15 -> 16 🔵
| | | | TEXT: 15 -> 16 🔵
| | | tokenCount: 15 -> 16 🔵
| | totalTokenCount: 31 -> 32 🔵
| | trafficType: 12 -> 13 🔵
| | | ON_DEMAND: 12 -> 13 🔵
Total Coverage: 42.33% -> 44.0% ✅

Legend:
✅ : total coverage increase
🔵 : files number increase, total coverage unaffected
🟡 : files number decrease, total coverage unaffected
❌ : total coverage decrease

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @DellaBitta, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces new mock JSON response files to simulate successful Google Maps grounding operations for both Google AI and Vertex AI platforms. The primary goal is to expand and improve the test coverage for features that rely on these grounding services, ensuring robust and predictable behavior across different AI integrations.

Highlights

  • New Google AI Mock Response: Added a new JSON mock response file for successful Google Maps grounding specifically for Google AI, simulating a list of pizza places with associated grounding metadata.
  • New Vertex AI Mock Response: Introduced a distinct JSON mock response file for successful Google Maps grounding via Vertex AI, which includes additional details such as safety ratings, retrieval queries, and confidence scores for grounding supports.
  • Enhanced Test Coverage: These new mock files provide separate, detailed responses for both Google AI and Vertex AI, ensuring more comprehensive test coverage for grounding functionalities.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds mock responses for Google Maps grounding for both Google AI and Vertex AI. While adding these mocks is a good step for testing, I've found critical issues in the groundingMetadata of both new JSON files. The startIndex, endIndex, and groundingChunkIndices are incorrect, which would lead to failures in any code that relies on this data for validation or processing. Please see the detailed comments for each file.

Comment thread mock-responses/googleai/unary-success-google-maps-grounding.json
Comment on lines +189 to +697
"groundingSupports": [
{
"segment": {
"startIndex": 43,
"endIndex": 152,
"text": "* **Joe's Pizza** at 124 Fulton St is a long-time family-owned pizzeria that serves classic pies and slices"
},
"groundingChunkIndices": [
0
],
"confidenceScores": [
0.7392373
]
},
{
"segment": {
"startIndex": 154,
"endIndex": 241,
"text": "They offer takeout, delivery, and dine-in options and are open from 10:00 AM to 3:00 AM"
},
"groundingChunkIndices": [
0
],
"confidenceScores": [
0.886766
]
},
{
"segment": {
"startIndex": 243,
"endIndex": 347,
"text": "* **Stage Door Pizzeria** at 26 Vesey St is a pizza parlor that offers upside-down slices and calzones"
},
"groundingChunkIndices": [
1
],
"confidenceScores": [
0.9153079
]
},
{
"segment": {
"startIndex": 349,
"endIndex": 436,
"text": "They are open from 10:00 AM to 8:00 PM and offer takeout, delivery, and dine-in options"
},
"groundingChunkIndices": [
1
],
"confidenceScores": [
0.8336369
]
},
{
"segment": {
"startIndex": 438,
"endIndex": 528,
"text": "* **Famous Calabria Pizza** at 27 St James Pl offers slices, salads, and Italian entrees"
},
"groundingChunkIndices": [
2
],
"confidenceScores": [
0.5303842
]
},
{
"segment": {
"startIndex": 530,
"endIndex": 617,
"text": "They are open from 10:00 AM to 9:00 PM and offer takeout, delivery, and dine-in options"
},
"groundingChunkIndices": [
2
],
"confidenceScores": [
0.8870799
]
},
{
"segment": {
"startIndex": 619,
"endIndex": 733,
"text": "* **Kesté Pizza e Vino** at 77 Fulton St serves Neapolitan wood-fired pizzas with vegan and gluten-free options"
},
"groundingChunkIndices": [
3
],
"confidenceScores": [
0.95013124
]
},
{
"segment": {
"startIndex": 735,
"endIndex": 773,
"text": "They are open from 11:00 AM to 9:30 PM"
},
"groundingChunkIndices": [
3
],
"confidenceScores": [
0.004622229
]
},
{
"segment": {
"startIndex": 775,
"endIndex": 893,
"text": "* **Little Italy Pizzeria and Deli** at 50 Fulton St is open 24/7 and serves a variety of thin-crust pies and slices"
},
"groundingChunkIndices": [
4
],
"confidenceScores": [
0.9163377
]
},
{
"segment": {
"startIndex": 895,
"endIndex": 944,
"text": "They offer takeout, delivery, and dine-in options"
},
"groundingChunkIndices": [
4
],
"confidenceScores": [
0.77168286
]
},
{
"segment": {
"startIndex": 946,
"endIndex": 1061,
"text": "* **Little Italy Pizza** at 154 Church St is a bustling late-night pizza outlet that serves hefty slices and pies"
},
"groundingChunkIndices": [
5
],
"confidenceScores": [
0.65264255
]
},
{
"segment": {
"startIndex": 1063,
"endIndex": 1140,
"text": "They offer takeout, delivery, and dine-in options and are open until 12:00 AM"
},
"groundingChunkIndices": [
5
],
"confidenceScores": [
0.7578804
]
},
{
"segment": {
"startIndex": 1142,
"endIndex": 1273,
"text": "* **Little Italy Pizza - Park Place** at 11 Park Pl prepares pizza by the slice, full pies, and calzones for takeout and delivery"
},
"groundingChunkIndices": [
6
],
"confidenceScores": [
0.39108777
]
},
{
"segment": {
"startIndex": 1275,
"endIndex": 1313,
"text": "They are open from 10:00 AM to 7:00 PM"
},
"groundingChunkIndices": [
6
],
"confidenceScores": [
0.8670869
]
},
{
"segment": {
"startIndex": 1315,
"endIndex": 1456,
"text": "* **Rosella's Pizzeria** at 164 William St is a casual pizza parlor that offers a variety of slices and pies, plus pastas, subs, and salads"
},
"groundingChunkIndices": [
7
],
"confidenceScores": [
0.58752716
]
},
{
"segment": {
"startIndex": 1458,
"endIndex": 1497,
"text": "They are open from 10:00 AM to 10:00 PM"
},
"groundingChunkIndices": [
7
],
"confidenceScores": [
0.86994255
]
},
{
"segment": {
"startIndex": 1499,
"endIndex": 1641,
"text": "* **Abitino’s Pizza Financial District** at 32 Broadway is open from 10:00 AM to 8:00 PM and offers takeout, delivery, and dine-in options"
},
"groundingChunkIndices": [
8
],
"confidenceScores": [
0.19525482
]
},
{
"segment": {
"startIndex": 1643,
"endIndex": 1752,
"text": "* **Traditas Pizza** at 83 Maiden Ln offers familiar slices and pies with a variety of toppings, plus pasta"
},
"groundingChunkIndices": [
9
],
"confidenceScores": [
0.9361249
]
},
{
"segment": {
"startIndex": 1754,
"endIndex": 1792,
"text": "They are open from 10:00 AM to 9:00 PM"
},
"groundingChunkIndices": [
9
],
"confidenceScores": [
0.87773615
]
},
{
"segment": {
"startIndex": 1794,
"endIndex": 1934,
"text": "* **Luna Pizza** at 225 Park Row is a simple eatery that serves a range of classic Italian dishes including NYC-style pizza and sandwiches"
},
"groundingChunkIndices": [
10
],
"confidenceScores": [
0.92122453
]
},
{
"segment": {
"startIndex": 1936,
"endIndex": 1974,
"text": "They are open from 10:00 AM to 8:40 PM"
},
"groundingChunkIndices": [
10
],
"confidenceScores": [
0.9085015
]
},
{
"segment": {
"startIndex": 1976,
"endIndex": 2084,
"text": "* **Zia Maria Little Italy** at 138 Mulberry St serves house-made pasta, pizza, and other Italian classics"
},
"groundingChunkIndices": [
11
],
"confidenceScores": [
0.94767386
]
},
{
"segment": {
"startIndex": 2086,
"endIndex": 2125,
"text": "They are open from 11:00 AM to 10:00 PM"
},
"groundingChunkIndices": [
11
],
"confidenceScores": [
0.004208436
]
},
{
"segment": {
"startIndex": 2127,
"endIndex": 2233,
"text": "* **Eataly** at 101 Liberty St is an Italian market that offers counters, restaurants, and cooking demos"
},
"groundingChunkIndices": [
12
],
"confidenceScores": [
0.4715432
]
},
{
"segment": {
"startIndex": 2235,
"endIndex": 2273,
"text": "They are open from 7:00 AM to 11:00 PM"
},
"groundingChunkIndices": [
12
],
"confidenceScores": [
0.0060814177
]
},
{
"segment": {
"startIndex": 2275,
"endIndex": 2387,
"text": "* **The Pie Guy Pizza** at 83-85 Baxter St serves New York-style pies along with slices and other comfort fare"
},
"groundingChunkIndices": [
13
],
"confidenceScores": [
0.88684046
]
},
{
"segment": {
"startIndex": 2389,
"endIndex": 2427,
"text": "They are open from 10:00 AM to 8:00 PM"
},
"groundingChunkIndices": [
13
],
"confidenceScores": [
0.8809011
]
},
{
"segment": {
"startIndex": 2429,
"endIndex": 2532,
"text": "* **Hank's Pizza** at 110 Trinity Pl offers New York-style pies and slices plus sandwiches and salads"
},
"groundingChunkIndices": [
14
],
"confidenceScores": [
0.43037176
]
},
{
"segment": {
"startIndex": 2534,
"endIndex": 2572,
"text": "They are open from 10:00 AM to 9:00 PM"
},
"groundingChunkIndices": [
14
],
"confidenceScores": [
0.88239455
]
},
{
"segment": {
"startIndex": 2574,
"endIndex": 2695,
"text": "* **Siena Pizza** at 14 Rector St specializes in pizzas with a variety of toppings, plus homemade meatballs and cannoli"
},
"groundingChunkIndices": [
15
],
"confidenceScores": [
0.760938
]
},
{
"segment": {
"startIndex": 2697,
"endIndex": 2736,
"text": "They are open from 11:00 AM to 11:00 PM"
},
"groundingChunkIndices": [
15
],
"confidenceScores": [
0.8966358
]
},
{
"segment": {
"startIndex": 2738,
"endIndex": 2860,
"text": "* **Underground Pizza** at 3 Hanover Square offers NYC-style & thin-crust specialty pies plus pasta & Italian sandwiches"
},
"groundingChunkIndices": [
16
],
"confidenceScores": [
0.6956693
]
},
{
"segment": {
"startIndex": 2862,
"endIndex": 2900,
"text": "They are open from 10:00 AM to 9:00 PM"
},
"groundingChunkIndices": [
16
],
"confidenceScores": [
0.90786636
]
},
{
"segment": {
"startIndex": 2902,
"endIndex": 3013,
"text": "* **Lucia Pizza Of SoHo** at 375 Canal St serves a variety of thin-crust pizzas by the slice, as well as pies"
},
"groundingChunkIndices": [
17
],
"confidenceScores": [
0.6947625
]
},
{
"segment": {
"startIndex": 3015,
"endIndex": 3054,
"text": "They are open from 11:00 AM to 10:00 PM"
},
"groundingChunkIndices": [
17
],
"confidenceScores": [
0.89399594
]
},
{
"segment": {
"startIndex": 3056,
"endIndex": 3149,
"text": "* **La Pizza & La Pasta** at 101 Liberty St is a casual restaurant for Italian comfort food"
},
"groundingChunkIndices": [
18
],
"confidenceScores": [
0.61462355
]
},
{
"segment": {
"startIndex": 3151,
"endIndex": 3190,
"text": "They are open from 11:00 AM to 10:00 PM"
},
"groundingChunkIndices": [
18
],
"confidenceScores": [
0.46315598
]
},
{
"segment": {
"startIndex": 3192,
"endIndex": 3276,
"text": "* **Serafina Tribeca** at 95 W Broadway offers thin-crust pizza and homemade pasta"
},
"groundingChunkIndices": [
19
],
"confidenceScores": [
0.8873792
]
},
{
"segment": {
"startIndex": 3278,
"endIndex": 3317,
"text": "They are open from 12:00 PM to 10:00 PM"
},
"groundingChunkIndices": [
19
],
"confidenceScores": [
0.0061006695
]
}
]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The groundingSupports array contains numerous entries where the startIndex and endIndex values are incorrect. They do not accurately point to the text segments within the main response text in content.parts[0].text.

For example, for the first support item:

  • The text is "* **Joe's Pizza** at 124 Fulton St is a long-time family-owned pizzeria that serves classic pies and slices".
  • Its actual starting index in the main text is 41, but the startIndex is given as 43. The endIndex is also incorrect.

This off-by-2 error seems to be present in many of the groundingSupports entries. This will break any functionality that relies on this grounding data. Please verify and correct all startIndex and endIndex values in this array to ensure the mock response is accurate.

@rlazo rlazo merged commit 34daa69 into main Jan 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants