HeadlinesBriefing favicon HeadlinesBriefing.com

Gemini 3 Pulls Live Premier League Stats with URL Context

DEV Community •
×

Retrieving up‑to‑date sports statistics with large language models is notoriously hard because training data lags and hallucinations creep in. A recent demo tackles this by using Gemini 3 Flash Preview with URL Context and Google Search tools, forcing the model to pull facts from official Premier League pages and reputable sites.

Running the notebook on Vertex AI in express mode, the author builds a Pydantic schema that mirrors the expected JSON. By setting the response MIME type to `application/json` and supplying the schema, Gemini consistently returns a valid object, while grounding metadata lets the system verify each field against the source.

Early trials revealed Gemini’s lazy behavior: it preferred internal knowledge over the supplied URLs. The fix was a dynamic source‑identification prompt that forces URL Context first, then falls back to Google Search. Adding strict URI extraction and mandatory source‑type rules eliminated hallucinated chunk IDs and ensured every quote matched a real page.

By combining structured output with real‑time grounding, developers can now query player stats for the 2025/2026 Premier League season without manual scraping. The approach scales to other domains—any dataset that lives behind a web API can be wrapped in a prompt, validated, and returned as a typed JSON object.