Add mocks for Grounding with Google Maps responses.#60
Conversation
Coverage Diff |
Summary of ChangesHello @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 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 AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
| "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 | ||
| ] | ||
| } | ||
| ] |
There was a problem hiding this comment.
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
textis"* **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
startIndexis given as 43. TheendIndexis 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.
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.