| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Convert all quickstarts to the Interactions API (#1275) * Migrate quickstart notebooks to Interactions API (google-genai>=2.0.0) Migrate all quickstart notebooks from the legacy generate_content API to the new Interactions API using client.interactions.create(). Changes include: - All notebooks use google-genai>=2.0.0 and the Interactions API - Fix typos: thiking, inlcuding, EMBEDDIG, respose_mime_type, uniiformize, ouput - Fix Youtube -> YouTube across notebooks - Standardize !pip -> %pip for Colab best practices - Standardize 2-space -> 4-space Python indentation - Fix Audio.ipynb: complete incomplete transcript example - Fix Enum.ipynb: correct broken link to JSON_mode - Fix Error_handling.ipynb: clarify retry mechanism text - Fix Grounding.ipynb: title heading H2 -> H1 - Fix Video_understanding.ipynb: extra H1 -> H2 - Fix Get_started_OpenAI_Compatibility.ipynb: remove duplicate cells - Add Get_started_Generate_Content.ipynb (legacy API reference) - Delete New_in_002.ipynb (deprecated) - Run nbfmt formatting on all notebooks * Fix gemini-code-assist review comments - Video_understanding: move %%html magic before #@title (cell magics must be first line) - Grounding: restore @param Colab selector for MODEL_ID - Grounding: clear RateLimitError (429) output from cell - Asynchronous_requests: clear FileNotFoundError/ModuleNotFoundError/NameError outputs * Update CONTRIBUTING.md and styleguide with Interactions API guidelines - Add 'Interactions API' section explaining when to use client.interactions.create() - Document exceptions (Veo, Imagen, Lyria, LiveAPI, embeddings, TTS, batch, caching, File API) - Update SDK version from >=1.0.0 to >=2.0.0 - Update code examples from generate_content() to interactions.create() - Fix typo: 'uimport' -> 'import' in styleguide * Address gemini-code-assist review feedback (round 2) - Video_understanding: fix #@title/%%html order (#@title first for Colab forms) - Grounding: fix copy-paste prompt error (vegetable glycerin → Gemma chess) - Grounding: fix .: typo in 'Summarize this video.:' - Grounding: fix invalid \$ escape sequences → raw strings - Grounding: use .text shortcut for consistent response access - Batch_mode: fix GOOGLE_API_KEY → GEMINI_API_KEY in markdown text - Function_calling: add safe step.arguments None check - 29 notebooks: standardize pip install to use single quotes - Re-run nbfmt on all files * Fix GOOGLE_API_KEY, pip comments, model selectors, and remaining generate_content Global fixes across all notebooks: - GOOGLE_API_KEY → GEMINI_API_KEY in 18 notebooks (markdown + code) - Add '# 2.0 is needed to use the interactions API' comment to pip install lines - Remove gemini-2.5-flash-lite from all model selectors (3.1 is GA) - Add gemini-3-flash-preview to standard model selectors where missing Per-notebook fixes: - Authentication.ipynb: migrate generate_content → interactions.create - Embeddings.ipynb: migrate generate_content → interactions.create - Error_handling.ipynb: migrate generate_content → interactions.create - File_Search.ipynb: migrate generate_content → interactions.create - Get_started.ipynb: migrate generate_content → interactions.create - Get_started_thinking.ipynb: migrate generate_content → interactions.create (13 cells) - Grounding.ipynb: migrate generate_content → interactions.create (2 cells) Re-run nbfmt on all files * Audio notebook fixes + global: remove thinking remark, add Interactions API note Audio.ipynb fixes: - Remove outdated thinking model remark (all recent models think) - 'Use PyDub' → 'Use for example PyDub' + explain base64 encoding - Use Markdown display for transcript and timestamp sections - Add @param form magic to youtube_url for easy editing - Fix missing closing parenthesis in count tokens section Global fixes: - Remove thinking model remark from 13 other notebooks - Add Interactions API note to 4 notebooks that were missing it (Authentication, Embeddings, Deep_Research, Lyria) * Asynchronous_requests: display downloaded images before using them * Major Get_started.ipynb revision + global fixes Get_started.ipynb changes: - Remove overview sentence, expand TOC with all features - Point to Generate_Content notebook instead of archive branch - Fix pip comment: 'breaking changes' → 'GA/Stable release' - Show interaction.steps structure and .text shortcut - Show downloaded image in multimodal section - Remove image resize before base64 (unnecessary) - Remove duplicate blog post cell - Add image generation intro section - Rephrase safety: models manage safety automatically, no configurable settings - Add 24h retention detail for conversation state - Explain model_json_schema() for JSON generation - Fix client.aio code - Make 'Upload an image file' self-contained - Fix incorrect media_resolution reference - Google Maps: 'around here' → 'around the Eiffel Tower in Paris' - Add YouTube processing explanation - Function calling: explain no auto-FC in Interactions API - Caching: automatic with Interactions API - Remove 'Run this cell to set everything up' cell - Move thought_signatures into thinking section - Move media_resolution after upload files Global fixes: - 'for an example' → 'for a walkthrough' in 39 notebooks * Deep Research: remove note, split cells; Get_started: add image URL approach Get_started_Deep_Research.ipynb: - Removed Interactions API note (model doesn't work with generateContent) - Split 'Collaborative planning' and 'Step 1' into separate cells - Split 'Tool configuration' and 'Restrict to Google Search only' into separate cells Get_started.ipynb: - Added image URL as first multimodal approach (simplest way) - Added transition text explaining base64 alternative * Get_started: simplify PDF to URL approach; Deep Research: fix indentation Get_started.ipynb: - Replace PDF upload example with direct URL approach (arxiv paper) - No need to download/upload PDFs, just pass the URL directly Get_started_Deep_Research.ipynb: - Fix prompt indentation for EV batteries research prompt * Get_started: add code execution header, migration section, media res per-file; GC: fix URL context Get_started.ipynb: - Add proper '## Code execution' section header before existing code - Add 'Migrating from Gemini 2.5' section before Next Steps - Update Media resolution with per-file details and default behavior - Update TOC with code execution and migration links - Fix .text shortcut (doesn't exist on ModelOutputStep) Get_started_Generate_Content.ipynb: - Fix URL context output: display(Markdown()) → Markdown() * Remove Not_yet_in_Interactions_API refs, update caching, fix stale links - Remove all references to Not_yet_in_Interactions_API.ipynb (won't be published) - Delete redirect cells in Caching.ipynb and Safety.ipynb - Remove Not_yet comments from File_Search, Grounding, Spatial_understanding, Video_understanding, Get_started_thinking - Get_started.ipynb: rewrite caching section with implicit caching explanation from docs, remove Caching.ipynb link - Counting_Tokens.ipynb: update Caching.ipynb links to docs URL - Get_started_Generate_Content.ipynb: fix URL context Markdown display * Batch_mode: fix model selector order (default first) * Add gemini-3-flash-preview to model selectors in Code_Execution and thinking_REST * Counting_Tokens: use URIs directly for inline content, keep File API downloads Simplified multimodal token counting: - Image inline: pass URL directly via types.Part(file_data=...) instead of downloading with curl and loading with PIL - Audio: still downloads for File API upload (required) - Removed unnecessary curl/PIL dependencies for inline examples * Code_Execution: use image URI directly, remove curl/base64 - Replace curl download + base64 encoding with direct image URI - Fix wrong mime_type (was image/jpeg for a PNG file) - Simplifies the notebook and avoids transient image processing errors * Fix Error_handling headings, Enum model selector, Embeddings TOC + .text bug Error_handling.ipynb: - Add '## Error handling strategies' before 'Automatic retries' so sections aren't grouped under 'Setup your API key' in Colab TOC Enum.ipynb: - Add gemini-3-flash-preview to model selector (was missing) Embeddings.ipynb: - Add anchor links to TOC entries - Add anchor tags to section headers - Fix last cell: final_answer.text → final_answer.steps[-1].content[0].text - Add gemini-3-flash-preview to the RAG model selector * Function_calling: major refactor for Interactions vs GC clarity; robotics-er: fix pip Function_calling.ipynb: - Clarify Auto FC is client.chats only (not interactions API) - Add prints to add/subtract/multiply/divide functions - Explain .to_json_dict() and its use with interactions API - Rewrite manual FC intro as THE way for interactions API - Update explanations: interactions uses previous_interaction_id, not chat sessions - Fix indentation in compositional FC code - Mark AUTO/ANY/NONE modes as generateContent features - Show GC code example for ANY mode with tool_config - Rewrite Next Steps for both APIs (fix weird GenerateContentConfig text) gemini-robotics-er.ipynb: - Remove interactions API comment from pip install (not using it) * Add gemini-3-flash-preview to all model selectors; create Not_yet guide; fix File_API Global: - Add gemini-3-flash-preview to model selector dropdown in 19 notebooks (was set as default but missing from the list) Not_yet_in_Interactions_API.ipynb (NEW): - Document features only available with generateContent: - Automatic Function Calling (chats only) - Function Calling Modes (AUTO/ANY/NONE via tool_config) - Safety Settings Configuration - Explicit Context Caching - Batch API - Include code examples for both APIs where applicable File_API.ipynb: - Update intro text: generateContent/streamGenerateContent → interactions API * Major batch: migrate TTS/Lyria/NanoBanana to interactions API, rewrite thinking Get_started_TTS.ipynb: - Migrate all generate_content → interactions.create - Update play_audio helper for interactions response structure - Fix blob extraction patterns Get_Started_Nano_Banana.ipynb: - Migrate all 22 generate_content → interactions.create - Update display_response helper for interactions steps - Fix grounding metadata extraction - Fix duplicate SDK install comment Get_started_Lyria.ipynb: - Migrate all generate_content → interactions.create - Update display_lyria_response for interactions steps - Replace 'Using Interactions API' section with GC reference - Remove redundant interaction demo cells Get_started_thinking.ipynb: - Remove Gemini 2.5/3 generation-specific language - thinking_budget → thinking_level everywhere - generate_content → interactions.create in code cells - Fix response patterns (candidates[0].content.parts → interaction.steps) - Merge Gemini 3 section into main flow - thinking_budget kept only in legacy migration section Other fixes: - Remove interactions API comments from pip installs in imagen, LearnLM, LiveAPI, LiveAPI_tools, LyriaRealTime (not using interactions API) - OpenAI Compat: revert SDK comment - Interactions API notebook: remove colab button, add colab icons to table * Fix grounding, models, delete Image_out Grounding.ipynb: - YouTube: use video type input instead of url_context - PDF by URL: show both methods (direct URI + url_context) - Image by URL: show both methods (direct URI + url_context) Get_started.ipynb: - YouTube: use video type input instead of url_context Not_yet_in_Interactions_API.ipynb: - Add Maps grounding sources section (widget + citations) - Update TOC Models.ipynb: - Populate outputs using external API key (50 models listed) Image_out.ipynb: - Deleted (unused) * JSON_mode: explain response_format, add Pydantic model_json_schema - Explain why response_format with mime_type application/json is needed (prevents markdown wrapping / explanatory text) - 'The newest models allow you' → 'Another option is to pass...' - Replace hand-written JSON Schema with Pydantic + .model_json_schema() - Add model_validate_json() example for type-safe validation - Keep TypedDict fallback for non-Pydantic users - Update Next Steps with links to streaming, tools, and JSON schema docs * PDF_Files, Safety, Prompting updates PDF_Files.ipynb: - Add 'Read a PDF by URL' section (pass URI directly, no upload needed) - Move Setup/Configure API key to level 3 headings - Fix generateContent reference in Learning more Safety.ipynb: - Convert to info-only stub (like Caching notebook) - Explain that Interactions API uses built-in safety - Keep safety categories table and generateContent example as reference - Link to archived version for runnable code Prompting.ipynb: - Move Setup/Configure API key to level 3 headings - Add image-by-URI example (pass URL directly) * Fix remaining thinking_budget→thinking_level, Lyria text Thinking: Replace 4 remaining thinking_budget usages with thinking_level - Cells 23,27: thinking_budget=0 → thinking_level='none' - Cells 54,58: thinking_budget=thinking_budget → thinking_level=thinking_level - Cell 64 (legacy section) intentionally kept Lyria: Fix cell 13 text referencing generate_content * Final cleanups: Webhooks, Video, Streaming, Spatial Webhooks: - Remove SDK 2.0 minimum version requirements Video_understanding: - Correct Gemini 2.0/2.5 references to just Gemini - Remove video iframe player at the top and keep standard links Streaming: - Separate response declaration from loops to improve indentation/readability - Clarify client.aio async usage and properties - Add What's Next section at the end Spatial_understanding: - Translate Japanese bento prompt back to English - Completely remove experimental Segmentation section (which is no longer supported) * Apply PR #16 feedback audit fixes Addressed feedback for multiple notebooks: - Get_started & Get_started_Generate_Content: Re-executed and populated outputs, fixed notebook format and Colab userdata fallback. - Counting_Tokens: Replaced downloads with direct URI passing in cells 30, 32. - Embeddings: Added missing TOC links. - Get_started_TTS: Changed !pip to %pip and removed SDK 2.0 comment. - Imagen/LearnLM/LyriaRealTime: Removed unnecessary >=2.0.0 pins. - Spatial_understanding: Removed segmentation mention in cell 13. - Code_Execution: Populated outputs, added cat.png asset for execution. - Video_understanding: Removed pip install comment. - Grounding: Updated TOC. * Added new notebook Basic_Code_Review to examples (#689) --------- Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> * Add Basic_Code_Review example to README (#1218) * Add Basic_Code_Review example to README * Update examples/prompting/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Added example for gemini api used to extract insights from github #923 #887 (#1150) * added example for gemini api used to extract insights from github --------- Co-authored-by: kkorpal <kkorpal@google.com> * Add example: EU AI Act compliance checking with Gemini function calling + Agent Module (#1167) * Add EU AI Act compliance example with Gemini function calling + Agent Module * style: use triple-quoted string per review feedback * fix: correct API schema + formatting per review - status["ethics"] -> status["ai_compliance"] (v0.9.21 schema rename; was the KeyError that blocked the reviewer run) - Remove unnecessary backslash line-continuations in the compliance_run prompt string; indent body; newline before closing """ - Replace static 22-row module table with dynamic discovery pointer (/api/status, /api/demo, /llms.txt) so the snapshot never goes stale - Branding: "ethics modules" -> "AI Compliance modules" in human-facing markdown; vertical slug documented as ai-compliance with ethics as legacy alias (both still accepted by the API) - Correct ETH_001 EU AI Act mapping (Art. 9 + 10, not 10 + 13) * fix: prevent trial key collision on reruns Follow-up to the schema/formatting fixes. Colab testing surfaced a runtime bug: the Agent Module API returns a masked preview of an existing trial key (e.g. `am_trial_841...f660`) if you request a new one while the old one is still active, and the original notebook wrapper blindly stored the preview — corrupting _trial_key and breaking every downstream retrieve_compliance_logic call. Changes: - Generate a unique per-run agent_id (uuid suffix) so reruns within 24 hours do not collide with a still-active trial on the server - Make get_trial_key idempotent (short-circuit if _trial_key already set in this session) so Gemini tool loops cannot re-trigger it - Detect status=="already_active" in the MCP response and refuse to store the masked preview; surface a clear error instead - Remove get_trial_key from the tools list passed to Gemini. Trial bootstrap is a setup step, not a runtime tool — the model should only see retrieve_compliance_logic and submit_proof_of_value - Reframe the cell 27 preamble to explain the setup/runtime split * fix: pass both token and trial_key to submit_pov MCP tool * fix: print full chat history so cell 30 shows the complete compliance report * chore: save executed notebook with cell outputs * fix: add Colab button + README link for CI compliance - Add Colab badge to notebook title cell (tfo-notebook-buttons CI check) - Add notebook entry to examples/README.md table (new-example-links CI check) * chore: retrigger CI checks * Fix notebook lint (inclusive_language) + nbfmt format - Rewords 'Agent-native' to 'Purpose-built for autonomous agents' in the branding cell to clear google::inclusive_language lint flag - Applies tensorflow_docs.tools.nbfmt formatting pass to clear Notebook format check - No other content changes; all 21 cell outputs preserved * Fix colab.name metadata + cell 30 prompt (third-person) to clear nbfmt + second_person checks --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * add gemini-3.5-flash (#1232) * New agent notebook (#1233) * Fixing typos * Adding links to the agents notebooks (#1234) * docs: fix typos and capitalization consistency in README (#1240) * docs: fix typos and capitalization consistency in README * docs: apply gemini suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Bump qs from 6.15.1 to 6.15.2 in /quickstarts/file-api (#1238) Bumps [qs](https://github.com/ljharb/qs) from 6.15.1 to 6.15.2. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.15.1...v6.15.2) --- updated-dependencies: - dependency-name: qs dependency-version: 6.15.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix scale= command in Lyria realtime quickstart (#1236) The scale= parser compared the raw prompt (which still contains the 'scale=' prefix) against enum names like A_FLAT_MAJOR_F_MINOR, so the match never succeeded and the command always printed 'Matching enum not found.' Strip the 'scale=' prefix before comparing, matching how the sibling bpm= and top_k= handlers already work. * update live api ws cookbook (#1223) * Interactions steps (#1237) * Merge origin/main into interaction-steps and resolve conflict * steps * Add environment support * work * cleanup * format * cleanup * Add back execution_count * Standardize Colab buttons and fix URLs across edited notebooks * feat: update visual model names to GA and add video-to-image example (#1244) * feat: update visual model names to GA and add video-to-image example - Updated gemini-3-pro-image-preview to gemini-3-pro-image (Nano Banana Pro GA) - Updated gemini-3.1-flash-image-preview to gemini-3.1-flash-image (Nano Banana 2 GA) - Added a new video-to-image example in Get_Started_Nano_Banana.ipynb - Formatted modified notebooks with nbfmt * feat(batch): add gemini-3.5-flash to model selector * style: format banana notebook to clean up PR diff * style: trim thought signature in Get_Started_Nano_Banana notebook To reduce file size and prevent git/diff hanging on massive cryptographically signed binary thoughts. * refactor: update Live API configuration, transcription support, and input handling for model version gemini-3.1-flash-live-preview (#1224) * Update Get_started_LiveAPI (#1222) * Update Get_started_LiveAPI * remove interactivity. * session resumption update. * run. * nbfmt * Resizing the NB notebook (#1245) * feat: add example for custom FPS in Grounding notebook (#1243) * feat: add example for custom FPS in Grounding notebook * Format custom frame rate explanation in Grounding.ipynb * Fix formatting of YouTube link and response generation * Fix formatting issues in Grounding.ipynb * Fix YouTube link formatting in Grounding.ipynb * docs: fix typographical and spelling errors in styleguide and quickstarts (#1253) * docs: fix typographical and spelling errors in styleguide.md * docs: fix typo in Image_out notebook header * fix: remove leftover google-generativeai imports from two notebooks (#1246) Two notebooks had leftover `import google.generativeai as genai` lines from a prior partial migration. Both notebooks otherwise use the new `google-genai` SDK correctly via `from google import genai`, and neither notebook's `%pip install` cell installs `google-generativeai`. On a clean Colab kernel the dead imports raise `ModuleNotFoundError`; on a kernel where the legacy package happens to be pre-installed, the dead imports silently shadow the working `genai` namespace. - quickstarts/Spatial_understanding.ipynb cell 19: delete the dead `import google.generativeai as genai` line; the rest of the cell (PIL.Image, io, os, requests, BytesIO) is genuinely used downstream - examples/Animated_Story_Video_Generation_gemini.ipynb cell 7: delete the cell entirely. The cell holds only the dead import No behavioural change beyond removing dead code that would otherwise fail or shadow at notebook runtime. * fix(examples): replace deprecated Live API session.send in Animated Story notebook (#1249) Use session.send_client_content(turns=..., turn_complete=True) instead of the deprecated session.send(input=..., end_of_turn=True), which emits a DeprecationWarning in google-genai (removal not before Q3 2025). Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct case-sensitive links to Search_Grounding/Code_Execution (#1248) Three cross-notebook links used lowercase filenames (Search_grounding.ipynb, Code_execution.ipynb) that 404 on case-sensitive file systems like GitHub. Point them at the actual files: Search_Grounding.ipynb and Code_Execution.ipynb. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct broken Contributing guide link in Template.ipynb (#1247) The template linked the contributing guide as `Contributing.mg`, which is both a typo (`.mg`) and a path that does not exist next to the notebook. Point it at the repo's CONTRIBUTING.md using the same absolute GitHub URL the notebook already uses elsewhere. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix: align error handling notebook with google-genai retries (#1229) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README (#1257) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README * Update quickstarts/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * feat: add Live Translation quickstart tutorial and examples (#1259) * feat: add Live Translation quickstart tutorial and examples * chore: clean up notebook metadata and reorder cell output attributes * refactor: Live Translation notebook and script from cookbook (#1261) * Prohibit yt-dlp usage for YouTube content (#1264) Added a restriction against using yt-dlp for downloading or streaming YouTube content due to terms of service violations. * Sketch2Paint using Gemini (#790) --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * Add service account auth section with IAM roles for Gemini, File, and… (#1258) * Add service account auth section with IAM roles for Gemini, File, and Vertex AI APIs * Remove service account section, add link to GCP auth docs instead * Add Vertex AI authentication documentation link * Fix embedding types & casing (#1032) * Fix embedding types & casing (fixes #1030) * Fix query task_type and indentation style violations * fix indentation style * fixed the formatting and linting issue * update model ID * fix formatting * Update styleguide with API key and crypto restrictions Added guidelines for API key usage and restrictions on crypto topics. * Manually updating the get started notebook * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Delete quickstarts/Not_yet_in_Interactions_API.ipynb * style, fix: format notebooks, update missing outputs, bump SDK versions, and align model selectors * fix: update Get_started_Lyria.ipynb to use lowercase response_modalities without config wrapper * docs: add type: text to response_format example in CONTRIBUTING.md * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update quickstarts/Enum.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: update Error_handling.ipynb to pass http_options on genai.Client instead of config wrapper * fix: mass update google-genai to >=2.9.0 and replace GOOGLE_API_KEY with GEMINI_API_KEY across repository * style: format all notebooks with nbfmt to comply with TensorFlow docs style --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Shipra <ships3040@gmail.com> Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Rohan Dwivedi <165134541+ROHANDWIVEDI2005@users.noreply.github.com> Co-authored-by: AgentModuleAdmin <0agentmodule@gmail.com> Co-authored-by: Patrick Loeber <50772274+patrickloeber@users.noreply.github.com> Co-authored-by: Irfaan Mansoori <irfaanmansoori100@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aryan Motgi <85900811+aryanmotgi@users.noreply.github.com> Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com> Co-authored-by: Mark Daoust <markdaoust@google.com> Co-authored-by: August Cayzer <august@cayzer.me> Co-authored-by: Sri Ujwal <113922053+sbeeredd04@users.noreply.github.com> Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> Co-authored-by: qianzhu / Lucien <2729478828@qq.com> Co-authored-by: Naveen Kumar G <naveen13524g@gmail.com> Co-authored-by: Nitin Tiwari <37960279+NSTiwari@users.noreply.github.com> Co-authored-by: Anika Islam <172253577+Surjasa@users.noreply.github.com> | 2 个月前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Convert all quickstarts to the Interactions API (#1275) * Migrate quickstart notebooks to Interactions API (google-genai>=2.0.0) Migrate all quickstart notebooks from the legacy generate_content API to the new Interactions API using client.interactions.create(). Changes include: - All notebooks use google-genai>=2.0.0 and the Interactions API - Fix typos: thiking, inlcuding, EMBEDDIG, respose_mime_type, uniiformize, ouput - Fix Youtube -> YouTube across notebooks - Standardize !pip -> %pip for Colab best practices - Standardize 2-space -> 4-space Python indentation - Fix Audio.ipynb: complete incomplete transcript example - Fix Enum.ipynb: correct broken link to JSON_mode - Fix Error_handling.ipynb: clarify retry mechanism text - Fix Grounding.ipynb: title heading H2 -> H1 - Fix Video_understanding.ipynb: extra H1 -> H2 - Fix Get_started_OpenAI_Compatibility.ipynb: remove duplicate cells - Add Get_started_Generate_Content.ipynb (legacy API reference) - Delete New_in_002.ipynb (deprecated) - Run nbfmt formatting on all notebooks * Fix gemini-code-assist review comments - Video_understanding: move %%html magic before #@title (cell magics must be first line) - Grounding: restore @param Colab selector for MODEL_ID - Grounding: clear RateLimitError (429) output from cell - Asynchronous_requests: clear FileNotFoundError/ModuleNotFoundError/NameError outputs * Update CONTRIBUTING.md and styleguide with Interactions API guidelines - Add 'Interactions API' section explaining when to use client.interactions.create() - Document exceptions (Veo, Imagen, Lyria, LiveAPI, embeddings, TTS, batch, caching, File API) - Update SDK version from >=1.0.0 to >=2.0.0 - Update code examples from generate_content() to interactions.create() - Fix typo: 'uimport' -> 'import' in styleguide * Address gemini-code-assist review feedback (round 2) - Video_understanding: fix #@title/%%html order (#@title first for Colab forms) - Grounding: fix copy-paste prompt error (vegetable glycerin → Gemma chess) - Grounding: fix .: typo in 'Summarize this video.:' - Grounding: fix invalid \$ escape sequences → raw strings - Grounding: use .text shortcut for consistent response access - Batch_mode: fix GOOGLE_API_KEY → GEMINI_API_KEY in markdown text - Function_calling: add safe step.arguments None check - 29 notebooks: standardize pip install to use single quotes - Re-run nbfmt on all files * Fix GOOGLE_API_KEY, pip comments, model selectors, and remaining generate_content Global fixes across all notebooks: - GOOGLE_API_KEY → GEMINI_API_KEY in 18 notebooks (markdown + code) - Add '# 2.0 is needed to use the interactions API' comment to pip install lines - Remove gemini-2.5-flash-lite from all model selectors (3.1 is GA) - Add gemini-3-flash-preview to standard model selectors where missing Per-notebook fixes: - Authentication.ipynb: migrate generate_content → interactions.create - Embeddings.ipynb: migrate generate_content → interactions.create - Error_handling.ipynb: migrate generate_content → interactions.create - File_Search.ipynb: migrate generate_content → interactions.create - Get_started.ipynb: migrate generate_content → interactions.create - Get_started_thinking.ipynb: migrate generate_content → interactions.create (13 cells) - Grounding.ipynb: migrate generate_content → interactions.create (2 cells) Re-run nbfmt on all files * Audio notebook fixes + global: remove thinking remark, add Interactions API note Audio.ipynb fixes: - Remove outdated thinking model remark (all recent models think) - 'Use PyDub' → 'Use for example PyDub' + explain base64 encoding - Use Markdown display for transcript and timestamp sections - Add @param form magic to youtube_url for easy editing - Fix missing closing parenthesis in count tokens section Global fixes: - Remove thinking model remark from 13 other notebooks - Add Interactions API note to 4 notebooks that were missing it (Authentication, Embeddings, Deep_Research, Lyria) * Asynchronous_requests: display downloaded images before using them * Major Get_started.ipynb revision + global fixes Get_started.ipynb changes: - Remove overview sentence, expand TOC with all features - Point to Generate_Content notebook instead of archive branch - Fix pip comment: 'breaking changes' → 'GA/Stable release' - Show interaction.steps structure and .text shortcut - Show downloaded image in multimodal section - Remove image resize before base64 (unnecessary) - Remove duplicate blog post cell - Add image generation intro section - Rephrase safety: models manage safety automatically, no configurable settings - Add 24h retention detail for conversation state - Explain model_json_schema() for JSON generation - Fix client.aio code - Make 'Upload an image file' self-contained - Fix incorrect media_resolution reference - Google Maps: 'around here' → 'around the Eiffel Tower in Paris' - Add YouTube processing explanation - Function calling: explain no auto-FC in Interactions API - Caching: automatic with Interactions API - Remove 'Run this cell to set everything up' cell - Move thought_signatures into thinking section - Move media_resolution after upload files Global fixes: - 'for an example' → 'for a walkthrough' in 39 notebooks * Deep Research: remove note, split cells; Get_started: add image URL approach Get_started_Deep_Research.ipynb: - Removed Interactions API note (model doesn't work with generateContent) - Split 'Collaborative planning' and 'Step 1' into separate cells - Split 'Tool configuration' and 'Restrict to Google Search only' into separate cells Get_started.ipynb: - Added image URL as first multimodal approach (simplest way) - Added transition text explaining base64 alternative * Get_started: simplify PDF to URL approach; Deep Research: fix indentation Get_started.ipynb: - Replace PDF upload example with direct URL approach (arxiv paper) - No need to download/upload PDFs, just pass the URL directly Get_started_Deep_Research.ipynb: - Fix prompt indentation for EV batteries research prompt * Get_started: add code execution header, migration section, media res per-file; GC: fix URL context Get_started.ipynb: - Add proper '## Code execution' section header before existing code - Add 'Migrating from Gemini 2.5' section before Next Steps - Update Media resolution with per-file details and default behavior - Update TOC with code execution and migration links - Fix .text shortcut (doesn't exist on ModelOutputStep) Get_started_Generate_Content.ipynb: - Fix URL context output: display(Markdown()) → Markdown() * Remove Not_yet_in_Interactions_API refs, update caching, fix stale links - Remove all references to Not_yet_in_Interactions_API.ipynb (won't be published) - Delete redirect cells in Caching.ipynb and Safety.ipynb - Remove Not_yet comments from File_Search, Grounding, Spatial_understanding, Video_understanding, Get_started_thinking - Get_started.ipynb: rewrite caching section with implicit caching explanation from docs, remove Caching.ipynb link - Counting_Tokens.ipynb: update Caching.ipynb links to docs URL - Get_started_Generate_Content.ipynb: fix URL context Markdown display * Batch_mode: fix model selector order (default first) * Add gemini-3-flash-preview to model selectors in Code_Execution and thinking_REST * Counting_Tokens: use URIs directly for inline content, keep File API downloads Simplified multimodal token counting: - Image inline: pass URL directly via types.Part(file_data=...) instead of downloading with curl and loading with PIL - Audio: still downloads for File API upload (required) - Removed unnecessary curl/PIL dependencies for inline examples * Code_Execution: use image URI directly, remove curl/base64 - Replace curl download + base64 encoding with direct image URI - Fix wrong mime_type (was image/jpeg for a PNG file) - Simplifies the notebook and avoids transient image processing errors * Fix Error_handling headings, Enum model selector, Embeddings TOC + .text bug Error_handling.ipynb: - Add '## Error handling strategies' before 'Automatic retries' so sections aren't grouped under 'Setup your API key' in Colab TOC Enum.ipynb: - Add gemini-3-flash-preview to model selector (was missing) Embeddings.ipynb: - Add anchor links to TOC entries - Add anchor tags to section headers - Fix last cell: final_answer.text → final_answer.steps[-1].content[0].text - Add gemini-3-flash-preview to the RAG model selector * Function_calling: major refactor for Interactions vs GC clarity; robotics-er: fix pip Function_calling.ipynb: - Clarify Auto FC is client.chats only (not interactions API) - Add prints to add/subtract/multiply/divide functions - Explain .to_json_dict() and its use with interactions API - Rewrite manual FC intro as THE way for interactions API - Update explanations: interactions uses previous_interaction_id, not chat sessions - Fix indentation in compositional FC code - Mark AUTO/ANY/NONE modes as generateContent features - Show GC code example for ANY mode with tool_config - Rewrite Next Steps for both APIs (fix weird GenerateContentConfig text) gemini-robotics-er.ipynb: - Remove interactions API comment from pip install (not using it) * Add gemini-3-flash-preview to all model selectors; create Not_yet guide; fix File_API Global: - Add gemini-3-flash-preview to model selector dropdown in 19 notebooks (was set as default but missing from the list) Not_yet_in_Interactions_API.ipynb (NEW): - Document features only available with generateContent: - Automatic Function Calling (chats only) - Function Calling Modes (AUTO/ANY/NONE via tool_config) - Safety Settings Configuration - Explicit Context Caching - Batch API - Include code examples for both APIs where applicable File_API.ipynb: - Update intro text: generateContent/streamGenerateContent → interactions API * Major batch: migrate TTS/Lyria/NanoBanana to interactions API, rewrite thinking Get_started_TTS.ipynb: - Migrate all generate_content → interactions.create - Update play_audio helper for interactions response structure - Fix blob extraction patterns Get_Started_Nano_Banana.ipynb: - Migrate all 22 generate_content → interactions.create - Update display_response helper for interactions steps - Fix grounding metadata extraction - Fix duplicate SDK install comment Get_started_Lyria.ipynb: - Migrate all generate_content → interactions.create - Update display_lyria_response for interactions steps - Replace 'Using Interactions API' section with GC reference - Remove redundant interaction demo cells Get_started_thinking.ipynb: - Remove Gemini 2.5/3 generation-specific language - thinking_budget → thinking_level everywhere - generate_content → interactions.create in code cells - Fix response patterns (candidates[0].content.parts → interaction.steps) - Merge Gemini 3 section into main flow - thinking_budget kept only in legacy migration section Other fixes: - Remove interactions API comments from pip installs in imagen, LearnLM, LiveAPI, LiveAPI_tools, LyriaRealTime (not using interactions API) - OpenAI Compat: revert SDK comment - Interactions API notebook: remove colab button, add colab icons to table * Fix grounding, models, delete Image_out Grounding.ipynb: - YouTube: use video type input instead of url_context - PDF by URL: show both methods (direct URI + url_context) - Image by URL: show both methods (direct URI + url_context) Get_started.ipynb: - YouTube: use video type input instead of url_context Not_yet_in_Interactions_API.ipynb: - Add Maps grounding sources section (widget + citations) - Update TOC Models.ipynb: - Populate outputs using external API key (50 models listed) Image_out.ipynb: - Deleted (unused) * JSON_mode: explain response_format, add Pydantic model_json_schema - Explain why response_format with mime_type application/json is needed (prevents markdown wrapping / explanatory text) - 'The newest models allow you' → 'Another option is to pass...' - Replace hand-written JSON Schema with Pydantic + .model_json_schema() - Add model_validate_json() example for type-safe validation - Keep TypedDict fallback for non-Pydantic users - Update Next Steps with links to streaming, tools, and JSON schema docs * PDF_Files, Safety, Prompting updates PDF_Files.ipynb: - Add 'Read a PDF by URL' section (pass URI directly, no upload needed) - Move Setup/Configure API key to level 3 headings - Fix generateContent reference in Learning more Safety.ipynb: - Convert to info-only stub (like Caching notebook) - Explain that Interactions API uses built-in safety - Keep safety categories table and generateContent example as reference - Link to archived version for runnable code Prompting.ipynb: - Move Setup/Configure API key to level 3 headings - Add image-by-URI example (pass URL directly) * Fix remaining thinking_budget→thinking_level, Lyria text Thinking: Replace 4 remaining thinking_budget usages with thinking_level - Cells 23,27: thinking_budget=0 → thinking_level='none' - Cells 54,58: thinking_budget=thinking_budget → thinking_level=thinking_level - Cell 64 (legacy section) intentionally kept Lyria: Fix cell 13 text referencing generate_content * Final cleanups: Webhooks, Video, Streaming, Spatial Webhooks: - Remove SDK 2.0 minimum version requirements Video_understanding: - Correct Gemini 2.0/2.5 references to just Gemini - Remove video iframe player at the top and keep standard links Streaming: - Separate response declaration from loops to improve indentation/readability - Clarify client.aio async usage and properties - Add What's Next section at the end Spatial_understanding: - Translate Japanese bento prompt back to English - Completely remove experimental Segmentation section (which is no longer supported) * Apply PR #16 feedback audit fixes Addressed feedback for multiple notebooks: - Get_started & Get_started_Generate_Content: Re-executed and populated outputs, fixed notebook format and Colab userdata fallback. - Counting_Tokens: Replaced downloads with direct URI passing in cells 30, 32. - Embeddings: Added missing TOC links. - Get_started_TTS: Changed !pip to %pip and removed SDK 2.0 comment. - Imagen/LearnLM/LyriaRealTime: Removed unnecessary >=2.0.0 pins. - Spatial_understanding: Removed segmentation mention in cell 13. - Code_Execution: Populated outputs, added cat.png asset for execution. - Video_understanding: Removed pip install comment. - Grounding: Updated TOC. * Added new notebook Basic_Code_Review to examples (#689) --------- Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> * Add Basic_Code_Review example to README (#1218) * Add Basic_Code_Review example to README * Update examples/prompting/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Added example for gemini api used to extract insights from github #923 #887 (#1150) * added example for gemini api used to extract insights from github --------- Co-authored-by: kkorpal <kkorpal@google.com> * Add example: EU AI Act compliance checking with Gemini function calling + Agent Module (#1167) * Add EU AI Act compliance example with Gemini function calling + Agent Module * style: use triple-quoted string per review feedback * fix: correct API schema + formatting per review - status["ethics"] -> status["ai_compliance"] (v0.9.21 schema rename; was the KeyError that blocked the reviewer run) - Remove unnecessary backslash line-continuations in the compliance_run prompt string; indent body; newline before closing """ - Replace static 22-row module table with dynamic discovery pointer (/api/status, /api/demo, /llms.txt) so the snapshot never goes stale - Branding: "ethics modules" -> "AI Compliance modules" in human-facing markdown; vertical slug documented as ai-compliance with ethics as legacy alias (both still accepted by the API) - Correct ETH_001 EU AI Act mapping (Art. 9 + 10, not 10 + 13) * fix: prevent trial key collision on reruns Follow-up to the schema/formatting fixes. Colab testing surfaced a runtime bug: the Agent Module API returns a masked preview of an existing trial key (e.g. `am_trial_841...f660`) if you request a new one while the old one is still active, and the original notebook wrapper blindly stored the preview — corrupting _trial_key and breaking every downstream retrieve_compliance_logic call. Changes: - Generate a unique per-run agent_id (uuid suffix) so reruns within 24 hours do not collide with a still-active trial on the server - Make get_trial_key idempotent (short-circuit if _trial_key already set in this session) so Gemini tool loops cannot re-trigger it - Detect status=="already_active" in the MCP response and refuse to store the masked preview; surface a clear error instead - Remove get_trial_key from the tools list passed to Gemini. Trial bootstrap is a setup step, not a runtime tool — the model should only see retrieve_compliance_logic and submit_proof_of_value - Reframe the cell 27 preamble to explain the setup/runtime split * fix: pass both token and trial_key to submit_pov MCP tool * fix: print full chat history so cell 30 shows the complete compliance report * chore: save executed notebook with cell outputs * fix: add Colab button + README link for CI compliance - Add Colab badge to notebook title cell (tfo-notebook-buttons CI check) - Add notebook entry to examples/README.md table (new-example-links CI check) * chore: retrigger CI checks * Fix notebook lint (inclusive_language) + nbfmt format - Rewords 'Agent-native' to 'Purpose-built for autonomous agents' in the branding cell to clear google::inclusive_language lint flag - Applies tensorflow_docs.tools.nbfmt formatting pass to clear Notebook format check - No other content changes; all 21 cell outputs preserved * Fix colab.name metadata + cell 30 prompt (third-person) to clear nbfmt + second_person checks --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * add gemini-3.5-flash (#1232) * New agent notebook (#1233) * Fixing typos * Adding links to the agents notebooks (#1234) * docs: fix typos and capitalization consistency in README (#1240) * docs: fix typos and capitalization consistency in README * docs: apply gemini suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Bump qs from 6.15.1 to 6.15.2 in /quickstarts/file-api (#1238) Bumps [qs](https://github.com/ljharb/qs) from 6.15.1 to 6.15.2. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.15.1...v6.15.2) --- updated-dependencies: - dependency-name: qs dependency-version: 6.15.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix scale= command in Lyria realtime quickstart (#1236) The scale= parser compared the raw prompt (which still contains the 'scale=' prefix) against enum names like A_FLAT_MAJOR_F_MINOR, so the match never succeeded and the command always printed 'Matching enum not found.' Strip the 'scale=' prefix before comparing, matching how the sibling bpm= and top_k= handlers already work. * update live api ws cookbook (#1223) * Interactions steps (#1237) * Merge origin/main into interaction-steps and resolve conflict * steps * Add environment support * work * cleanup * format * cleanup * Add back execution_count * Standardize Colab buttons and fix URLs across edited notebooks * feat: update visual model names to GA and add video-to-image example (#1244) * feat: update visual model names to GA and add video-to-image example - Updated gemini-3-pro-image-preview to gemini-3-pro-image (Nano Banana Pro GA) - Updated gemini-3.1-flash-image-preview to gemini-3.1-flash-image (Nano Banana 2 GA) - Added a new video-to-image example in Get_Started_Nano_Banana.ipynb - Formatted modified notebooks with nbfmt * feat(batch): add gemini-3.5-flash to model selector * style: format banana notebook to clean up PR diff * style: trim thought signature in Get_Started_Nano_Banana notebook To reduce file size and prevent git/diff hanging on massive cryptographically signed binary thoughts. * refactor: update Live API configuration, transcription support, and input handling for model version gemini-3.1-flash-live-preview (#1224) * Update Get_started_LiveAPI (#1222) * Update Get_started_LiveAPI * remove interactivity. * session resumption update. * run. * nbfmt * Resizing the NB notebook (#1245) * feat: add example for custom FPS in Grounding notebook (#1243) * feat: add example for custom FPS in Grounding notebook * Format custom frame rate explanation in Grounding.ipynb * Fix formatting of YouTube link and response generation * Fix formatting issues in Grounding.ipynb * Fix YouTube link formatting in Grounding.ipynb * docs: fix typographical and spelling errors in styleguide and quickstarts (#1253) * docs: fix typographical and spelling errors in styleguide.md * docs: fix typo in Image_out notebook header * fix: remove leftover google-generativeai imports from two notebooks (#1246) Two notebooks had leftover `import google.generativeai as genai` lines from a prior partial migration. Both notebooks otherwise use the new `google-genai` SDK correctly via `from google import genai`, and neither notebook's `%pip install` cell installs `google-generativeai`. On a clean Colab kernel the dead imports raise `ModuleNotFoundError`; on a kernel where the legacy package happens to be pre-installed, the dead imports silently shadow the working `genai` namespace. - quickstarts/Spatial_understanding.ipynb cell 19: delete the dead `import google.generativeai as genai` line; the rest of the cell (PIL.Image, io, os, requests, BytesIO) is genuinely used downstream - examples/Animated_Story_Video_Generation_gemini.ipynb cell 7: delete the cell entirely. The cell holds only the dead import No behavioural change beyond removing dead code that would otherwise fail or shadow at notebook runtime. * fix(examples): replace deprecated Live API session.send in Animated Story notebook (#1249) Use session.send_client_content(turns=..., turn_complete=True) instead of the deprecated session.send(input=..., end_of_turn=True), which emits a DeprecationWarning in google-genai (removal not before Q3 2025). Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct case-sensitive links to Search_Grounding/Code_Execution (#1248) Three cross-notebook links used lowercase filenames (Search_grounding.ipynb, Code_execution.ipynb) that 404 on case-sensitive file systems like GitHub. Point them at the actual files: Search_Grounding.ipynb and Code_Execution.ipynb. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct broken Contributing guide link in Template.ipynb (#1247) The template linked the contributing guide as `Contributing.mg`, which is both a typo (`.mg`) and a path that does not exist next to the notebook. Point it at the repo's CONTRIBUTING.md using the same absolute GitHub URL the notebook already uses elsewhere. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix: align error handling notebook with google-genai retries (#1229) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README (#1257) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README * Update quickstarts/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * feat: add Live Translation quickstart tutorial and examples (#1259) * feat: add Live Translation quickstart tutorial and examples * chore: clean up notebook metadata and reorder cell output attributes * refactor: Live Translation notebook and script from cookbook (#1261) * Prohibit yt-dlp usage for YouTube content (#1264) Added a restriction against using yt-dlp for downloading or streaming YouTube content due to terms of service violations. * Sketch2Paint using Gemini (#790) --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * Add service account auth section with IAM roles for Gemini, File, and… (#1258) * Add service account auth section with IAM roles for Gemini, File, and Vertex AI APIs * Remove service account section, add link to GCP auth docs instead * Add Vertex AI authentication documentation link * Fix embedding types & casing (#1032) * Fix embedding types & casing (fixes #1030) * Fix query task_type and indentation style violations * fix indentation style * fixed the formatting and linting issue * update model ID * fix formatting * Update styleguide with API key and crypto restrictions Added guidelines for API key usage and restrictions on crypto topics. * Manually updating the get started notebook * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Delete quickstarts/Not_yet_in_Interactions_API.ipynb * style, fix: format notebooks, update missing outputs, bump SDK versions, and align model selectors * fix: update Get_started_Lyria.ipynb to use lowercase response_modalities without config wrapper * docs: add type: text to response_format example in CONTRIBUTING.md * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update quickstarts/Enum.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: update Error_handling.ipynb to pass http_options on genai.Client instead of config wrapper * fix: mass update google-genai to >=2.9.0 and replace GOOGLE_API_KEY with GEMINI_API_KEY across repository * style: format all notebooks with nbfmt to comply with TensorFlow docs style --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Shipra <ships3040@gmail.com> Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Rohan Dwivedi <165134541+ROHANDWIVEDI2005@users.noreply.github.com> Co-authored-by: AgentModuleAdmin <0agentmodule@gmail.com> Co-authored-by: Patrick Loeber <50772274+patrickloeber@users.noreply.github.com> Co-authored-by: Irfaan Mansoori <irfaanmansoori100@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aryan Motgi <85900811+aryanmotgi@users.noreply.github.com> Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com> Co-authored-by: Mark Daoust <markdaoust@google.com> Co-authored-by: August Cayzer <august@cayzer.me> Co-authored-by: Sri Ujwal <113922053+sbeeredd04@users.noreply.github.com> Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> Co-authored-by: qianzhu / Lucien <2729478828@qq.com> Co-authored-by: Naveen Kumar G <naveen13524g@gmail.com> Co-authored-by: Nitin Tiwari <37960279+NSTiwari@users.noreply.github.com> Co-authored-by: Anika Islam <172253577+Surjasa@users.noreply.github.com> | 2 个月前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
feat: add Get_started_Omni.ipynb quickstart guide (#1281) * feat: add Get_started_Omni.ipynb quickstart guide and update READMEs * feat: add gemini-3.1-flash-lite-image to image model selectors and make default * Adding a link to the new Omni notebook * Updating the NB guide's intro --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> | 2 个月前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Convert all quickstarts to the Interactions API (#1275) * Migrate quickstart notebooks to Interactions API (google-genai>=2.0.0) Migrate all quickstart notebooks from the legacy generate_content API to the new Interactions API using client.interactions.create(). Changes include: - All notebooks use google-genai>=2.0.0 and the Interactions API - Fix typos: thiking, inlcuding, EMBEDDIG, respose_mime_type, uniiformize, ouput - Fix Youtube -> YouTube across notebooks - Standardize !pip -> %pip for Colab best practices - Standardize 2-space -> 4-space Python indentation - Fix Audio.ipynb: complete incomplete transcript example - Fix Enum.ipynb: correct broken link to JSON_mode - Fix Error_handling.ipynb: clarify retry mechanism text - Fix Grounding.ipynb: title heading H2 -> H1 - Fix Video_understanding.ipynb: extra H1 -> H2 - Fix Get_started_OpenAI_Compatibility.ipynb: remove duplicate cells - Add Get_started_Generate_Content.ipynb (legacy API reference) - Delete New_in_002.ipynb (deprecated) - Run nbfmt formatting on all notebooks * Fix gemini-code-assist review comments - Video_understanding: move %%html magic before #@title (cell magics must be first line) - Grounding: restore @param Colab selector for MODEL_ID - Grounding: clear RateLimitError (429) output from cell - Asynchronous_requests: clear FileNotFoundError/ModuleNotFoundError/NameError outputs * Update CONTRIBUTING.md and styleguide with Interactions API guidelines - Add 'Interactions API' section explaining when to use client.interactions.create() - Document exceptions (Veo, Imagen, Lyria, LiveAPI, embeddings, TTS, batch, caching, File API) - Update SDK version from >=1.0.0 to >=2.0.0 - Update code examples from generate_content() to interactions.create() - Fix typo: 'uimport' -> 'import' in styleguide * Address gemini-code-assist review feedback (round 2) - Video_understanding: fix #@title/%%html order (#@title first for Colab forms) - Grounding: fix copy-paste prompt error (vegetable glycerin → Gemma chess) - Grounding: fix .: typo in 'Summarize this video.:' - Grounding: fix invalid \$ escape sequences → raw strings - Grounding: use .text shortcut for consistent response access - Batch_mode: fix GOOGLE_API_KEY → GEMINI_API_KEY in markdown text - Function_calling: add safe step.arguments None check - 29 notebooks: standardize pip install to use single quotes - Re-run nbfmt on all files * Fix GOOGLE_API_KEY, pip comments, model selectors, and remaining generate_content Global fixes across all notebooks: - GOOGLE_API_KEY → GEMINI_API_KEY in 18 notebooks (markdown + code) - Add '# 2.0 is needed to use the interactions API' comment to pip install lines - Remove gemini-2.5-flash-lite from all model selectors (3.1 is GA) - Add gemini-3-flash-preview to standard model selectors where missing Per-notebook fixes: - Authentication.ipynb: migrate generate_content → interactions.create - Embeddings.ipynb: migrate generate_content → interactions.create - Error_handling.ipynb: migrate generate_content → interactions.create - File_Search.ipynb: migrate generate_content → interactions.create - Get_started.ipynb: migrate generate_content → interactions.create - Get_started_thinking.ipynb: migrate generate_content → interactions.create (13 cells) - Grounding.ipynb: migrate generate_content → interactions.create (2 cells) Re-run nbfmt on all files * Audio notebook fixes + global: remove thinking remark, add Interactions API note Audio.ipynb fixes: - Remove outdated thinking model remark (all recent models think) - 'Use PyDub' → 'Use for example PyDub' + explain base64 encoding - Use Markdown display for transcript and timestamp sections - Add @param form magic to youtube_url for easy editing - Fix missing closing parenthesis in count tokens section Global fixes: - Remove thinking model remark from 13 other notebooks - Add Interactions API note to 4 notebooks that were missing it (Authentication, Embeddings, Deep_Research, Lyria) * Asynchronous_requests: display downloaded images before using them * Major Get_started.ipynb revision + global fixes Get_started.ipynb changes: - Remove overview sentence, expand TOC with all features - Point to Generate_Content notebook instead of archive branch - Fix pip comment: 'breaking changes' → 'GA/Stable release' - Show interaction.steps structure and .text shortcut - Show downloaded image in multimodal section - Remove image resize before base64 (unnecessary) - Remove duplicate blog post cell - Add image generation intro section - Rephrase safety: models manage safety automatically, no configurable settings - Add 24h retention detail for conversation state - Explain model_json_schema() for JSON generation - Fix client.aio code - Make 'Upload an image file' self-contained - Fix incorrect media_resolution reference - Google Maps: 'around here' → 'around the Eiffel Tower in Paris' - Add YouTube processing explanation - Function calling: explain no auto-FC in Interactions API - Caching: automatic with Interactions API - Remove 'Run this cell to set everything up' cell - Move thought_signatures into thinking section - Move media_resolution after upload files Global fixes: - 'for an example' → 'for a walkthrough' in 39 notebooks * Deep Research: remove note, split cells; Get_started: add image URL approach Get_started_Deep_Research.ipynb: - Removed Interactions API note (model doesn't work with generateContent) - Split 'Collaborative planning' and 'Step 1' into separate cells - Split 'Tool configuration' and 'Restrict to Google Search only' into separate cells Get_started.ipynb: - Added image URL as first multimodal approach (simplest way) - Added transition text explaining base64 alternative * Get_started: simplify PDF to URL approach; Deep Research: fix indentation Get_started.ipynb: - Replace PDF upload example with direct URL approach (arxiv paper) - No need to download/upload PDFs, just pass the URL directly Get_started_Deep_Research.ipynb: - Fix prompt indentation for EV batteries research prompt * Get_started: add code execution header, migration section, media res per-file; GC: fix URL context Get_started.ipynb: - Add proper '## Code execution' section header before existing code - Add 'Migrating from Gemini 2.5' section before Next Steps - Update Media resolution with per-file details and default behavior - Update TOC with code execution and migration links - Fix .text shortcut (doesn't exist on ModelOutputStep) Get_started_Generate_Content.ipynb: - Fix URL context output: display(Markdown()) → Markdown() * Remove Not_yet_in_Interactions_API refs, update caching, fix stale links - Remove all references to Not_yet_in_Interactions_API.ipynb (won't be published) - Delete redirect cells in Caching.ipynb and Safety.ipynb - Remove Not_yet comments from File_Search, Grounding, Spatial_understanding, Video_understanding, Get_started_thinking - Get_started.ipynb: rewrite caching section with implicit caching explanation from docs, remove Caching.ipynb link - Counting_Tokens.ipynb: update Caching.ipynb links to docs URL - Get_started_Generate_Content.ipynb: fix URL context Markdown display * Batch_mode: fix model selector order (default first) * Add gemini-3-flash-preview to model selectors in Code_Execution and thinking_REST * Counting_Tokens: use URIs directly for inline content, keep File API downloads Simplified multimodal token counting: - Image inline: pass URL directly via types.Part(file_data=...) instead of downloading with curl and loading with PIL - Audio: still downloads for File API upload (required) - Removed unnecessary curl/PIL dependencies for inline examples * Code_Execution: use image URI directly, remove curl/base64 - Replace curl download + base64 encoding with direct image URI - Fix wrong mime_type (was image/jpeg for a PNG file) - Simplifies the notebook and avoids transient image processing errors * Fix Error_handling headings, Enum model selector, Embeddings TOC + .text bug Error_handling.ipynb: - Add '## Error handling strategies' before 'Automatic retries' so sections aren't grouped under 'Setup your API key' in Colab TOC Enum.ipynb: - Add gemini-3-flash-preview to model selector (was missing) Embeddings.ipynb: - Add anchor links to TOC entries - Add anchor tags to section headers - Fix last cell: final_answer.text → final_answer.steps[-1].content[0].text - Add gemini-3-flash-preview to the RAG model selector * Function_calling: major refactor for Interactions vs GC clarity; robotics-er: fix pip Function_calling.ipynb: - Clarify Auto FC is client.chats only (not interactions API) - Add prints to add/subtract/multiply/divide functions - Explain .to_json_dict() and its use with interactions API - Rewrite manual FC intro as THE way for interactions API - Update explanations: interactions uses previous_interaction_id, not chat sessions - Fix indentation in compositional FC code - Mark AUTO/ANY/NONE modes as generateContent features - Show GC code example for ANY mode with tool_config - Rewrite Next Steps for both APIs (fix weird GenerateContentConfig text) gemini-robotics-er.ipynb: - Remove interactions API comment from pip install (not using it) * Add gemini-3-flash-preview to all model selectors; create Not_yet guide; fix File_API Global: - Add gemini-3-flash-preview to model selector dropdown in 19 notebooks (was set as default but missing from the list) Not_yet_in_Interactions_API.ipynb (NEW): - Document features only available with generateContent: - Automatic Function Calling (chats only) - Function Calling Modes (AUTO/ANY/NONE via tool_config) - Safety Settings Configuration - Explicit Context Caching - Batch API - Include code examples for both APIs where applicable File_API.ipynb: - Update intro text: generateContent/streamGenerateContent → interactions API * Major batch: migrate TTS/Lyria/NanoBanana to interactions API, rewrite thinking Get_started_TTS.ipynb: - Migrate all generate_content → interactions.create - Update play_audio helper for interactions response structure - Fix blob extraction patterns Get_Started_Nano_Banana.ipynb: - Migrate all 22 generate_content → interactions.create - Update display_response helper for interactions steps - Fix grounding metadata extraction - Fix duplicate SDK install comment Get_started_Lyria.ipynb: - Migrate all generate_content → interactions.create - Update display_lyria_response for interactions steps - Replace 'Using Interactions API' section with GC reference - Remove redundant interaction demo cells Get_started_thinking.ipynb: - Remove Gemini 2.5/3 generation-specific language - thinking_budget → thinking_level everywhere - generate_content → interactions.create in code cells - Fix response patterns (candidates[0].content.parts → interaction.steps) - Merge Gemini 3 section into main flow - thinking_budget kept only in legacy migration section Other fixes: - Remove interactions API comments from pip installs in imagen, LearnLM, LiveAPI, LiveAPI_tools, LyriaRealTime (not using interactions API) - OpenAI Compat: revert SDK comment - Interactions API notebook: remove colab button, add colab icons to table * Fix grounding, models, delete Image_out Grounding.ipynb: - YouTube: use video type input instead of url_context - PDF by URL: show both methods (direct URI + url_context) - Image by URL: show both methods (direct URI + url_context) Get_started.ipynb: - YouTube: use video type input instead of url_context Not_yet_in_Interactions_API.ipynb: - Add Maps grounding sources section (widget + citations) - Update TOC Models.ipynb: - Populate outputs using external API key (50 models listed) Image_out.ipynb: - Deleted (unused) * JSON_mode: explain response_format, add Pydantic model_json_schema - Explain why response_format with mime_type application/json is needed (prevents markdown wrapping / explanatory text) - 'The newest models allow you' → 'Another option is to pass...' - Replace hand-written JSON Schema with Pydantic + .model_json_schema() - Add model_validate_json() example for type-safe validation - Keep TypedDict fallback for non-Pydantic users - Update Next Steps with links to streaming, tools, and JSON schema docs * PDF_Files, Safety, Prompting updates PDF_Files.ipynb: - Add 'Read a PDF by URL' section (pass URI directly, no upload needed) - Move Setup/Configure API key to level 3 headings - Fix generateContent reference in Learning more Safety.ipynb: - Convert to info-only stub (like Caching notebook) - Explain that Interactions API uses built-in safety - Keep safety categories table and generateContent example as reference - Link to archived version for runnable code Prompting.ipynb: - Move Setup/Configure API key to level 3 headings - Add image-by-URI example (pass URL directly) * Fix remaining thinking_budget→thinking_level, Lyria text Thinking: Replace 4 remaining thinking_budget usages with thinking_level - Cells 23,27: thinking_budget=0 → thinking_level='none' - Cells 54,58: thinking_budget=thinking_budget → thinking_level=thinking_level - Cell 64 (legacy section) intentionally kept Lyria: Fix cell 13 text referencing generate_content * Final cleanups: Webhooks, Video, Streaming, Spatial Webhooks: - Remove SDK 2.0 minimum version requirements Video_understanding: - Correct Gemini 2.0/2.5 references to just Gemini - Remove video iframe player at the top and keep standard links Streaming: - Separate response declaration from loops to improve indentation/readability - Clarify client.aio async usage and properties - Add What's Next section at the end Spatial_understanding: - Translate Japanese bento prompt back to English - Completely remove experimental Segmentation section (which is no longer supported) * Apply PR #16 feedback audit fixes Addressed feedback for multiple notebooks: - Get_started & Get_started_Generate_Content: Re-executed and populated outputs, fixed notebook format and Colab userdata fallback. - Counting_Tokens: Replaced downloads with direct URI passing in cells 30, 32. - Embeddings: Added missing TOC links. - Get_started_TTS: Changed !pip to %pip and removed SDK 2.0 comment. - Imagen/LearnLM/LyriaRealTime: Removed unnecessary >=2.0.0 pins. - Spatial_understanding: Removed segmentation mention in cell 13. - Code_Execution: Populated outputs, added cat.png asset for execution. - Video_understanding: Removed pip install comment. - Grounding: Updated TOC. * Added new notebook Basic_Code_Review to examples (#689) --------- Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> * Add Basic_Code_Review example to README (#1218) * Add Basic_Code_Review example to README * Update examples/prompting/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Added example for gemini api used to extract insights from github #923 #887 (#1150) * added example for gemini api used to extract insights from github --------- Co-authored-by: kkorpal <kkorpal@google.com> * Add example: EU AI Act compliance checking with Gemini function calling + Agent Module (#1167) * Add EU AI Act compliance example with Gemini function calling + Agent Module * style: use triple-quoted string per review feedback * fix: correct API schema + formatting per review - status["ethics"] -> status["ai_compliance"] (v0.9.21 schema rename; was the KeyError that blocked the reviewer run) - Remove unnecessary backslash line-continuations in the compliance_run prompt string; indent body; newline before closing """ - Replace static 22-row module table with dynamic discovery pointer (/api/status, /api/demo, /llms.txt) so the snapshot never goes stale - Branding: "ethics modules" -> "AI Compliance modules" in human-facing markdown; vertical slug documented as ai-compliance with ethics as legacy alias (both still accepted by the API) - Correct ETH_001 EU AI Act mapping (Art. 9 + 10, not 10 + 13) * fix: prevent trial key collision on reruns Follow-up to the schema/formatting fixes. Colab testing surfaced a runtime bug: the Agent Module API returns a masked preview of an existing trial key (e.g. `am_trial_841...f660`) if you request a new one while the old one is still active, and the original notebook wrapper blindly stored the preview — corrupting _trial_key and breaking every downstream retrieve_compliance_logic call. Changes: - Generate a unique per-run agent_id (uuid suffix) so reruns within 24 hours do not collide with a still-active trial on the server - Make get_trial_key idempotent (short-circuit if _trial_key already set in this session) so Gemini tool loops cannot re-trigger it - Detect status=="already_active" in the MCP response and refuse to store the masked preview; surface a clear error instead - Remove get_trial_key from the tools list passed to Gemini. Trial bootstrap is a setup step, not a runtime tool — the model should only see retrieve_compliance_logic and submit_proof_of_value - Reframe the cell 27 preamble to explain the setup/runtime split * fix: pass both token and trial_key to submit_pov MCP tool * fix: print full chat history so cell 30 shows the complete compliance report * chore: save executed notebook with cell outputs * fix: add Colab button + README link for CI compliance - Add Colab badge to notebook title cell (tfo-notebook-buttons CI check) - Add notebook entry to examples/README.md table (new-example-links CI check) * chore: retrigger CI checks * Fix notebook lint (inclusive_language) + nbfmt format - Rewords 'Agent-native' to 'Purpose-built for autonomous agents' in the branding cell to clear google::inclusive_language lint flag - Applies tensorflow_docs.tools.nbfmt formatting pass to clear Notebook format check - No other content changes; all 21 cell outputs preserved * Fix colab.name metadata + cell 30 prompt (third-person) to clear nbfmt + second_person checks --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * add gemini-3.5-flash (#1232) * New agent notebook (#1233) * Fixing typos * Adding links to the agents notebooks (#1234) * docs: fix typos and capitalization consistency in README (#1240) * docs: fix typos and capitalization consistency in README * docs: apply gemini suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Bump qs from 6.15.1 to 6.15.2 in /quickstarts/file-api (#1238) Bumps [qs](https://github.com/ljharb/qs) from 6.15.1 to 6.15.2. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.15.1...v6.15.2) --- updated-dependencies: - dependency-name: qs dependency-version: 6.15.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix scale= command in Lyria realtime quickstart (#1236) The scale= parser compared the raw prompt (which still contains the 'scale=' prefix) against enum names like A_FLAT_MAJOR_F_MINOR, so the match never succeeded and the command always printed 'Matching enum not found.' Strip the 'scale=' prefix before comparing, matching how the sibling bpm= and top_k= handlers already work. * update live api ws cookbook (#1223) * Interactions steps (#1237) * Merge origin/main into interaction-steps and resolve conflict * steps * Add environment support * work * cleanup * format * cleanup * Add back execution_count * Standardize Colab buttons and fix URLs across edited notebooks * feat: update visual model names to GA and add video-to-image example (#1244) * feat: update visual model names to GA and add video-to-image example - Updated gemini-3-pro-image-preview to gemini-3-pro-image (Nano Banana Pro GA) - Updated gemini-3.1-flash-image-preview to gemini-3.1-flash-image (Nano Banana 2 GA) - Added a new video-to-image example in Get_Started_Nano_Banana.ipynb - Formatted modified notebooks with nbfmt * feat(batch): add gemini-3.5-flash to model selector * style: format banana notebook to clean up PR diff * style: trim thought signature in Get_Started_Nano_Banana notebook To reduce file size and prevent git/diff hanging on massive cryptographically signed binary thoughts. * refactor: update Live API configuration, transcription support, and input handling for model version gemini-3.1-flash-live-preview (#1224) * Update Get_started_LiveAPI (#1222) * Update Get_started_LiveAPI * remove interactivity. * session resumption update. * run. * nbfmt * Resizing the NB notebook (#1245) * feat: add example for custom FPS in Grounding notebook (#1243) * feat: add example for custom FPS in Grounding notebook * Format custom frame rate explanation in Grounding.ipynb * Fix formatting of YouTube link and response generation * Fix formatting issues in Grounding.ipynb * Fix YouTube link formatting in Grounding.ipynb * docs: fix typographical and spelling errors in styleguide and quickstarts (#1253) * docs: fix typographical and spelling errors in styleguide.md * docs: fix typo in Image_out notebook header * fix: remove leftover google-generativeai imports from two notebooks (#1246) Two notebooks had leftover `import google.generativeai as genai` lines from a prior partial migration. Both notebooks otherwise use the new `google-genai` SDK correctly via `from google import genai`, and neither notebook's `%pip install` cell installs `google-generativeai`. On a clean Colab kernel the dead imports raise `ModuleNotFoundError`; on a kernel where the legacy package happens to be pre-installed, the dead imports silently shadow the working `genai` namespace. - quickstarts/Spatial_understanding.ipynb cell 19: delete the dead `import google.generativeai as genai` line; the rest of the cell (PIL.Image, io, os, requests, BytesIO) is genuinely used downstream - examples/Animated_Story_Video_Generation_gemini.ipynb cell 7: delete the cell entirely. The cell holds only the dead import No behavioural change beyond removing dead code that would otherwise fail or shadow at notebook runtime. * fix(examples): replace deprecated Live API session.send in Animated Story notebook (#1249) Use session.send_client_content(turns=..., turn_complete=True) instead of the deprecated session.send(input=..., end_of_turn=True), which emits a DeprecationWarning in google-genai (removal not before Q3 2025). Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct case-sensitive links to Search_Grounding/Code_Execution (#1248) Three cross-notebook links used lowercase filenames (Search_grounding.ipynb, Code_execution.ipynb) that 404 on case-sensitive file systems like GitHub. Point them at the actual files: Search_Grounding.ipynb and Code_Execution.ipynb. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct broken Contributing guide link in Template.ipynb (#1247) The template linked the contributing guide as `Contributing.mg`, which is both a typo (`.mg`) and a path that does not exist next to the notebook. Point it at the repo's CONTRIBUTING.md using the same absolute GitHub URL the notebook already uses elsewhere. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix: align error handling notebook with google-genai retries (#1229) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README (#1257) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README * Update quickstarts/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * feat: add Live Translation quickstart tutorial and examples (#1259) * feat: add Live Translation quickstart tutorial and examples * chore: clean up notebook metadata and reorder cell output attributes * refactor: Live Translation notebook and script from cookbook (#1261) * Prohibit yt-dlp usage for YouTube content (#1264) Added a restriction against using yt-dlp for downloading or streaming YouTube content due to terms of service violations. * Sketch2Paint using Gemini (#790) --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * Add service account auth section with IAM roles for Gemini, File, and… (#1258) * Add service account auth section with IAM roles for Gemini, File, and Vertex AI APIs * Remove service account section, add link to GCP auth docs instead * Add Vertex AI authentication documentation link * Fix embedding types & casing (#1032) * Fix embedding types & casing (fixes #1030) * Fix query task_type and indentation style violations * fix indentation style * fixed the formatting and linting issue * update model ID * fix formatting * Update styleguide with API key and crypto restrictions Added guidelines for API key usage and restrictions on crypto topics. * Manually updating the get started notebook * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Delete quickstarts/Not_yet_in_Interactions_API.ipynb * style, fix: format notebooks, update missing outputs, bump SDK versions, and align model selectors * fix: update Get_started_Lyria.ipynb to use lowercase response_modalities without config wrapper * docs: add type: text to response_format example in CONTRIBUTING.md * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update quickstarts/Enum.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: update Error_handling.ipynb to pass http_options on genai.Client instead of config wrapper * fix: mass update google-genai to >=2.9.0 and replace GOOGLE_API_KEY with GEMINI_API_KEY across repository * style: format all notebooks with nbfmt to comply with TensorFlow docs style --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Shipra <ships3040@gmail.com> Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Rohan Dwivedi <165134541+ROHANDWIVEDI2005@users.noreply.github.com> Co-authored-by: AgentModuleAdmin <0agentmodule@gmail.com> Co-authored-by: Patrick Loeber <50772274+patrickloeber@users.noreply.github.com> Co-authored-by: Irfaan Mansoori <irfaanmansoori100@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aryan Motgi <85900811+aryanmotgi@users.noreply.github.com> Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com> Co-authored-by: Mark Daoust <markdaoust@google.com> Co-authored-by: August Cayzer <august@cayzer.me> Co-authored-by: Sri Ujwal <113922053+sbeeredd04@users.noreply.github.com> Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> Co-authored-by: qianzhu / Lucien <2729478828@qq.com> Co-authored-by: Naveen Kumar G <naveen13524g@gmail.com> Co-authored-by: Nitin Tiwari <37960279+NSTiwari@users.noreply.github.com> Co-authored-by: Anika Islam <172253577+Surjasa@users.noreply.github.com> | 2 个月前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Convert all quickstarts to the Interactions API (#1275) * Migrate quickstart notebooks to Interactions API (google-genai>=2.0.0) Migrate all quickstart notebooks from the legacy generate_content API to the new Interactions API using client.interactions.create(). Changes include: - All notebooks use google-genai>=2.0.0 and the Interactions API - Fix typos: thiking, inlcuding, EMBEDDIG, respose_mime_type, uniiformize, ouput - Fix Youtube -> YouTube across notebooks - Standardize !pip -> %pip for Colab best practices - Standardize 2-space -> 4-space Python indentation - Fix Audio.ipynb: complete incomplete transcript example - Fix Enum.ipynb: correct broken link to JSON_mode - Fix Error_handling.ipynb: clarify retry mechanism text - Fix Grounding.ipynb: title heading H2 -> H1 - Fix Video_understanding.ipynb: extra H1 -> H2 - Fix Get_started_OpenAI_Compatibility.ipynb: remove duplicate cells - Add Get_started_Generate_Content.ipynb (legacy API reference) - Delete New_in_002.ipynb (deprecated) - Run nbfmt formatting on all notebooks * Fix gemini-code-assist review comments - Video_understanding: move %%html magic before #@title (cell magics must be first line) - Grounding: restore @param Colab selector for MODEL_ID - Grounding: clear RateLimitError (429) output from cell - Asynchronous_requests: clear FileNotFoundError/ModuleNotFoundError/NameError outputs * Update CONTRIBUTING.md and styleguide with Interactions API guidelines - Add 'Interactions API' section explaining when to use client.interactions.create() - Document exceptions (Veo, Imagen, Lyria, LiveAPI, embeddings, TTS, batch, caching, File API) - Update SDK version from >=1.0.0 to >=2.0.0 - Update code examples from generate_content() to interactions.create() - Fix typo: 'uimport' -> 'import' in styleguide * Address gemini-code-assist review feedback (round 2) - Video_understanding: fix #@title/%%html order (#@title first for Colab forms) - Grounding: fix copy-paste prompt error (vegetable glycerin → Gemma chess) - Grounding: fix .: typo in 'Summarize this video.:' - Grounding: fix invalid \$ escape sequences → raw strings - Grounding: use .text shortcut for consistent response access - Batch_mode: fix GOOGLE_API_KEY → GEMINI_API_KEY in markdown text - Function_calling: add safe step.arguments None check - 29 notebooks: standardize pip install to use single quotes - Re-run nbfmt on all files * Fix GOOGLE_API_KEY, pip comments, model selectors, and remaining generate_content Global fixes across all notebooks: - GOOGLE_API_KEY → GEMINI_API_KEY in 18 notebooks (markdown + code) - Add '# 2.0 is needed to use the interactions API' comment to pip install lines - Remove gemini-2.5-flash-lite from all model selectors (3.1 is GA) - Add gemini-3-flash-preview to standard model selectors where missing Per-notebook fixes: - Authentication.ipynb: migrate generate_content → interactions.create - Embeddings.ipynb: migrate generate_content → interactions.create - Error_handling.ipynb: migrate generate_content → interactions.create - File_Search.ipynb: migrate generate_content → interactions.create - Get_started.ipynb: migrate generate_content → interactions.create - Get_started_thinking.ipynb: migrate generate_content → interactions.create (13 cells) - Grounding.ipynb: migrate generate_content → interactions.create (2 cells) Re-run nbfmt on all files * Audio notebook fixes + global: remove thinking remark, add Interactions API note Audio.ipynb fixes: - Remove outdated thinking model remark (all recent models think) - 'Use PyDub' → 'Use for example PyDub' + explain base64 encoding - Use Markdown display for transcript and timestamp sections - Add @param form magic to youtube_url for easy editing - Fix missing closing parenthesis in count tokens section Global fixes: - Remove thinking model remark from 13 other notebooks - Add Interactions API note to 4 notebooks that were missing it (Authentication, Embeddings, Deep_Research, Lyria) * Asynchronous_requests: display downloaded images before using them * Major Get_started.ipynb revision + global fixes Get_started.ipynb changes: - Remove overview sentence, expand TOC with all features - Point to Generate_Content notebook instead of archive branch - Fix pip comment: 'breaking changes' → 'GA/Stable release' - Show interaction.steps structure and .text shortcut - Show downloaded image in multimodal section - Remove image resize before base64 (unnecessary) - Remove duplicate blog post cell - Add image generation intro section - Rephrase safety: models manage safety automatically, no configurable settings - Add 24h retention detail for conversation state - Explain model_json_schema() for JSON generation - Fix client.aio code - Make 'Upload an image file' self-contained - Fix incorrect media_resolution reference - Google Maps: 'around here' → 'around the Eiffel Tower in Paris' - Add YouTube processing explanation - Function calling: explain no auto-FC in Interactions API - Caching: automatic with Interactions API - Remove 'Run this cell to set everything up' cell - Move thought_signatures into thinking section - Move media_resolution after upload files Global fixes: - 'for an example' → 'for a walkthrough' in 39 notebooks * Deep Research: remove note, split cells; Get_started: add image URL approach Get_started_Deep_Research.ipynb: - Removed Interactions API note (model doesn't work with generateContent) - Split 'Collaborative planning' and 'Step 1' into separate cells - Split 'Tool configuration' and 'Restrict to Google Search only' into separate cells Get_started.ipynb: - Added image URL as first multimodal approach (simplest way) - Added transition text explaining base64 alternative * Get_started: simplify PDF to URL approach; Deep Research: fix indentation Get_started.ipynb: - Replace PDF upload example with direct URL approach (arxiv paper) - No need to download/upload PDFs, just pass the URL directly Get_started_Deep_Research.ipynb: - Fix prompt indentation for EV batteries research prompt * Get_started: add code execution header, migration section, media res per-file; GC: fix URL context Get_started.ipynb: - Add proper '## Code execution' section header before existing code - Add 'Migrating from Gemini 2.5' section before Next Steps - Update Media resolution with per-file details and default behavior - Update TOC with code execution and migration links - Fix .text shortcut (doesn't exist on ModelOutputStep) Get_started_Generate_Content.ipynb: - Fix URL context output: display(Markdown()) → Markdown() * Remove Not_yet_in_Interactions_API refs, update caching, fix stale links - Remove all references to Not_yet_in_Interactions_API.ipynb (won't be published) - Delete redirect cells in Caching.ipynb and Safety.ipynb - Remove Not_yet comments from File_Search, Grounding, Spatial_understanding, Video_understanding, Get_started_thinking - Get_started.ipynb: rewrite caching section with implicit caching explanation from docs, remove Caching.ipynb link - Counting_Tokens.ipynb: update Caching.ipynb links to docs URL - Get_started_Generate_Content.ipynb: fix URL context Markdown display * Batch_mode: fix model selector order (default first) * Add gemini-3-flash-preview to model selectors in Code_Execution and thinking_REST * Counting_Tokens: use URIs directly for inline content, keep File API downloads Simplified multimodal token counting: - Image inline: pass URL directly via types.Part(file_data=...) instead of downloading with curl and loading with PIL - Audio: still downloads for File API upload (required) - Removed unnecessary curl/PIL dependencies for inline examples * Code_Execution: use image URI directly, remove curl/base64 - Replace curl download + base64 encoding with direct image URI - Fix wrong mime_type (was image/jpeg for a PNG file) - Simplifies the notebook and avoids transient image processing errors * Fix Error_handling headings, Enum model selector, Embeddings TOC + .text bug Error_handling.ipynb: - Add '## Error handling strategies' before 'Automatic retries' so sections aren't grouped under 'Setup your API key' in Colab TOC Enum.ipynb: - Add gemini-3-flash-preview to model selector (was missing) Embeddings.ipynb: - Add anchor links to TOC entries - Add anchor tags to section headers - Fix last cell: final_answer.text → final_answer.steps[-1].content[0].text - Add gemini-3-flash-preview to the RAG model selector * Function_calling: major refactor for Interactions vs GC clarity; robotics-er: fix pip Function_calling.ipynb: - Clarify Auto FC is client.chats only (not interactions API) - Add prints to add/subtract/multiply/divide functions - Explain .to_json_dict() and its use with interactions API - Rewrite manual FC intro as THE way for interactions API - Update explanations: interactions uses previous_interaction_id, not chat sessions - Fix indentation in compositional FC code - Mark AUTO/ANY/NONE modes as generateContent features - Show GC code example for ANY mode with tool_config - Rewrite Next Steps for both APIs (fix weird GenerateContentConfig text) gemini-robotics-er.ipynb: - Remove interactions API comment from pip install (not using it) * Add gemini-3-flash-preview to all model selectors; create Not_yet guide; fix File_API Global: - Add gemini-3-flash-preview to model selector dropdown in 19 notebooks (was set as default but missing from the list) Not_yet_in_Interactions_API.ipynb (NEW): - Document features only available with generateContent: - Automatic Function Calling (chats only) - Function Calling Modes (AUTO/ANY/NONE via tool_config) - Safety Settings Configuration - Explicit Context Caching - Batch API - Include code examples for both APIs where applicable File_API.ipynb: - Update intro text: generateContent/streamGenerateContent → interactions API * Major batch: migrate TTS/Lyria/NanoBanana to interactions API, rewrite thinking Get_started_TTS.ipynb: - Migrate all generate_content → interactions.create - Update play_audio helper for interactions response structure - Fix blob extraction patterns Get_Started_Nano_Banana.ipynb: - Migrate all 22 generate_content → interactions.create - Update display_response helper for interactions steps - Fix grounding metadata extraction - Fix duplicate SDK install comment Get_started_Lyria.ipynb: - Migrate all generate_content → interactions.create - Update display_lyria_response for interactions steps - Replace 'Using Interactions API' section with GC reference - Remove redundant interaction demo cells Get_started_thinking.ipynb: - Remove Gemini 2.5/3 generation-specific language - thinking_budget → thinking_level everywhere - generate_content → interactions.create in code cells - Fix response patterns (candidates[0].content.parts → interaction.steps) - Merge Gemini 3 section into main flow - thinking_budget kept only in legacy migration section Other fixes: - Remove interactions API comments from pip installs in imagen, LearnLM, LiveAPI, LiveAPI_tools, LyriaRealTime (not using interactions API) - OpenAI Compat: revert SDK comment - Interactions API notebook: remove colab button, add colab icons to table * Fix grounding, models, delete Image_out Grounding.ipynb: - YouTube: use video type input instead of url_context - PDF by URL: show both methods (direct URI + url_context) - Image by URL: show both methods (direct URI + url_context) Get_started.ipynb: - YouTube: use video type input instead of url_context Not_yet_in_Interactions_API.ipynb: - Add Maps grounding sources section (widget + citations) - Update TOC Models.ipynb: - Populate outputs using external API key (50 models listed) Image_out.ipynb: - Deleted (unused) * JSON_mode: explain response_format, add Pydantic model_json_schema - Explain why response_format with mime_type application/json is needed (prevents markdown wrapping / explanatory text) - 'The newest models allow you' → 'Another option is to pass...' - Replace hand-written JSON Schema with Pydantic + .model_json_schema() - Add model_validate_json() example for type-safe validation - Keep TypedDict fallback for non-Pydantic users - Update Next Steps with links to streaming, tools, and JSON schema docs * PDF_Files, Safety, Prompting updates PDF_Files.ipynb: - Add 'Read a PDF by URL' section (pass URI directly, no upload needed) - Move Setup/Configure API key to level 3 headings - Fix generateContent reference in Learning more Safety.ipynb: - Convert to info-only stub (like Caching notebook) - Explain that Interactions API uses built-in safety - Keep safety categories table and generateContent example as reference - Link to archived version for runnable code Prompting.ipynb: - Move Setup/Configure API key to level 3 headings - Add image-by-URI example (pass URL directly) * Fix remaining thinking_budget→thinking_level, Lyria text Thinking: Replace 4 remaining thinking_budget usages with thinking_level - Cells 23,27: thinking_budget=0 → thinking_level='none' - Cells 54,58: thinking_budget=thinking_budget → thinking_level=thinking_level - Cell 64 (legacy section) intentionally kept Lyria: Fix cell 13 text referencing generate_content * Final cleanups: Webhooks, Video, Streaming, Spatial Webhooks: - Remove SDK 2.0 minimum version requirements Video_understanding: - Correct Gemini 2.0/2.5 references to just Gemini - Remove video iframe player at the top and keep standard links Streaming: - Separate response declaration from loops to improve indentation/readability - Clarify client.aio async usage and properties - Add What's Next section at the end Spatial_understanding: - Translate Japanese bento prompt back to English - Completely remove experimental Segmentation section (which is no longer supported) * Apply PR #16 feedback audit fixes Addressed feedback for multiple notebooks: - Get_started & Get_started_Generate_Content: Re-executed and populated outputs, fixed notebook format and Colab userdata fallback. - Counting_Tokens: Replaced downloads with direct URI passing in cells 30, 32. - Embeddings: Added missing TOC links. - Get_started_TTS: Changed !pip to %pip and removed SDK 2.0 comment. - Imagen/LearnLM/LyriaRealTime: Removed unnecessary >=2.0.0 pins. - Spatial_understanding: Removed segmentation mention in cell 13. - Code_Execution: Populated outputs, added cat.png asset for execution. - Video_understanding: Removed pip install comment. - Grounding: Updated TOC. * Added new notebook Basic_Code_Review to examples (#689) --------- Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> * Add Basic_Code_Review example to README (#1218) * Add Basic_Code_Review example to README * Update examples/prompting/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Added example for gemini api used to extract insights from github #923 #887 (#1150) * added example for gemini api used to extract insights from github --------- Co-authored-by: kkorpal <kkorpal@google.com> * Add example: EU AI Act compliance checking with Gemini function calling + Agent Module (#1167) * Add EU AI Act compliance example with Gemini function calling + Agent Module * style: use triple-quoted string per review feedback * fix: correct API schema + formatting per review - status["ethics"] -> status["ai_compliance"] (v0.9.21 schema rename; was the KeyError that blocked the reviewer run) - Remove unnecessary backslash line-continuations in the compliance_run prompt string; indent body; newline before closing """ - Replace static 22-row module table with dynamic discovery pointer (/api/status, /api/demo, /llms.txt) so the snapshot never goes stale - Branding: "ethics modules" -> "AI Compliance modules" in human-facing markdown; vertical slug documented as ai-compliance with ethics as legacy alias (both still accepted by the API) - Correct ETH_001 EU AI Act mapping (Art. 9 + 10, not 10 + 13) * fix: prevent trial key collision on reruns Follow-up to the schema/formatting fixes. Colab testing surfaced a runtime bug: the Agent Module API returns a masked preview of an existing trial key (e.g. `am_trial_841...f660`) if you request a new one while the old one is still active, and the original notebook wrapper blindly stored the preview — corrupting _trial_key and breaking every downstream retrieve_compliance_logic call. Changes: - Generate a unique per-run agent_id (uuid suffix) so reruns within 24 hours do not collide with a still-active trial on the server - Make get_trial_key idempotent (short-circuit if _trial_key already set in this session) so Gemini tool loops cannot re-trigger it - Detect status=="already_active" in the MCP response and refuse to store the masked preview; surface a clear error instead - Remove get_trial_key from the tools list passed to Gemini. Trial bootstrap is a setup step, not a runtime tool — the model should only see retrieve_compliance_logic and submit_proof_of_value - Reframe the cell 27 preamble to explain the setup/runtime split * fix: pass both token and trial_key to submit_pov MCP tool * fix: print full chat history so cell 30 shows the complete compliance report * chore: save executed notebook with cell outputs * fix: add Colab button + README link for CI compliance - Add Colab badge to notebook title cell (tfo-notebook-buttons CI check) - Add notebook entry to examples/README.md table (new-example-links CI check) * chore: retrigger CI checks * Fix notebook lint (inclusive_language) + nbfmt format - Rewords 'Agent-native' to 'Purpose-built for autonomous agents' in the branding cell to clear google::inclusive_language lint flag - Applies tensorflow_docs.tools.nbfmt formatting pass to clear Notebook format check - No other content changes; all 21 cell outputs preserved * Fix colab.name metadata + cell 30 prompt (third-person) to clear nbfmt + second_person checks --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * add gemini-3.5-flash (#1232) * New agent notebook (#1233) * Fixing typos * Adding links to the agents notebooks (#1234) * docs: fix typos and capitalization consistency in README (#1240) * docs: fix typos and capitalization consistency in README * docs: apply gemini suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Bump qs from 6.15.1 to 6.15.2 in /quickstarts/file-api (#1238) Bumps [qs](https://github.com/ljharb/qs) from 6.15.1 to 6.15.2. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.15.1...v6.15.2) --- updated-dependencies: - dependency-name: qs dependency-version: 6.15.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix scale= command in Lyria realtime quickstart (#1236) The scale= parser compared the raw prompt (which still contains the 'scale=' prefix) against enum names like A_FLAT_MAJOR_F_MINOR, so the match never succeeded and the command always printed 'Matching enum not found.' Strip the 'scale=' prefix before comparing, matching how the sibling bpm= and top_k= handlers already work. * update live api ws cookbook (#1223) * Interactions steps (#1237) * Merge origin/main into interaction-steps and resolve conflict * steps * Add environment support * work * cleanup * format * cleanup * Add back execution_count * Standardize Colab buttons and fix URLs across edited notebooks * feat: update visual model names to GA and add video-to-image example (#1244) * feat: update visual model names to GA and add video-to-image example - Updated gemini-3-pro-image-preview to gemini-3-pro-image (Nano Banana Pro GA) - Updated gemini-3.1-flash-image-preview to gemini-3.1-flash-image (Nano Banana 2 GA) - Added a new video-to-image example in Get_Started_Nano_Banana.ipynb - Formatted modified notebooks with nbfmt * feat(batch): add gemini-3.5-flash to model selector * style: format banana notebook to clean up PR diff * style: trim thought signature in Get_Started_Nano_Banana notebook To reduce file size and prevent git/diff hanging on massive cryptographically signed binary thoughts. * refactor: update Live API configuration, transcription support, and input handling for model version gemini-3.1-flash-live-preview (#1224) * Update Get_started_LiveAPI (#1222) * Update Get_started_LiveAPI * remove interactivity. * session resumption update. * run. * nbfmt * Resizing the NB notebook (#1245) * feat: add example for custom FPS in Grounding notebook (#1243) * feat: add example for custom FPS in Grounding notebook * Format custom frame rate explanation in Grounding.ipynb * Fix formatting of YouTube link and response generation * Fix formatting issues in Grounding.ipynb * Fix YouTube link formatting in Grounding.ipynb * docs: fix typographical and spelling errors in styleguide and quickstarts (#1253) * docs: fix typographical and spelling errors in styleguide.md * docs: fix typo in Image_out notebook header * fix: remove leftover google-generativeai imports from two notebooks (#1246) Two notebooks had leftover `import google.generativeai as genai` lines from a prior partial migration. Both notebooks otherwise use the new `google-genai` SDK correctly via `from google import genai`, and neither notebook's `%pip install` cell installs `google-generativeai`. On a clean Colab kernel the dead imports raise `ModuleNotFoundError`; on a kernel where the legacy package happens to be pre-installed, the dead imports silently shadow the working `genai` namespace. - quickstarts/Spatial_understanding.ipynb cell 19: delete the dead `import google.generativeai as genai` line; the rest of the cell (PIL.Image, io, os, requests, BytesIO) is genuinely used downstream - examples/Animated_Story_Video_Generation_gemini.ipynb cell 7: delete the cell entirely. The cell holds only the dead import No behavioural change beyond removing dead code that would otherwise fail or shadow at notebook runtime. * fix(examples): replace deprecated Live API session.send in Animated Story notebook (#1249) Use session.send_client_content(turns=..., turn_complete=True) instead of the deprecated session.send(input=..., end_of_turn=True), which emits a DeprecationWarning in google-genai (removal not before Q3 2025). Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct case-sensitive links to Search_Grounding/Code_Execution (#1248) Three cross-notebook links used lowercase filenames (Search_grounding.ipynb, Code_execution.ipynb) that 404 on case-sensitive file systems like GitHub. Point them at the actual files: Search_Grounding.ipynb and Code_Execution.ipynb. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct broken Contributing guide link in Template.ipynb (#1247) The template linked the contributing guide as `Contributing.mg`, which is both a typo (`.mg`) and a path that does not exist next to the notebook. Point it at the repo's CONTRIBUTING.md using the same absolute GitHub URL the notebook already uses elsewhere. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix: align error handling notebook with google-genai retries (#1229) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README (#1257) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README * Update quickstarts/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * feat: add Live Translation quickstart tutorial and examples (#1259) * feat: add Live Translation quickstart tutorial and examples * chore: clean up notebook metadata and reorder cell output attributes * refactor: Live Translation notebook and script from cookbook (#1261) * Prohibit yt-dlp usage for YouTube content (#1264) Added a restriction against using yt-dlp for downloading or streaming YouTube content due to terms of service violations. * Sketch2Paint using Gemini (#790) --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * Add service account auth section with IAM roles for Gemini, File, and… (#1258) * Add service account auth section with IAM roles for Gemini, File, and Vertex AI APIs * Remove service account section, add link to GCP auth docs instead * Add Vertex AI authentication documentation link * Fix embedding types & casing (#1032) * Fix embedding types & casing (fixes #1030) * Fix query task_type and indentation style violations * fix indentation style * fixed the formatting and linting issue * update model ID * fix formatting * Update styleguide with API key and crypto restrictions Added guidelines for API key usage and restrictions on crypto topics. * Manually updating the get started notebook * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Delete quickstarts/Not_yet_in_Interactions_API.ipynb * style, fix: format notebooks, update missing outputs, bump SDK versions, and align model selectors * fix: update Get_started_Lyria.ipynb to use lowercase response_modalities without config wrapper * docs: add type: text to response_format example in CONTRIBUTING.md * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update quickstarts/Enum.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: update Error_handling.ipynb to pass http_options on genai.Client instead of config wrapper * fix: mass update google-genai to >=2.9.0 and replace GOOGLE_API_KEY with GEMINI_API_KEY across repository * style: format all notebooks with nbfmt to comply with TensorFlow docs style --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Shipra <ships3040@gmail.com> Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Rohan Dwivedi <165134541+ROHANDWIVEDI2005@users.noreply.github.com> Co-authored-by: AgentModuleAdmin <0agentmodule@gmail.com> Co-authored-by: Patrick Loeber <50772274+patrickloeber@users.noreply.github.com> Co-authored-by: Irfaan Mansoori <irfaanmansoori100@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aryan Motgi <85900811+aryanmotgi@users.noreply.github.com> Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com> Co-authored-by: Mark Daoust <markdaoust@google.com> Co-authored-by: August Cayzer <august@cayzer.me> Co-authored-by: Sri Ujwal <113922053+sbeeredd04@users.noreply.github.com> Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> Co-authored-by: qianzhu / Lucien <2729478828@qq.com> Co-authored-by: Naveen Kumar G <naveen13524g@gmail.com> Co-authored-by: Nitin Tiwari <37960279+NSTiwari@users.noreply.github.com> Co-authored-by: Anika Islam <172253577+Surjasa@users.noreply.github.com> | 2 个月前 | |
refactor: update Live API configuration, transcription support, and input handling for model version gemini-3.1-flash-live-preview (#1224) | 3 个月前 | |
Updating copyright year (#1133) | 6 个月前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Convert all quickstarts to the Interactions API (#1275) * Migrate quickstart notebooks to Interactions API (google-genai>=2.0.0) Migrate all quickstart notebooks from the legacy generate_content API to the new Interactions API using client.interactions.create(). Changes include: - All notebooks use google-genai>=2.0.0 and the Interactions API - Fix typos: thiking, inlcuding, EMBEDDIG, respose_mime_type, uniiformize, ouput - Fix Youtube -> YouTube across notebooks - Standardize !pip -> %pip for Colab best practices - Standardize 2-space -> 4-space Python indentation - Fix Audio.ipynb: complete incomplete transcript example - Fix Enum.ipynb: correct broken link to JSON_mode - Fix Error_handling.ipynb: clarify retry mechanism text - Fix Grounding.ipynb: title heading H2 -> H1 - Fix Video_understanding.ipynb: extra H1 -> H2 - Fix Get_started_OpenAI_Compatibility.ipynb: remove duplicate cells - Add Get_started_Generate_Content.ipynb (legacy API reference) - Delete New_in_002.ipynb (deprecated) - Run nbfmt formatting on all notebooks * Fix gemini-code-assist review comments - Video_understanding: move %%html magic before #@title (cell magics must be first line) - Grounding: restore @param Colab selector for MODEL_ID - Grounding: clear RateLimitError (429) output from cell - Asynchronous_requests: clear FileNotFoundError/ModuleNotFoundError/NameError outputs * Update CONTRIBUTING.md and styleguide with Interactions API guidelines - Add 'Interactions API' section explaining when to use client.interactions.create() - Document exceptions (Veo, Imagen, Lyria, LiveAPI, embeddings, TTS, batch, caching, File API) - Update SDK version from >=1.0.0 to >=2.0.0 - Update code examples from generate_content() to interactions.create() - Fix typo: 'uimport' -> 'import' in styleguide * Address gemini-code-assist review feedback (round 2) - Video_understanding: fix #@title/%%html order (#@title first for Colab forms) - Grounding: fix copy-paste prompt error (vegetable glycerin → Gemma chess) - Grounding: fix .: typo in 'Summarize this video.:' - Grounding: fix invalid \$ escape sequences → raw strings - Grounding: use .text shortcut for consistent response access - Batch_mode: fix GOOGLE_API_KEY → GEMINI_API_KEY in markdown text - Function_calling: add safe step.arguments None check - 29 notebooks: standardize pip install to use single quotes - Re-run nbfmt on all files * Fix GOOGLE_API_KEY, pip comments, model selectors, and remaining generate_content Global fixes across all notebooks: - GOOGLE_API_KEY → GEMINI_API_KEY in 18 notebooks (markdown + code) - Add '# 2.0 is needed to use the interactions API' comment to pip install lines - Remove gemini-2.5-flash-lite from all model selectors (3.1 is GA) - Add gemini-3-flash-preview to standard model selectors where missing Per-notebook fixes: - Authentication.ipynb: migrate generate_content → interactions.create - Embeddings.ipynb: migrate generate_content → interactions.create - Error_handling.ipynb: migrate generate_content → interactions.create - File_Search.ipynb: migrate generate_content → interactions.create - Get_started.ipynb: migrate generate_content → interactions.create - Get_started_thinking.ipynb: migrate generate_content → interactions.create (13 cells) - Grounding.ipynb: migrate generate_content → interactions.create (2 cells) Re-run nbfmt on all files * Audio notebook fixes + global: remove thinking remark, add Interactions API note Audio.ipynb fixes: - Remove outdated thinking model remark (all recent models think) - 'Use PyDub' → 'Use for example PyDub' + explain base64 encoding - Use Markdown display for transcript and timestamp sections - Add @param form magic to youtube_url for easy editing - Fix missing closing parenthesis in count tokens section Global fixes: - Remove thinking model remark from 13 other notebooks - Add Interactions API note to 4 notebooks that were missing it (Authentication, Embeddings, Deep_Research, Lyria) * Asynchronous_requests: display downloaded images before using them * Major Get_started.ipynb revision + global fixes Get_started.ipynb changes: - Remove overview sentence, expand TOC with all features - Point to Generate_Content notebook instead of archive branch - Fix pip comment: 'breaking changes' → 'GA/Stable release' - Show interaction.steps structure and .text shortcut - Show downloaded image in multimodal section - Remove image resize before base64 (unnecessary) - Remove duplicate blog post cell - Add image generation intro section - Rephrase safety: models manage safety automatically, no configurable settings - Add 24h retention detail for conversation state - Explain model_json_schema() for JSON generation - Fix client.aio code - Make 'Upload an image file' self-contained - Fix incorrect media_resolution reference - Google Maps: 'around here' → 'around the Eiffel Tower in Paris' - Add YouTube processing explanation - Function calling: explain no auto-FC in Interactions API - Caching: automatic with Interactions API - Remove 'Run this cell to set everything up' cell - Move thought_signatures into thinking section - Move media_resolution after upload files Global fixes: - 'for an example' → 'for a walkthrough' in 39 notebooks * Deep Research: remove note, split cells; Get_started: add image URL approach Get_started_Deep_Research.ipynb: - Removed Interactions API note (model doesn't work with generateContent) - Split 'Collaborative planning' and 'Step 1' into separate cells - Split 'Tool configuration' and 'Restrict to Google Search only' into separate cells Get_started.ipynb: - Added image URL as first multimodal approach (simplest way) - Added transition text explaining base64 alternative * Get_started: simplify PDF to URL approach; Deep Research: fix indentation Get_started.ipynb: - Replace PDF upload example with direct URL approach (arxiv paper) - No need to download/upload PDFs, just pass the URL directly Get_started_Deep_Research.ipynb: - Fix prompt indentation for EV batteries research prompt * Get_started: add code execution header, migration section, media res per-file; GC: fix URL context Get_started.ipynb: - Add proper '## Code execution' section header before existing code - Add 'Migrating from Gemini 2.5' section before Next Steps - Update Media resolution with per-file details and default behavior - Update TOC with code execution and migration links - Fix .text shortcut (doesn't exist on ModelOutputStep) Get_started_Generate_Content.ipynb: - Fix URL context output: display(Markdown()) → Markdown() * Remove Not_yet_in_Interactions_API refs, update caching, fix stale links - Remove all references to Not_yet_in_Interactions_API.ipynb (won't be published) - Delete redirect cells in Caching.ipynb and Safety.ipynb - Remove Not_yet comments from File_Search, Grounding, Spatial_understanding, Video_understanding, Get_started_thinking - Get_started.ipynb: rewrite caching section with implicit caching explanation from docs, remove Caching.ipynb link - Counting_Tokens.ipynb: update Caching.ipynb links to docs URL - Get_started_Generate_Content.ipynb: fix URL context Markdown display * Batch_mode: fix model selector order (default first) * Add gemini-3-flash-preview to model selectors in Code_Execution and thinking_REST * Counting_Tokens: use URIs directly for inline content, keep File API downloads Simplified multimodal token counting: - Image inline: pass URL directly via types.Part(file_data=...) instead of downloading with curl and loading with PIL - Audio: still downloads for File API upload (required) - Removed unnecessary curl/PIL dependencies for inline examples * Code_Execution: use image URI directly, remove curl/base64 - Replace curl download + base64 encoding with direct image URI - Fix wrong mime_type (was image/jpeg for a PNG file) - Simplifies the notebook and avoids transient image processing errors * Fix Error_handling headings, Enum model selector, Embeddings TOC + .text bug Error_handling.ipynb: - Add '## Error handling strategies' before 'Automatic retries' so sections aren't grouped under 'Setup your API key' in Colab TOC Enum.ipynb: - Add gemini-3-flash-preview to model selector (was missing) Embeddings.ipynb: - Add anchor links to TOC entries - Add anchor tags to section headers - Fix last cell: final_answer.text → final_answer.steps[-1].content[0].text - Add gemini-3-flash-preview to the RAG model selector * Function_calling: major refactor for Interactions vs GC clarity; robotics-er: fix pip Function_calling.ipynb: - Clarify Auto FC is client.chats only (not interactions API) - Add prints to add/subtract/multiply/divide functions - Explain .to_json_dict() and its use with interactions API - Rewrite manual FC intro as THE way for interactions API - Update explanations: interactions uses previous_interaction_id, not chat sessions - Fix indentation in compositional FC code - Mark AUTO/ANY/NONE modes as generateContent features - Show GC code example for ANY mode with tool_config - Rewrite Next Steps for both APIs (fix weird GenerateContentConfig text) gemini-robotics-er.ipynb: - Remove interactions API comment from pip install (not using it) * Add gemini-3-flash-preview to all model selectors; create Not_yet guide; fix File_API Global: - Add gemini-3-flash-preview to model selector dropdown in 19 notebooks (was set as default but missing from the list) Not_yet_in_Interactions_API.ipynb (NEW): - Document features only available with generateContent: - Automatic Function Calling (chats only) - Function Calling Modes (AUTO/ANY/NONE via tool_config) - Safety Settings Configuration - Explicit Context Caching - Batch API - Include code examples for both APIs where applicable File_API.ipynb: - Update intro text: generateContent/streamGenerateContent → interactions API * Major batch: migrate TTS/Lyria/NanoBanana to interactions API, rewrite thinking Get_started_TTS.ipynb: - Migrate all generate_content → interactions.create - Update play_audio helper for interactions response structure - Fix blob extraction patterns Get_Started_Nano_Banana.ipynb: - Migrate all 22 generate_content → interactions.create - Update display_response helper for interactions steps - Fix grounding metadata extraction - Fix duplicate SDK install comment Get_started_Lyria.ipynb: - Migrate all generate_content → interactions.create - Update display_lyria_response for interactions steps - Replace 'Using Interactions API' section with GC reference - Remove redundant interaction demo cells Get_started_thinking.ipynb: - Remove Gemini 2.5/3 generation-specific language - thinking_budget → thinking_level everywhere - generate_content → interactions.create in code cells - Fix response patterns (candidates[0].content.parts → interaction.steps) - Merge Gemini 3 section into main flow - thinking_budget kept only in legacy migration section Other fixes: - Remove interactions API comments from pip installs in imagen, LearnLM, LiveAPI, LiveAPI_tools, LyriaRealTime (not using interactions API) - OpenAI Compat: revert SDK comment - Interactions API notebook: remove colab button, add colab icons to table * Fix grounding, models, delete Image_out Grounding.ipynb: - YouTube: use video type input instead of url_context - PDF by URL: show both methods (direct URI + url_context) - Image by URL: show both methods (direct URI + url_context) Get_started.ipynb: - YouTube: use video type input instead of url_context Not_yet_in_Interactions_API.ipynb: - Add Maps grounding sources section (widget + citations) - Update TOC Models.ipynb: - Populate outputs using external API key (50 models listed) Image_out.ipynb: - Deleted (unused) * JSON_mode: explain response_format, add Pydantic model_json_schema - Explain why response_format with mime_type application/json is needed (prevents markdown wrapping / explanatory text) - 'The newest models allow you' → 'Another option is to pass...' - Replace hand-written JSON Schema with Pydantic + .model_json_schema() - Add model_validate_json() example for type-safe validation - Keep TypedDict fallback for non-Pydantic users - Update Next Steps with links to streaming, tools, and JSON schema docs * PDF_Files, Safety, Prompting updates PDF_Files.ipynb: - Add 'Read a PDF by URL' section (pass URI directly, no upload needed) - Move Setup/Configure API key to level 3 headings - Fix generateContent reference in Learning more Safety.ipynb: - Convert to info-only stub (like Caching notebook) - Explain that Interactions API uses built-in safety - Keep safety categories table and generateContent example as reference - Link to archived version for runnable code Prompting.ipynb: - Move Setup/Configure API key to level 3 headings - Add image-by-URI example (pass URL directly) * Fix remaining thinking_budget→thinking_level, Lyria text Thinking: Replace 4 remaining thinking_budget usages with thinking_level - Cells 23,27: thinking_budget=0 → thinking_level='none' - Cells 54,58: thinking_budget=thinking_budget → thinking_level=thinking_level - Cell 64 (legacy section) intentionally kept Lyria: Fix cell 13 text referencing generate_content * Final cleanups: Webhooks, Video, Streaming, Spatial Webhooks: - Remove SDK 2.0 minimum version requirements Video_understanding: - Correct Gemini 2.0/2.5 references to just Gemini - Remove video iframe player at the top and keep standard links Streaming: - Separate response declaration from loops to improve indentation/readability - Clarify client.aio async usage and properties - Add What's Next section at the end Spatial_understanding: - Translate Japanese bento prompt back to English - Completely remove experimental Segmentation section (which is no longer supported) * Apply PR #16 feedback audit fixes Addressed feedback for multiple notebooks: - Get_started & Get_started_Generate_Content: Re-executed and populated outputs, fixed notebook format and Colab userdata fallback. - Counting_Tokens: Replaced downloads with direct URI passing in cells 30, 32. - Embeddings: Added missing TOC links. - Get_started_TTS: Changed !pip to %pip and removed SDK 2.0 comment. - Imagen/LearnLM/LyriaRealTime: Removed unnecessary >=2.0.0 pins. - Spatial_understanding: Removed segmentation mention in cell 13. - Code_Execution: Populated outputs, added cat.png asset for execution. - Video_understanding: Removed pip install comment. - Grounding: Updated TOC. * Added new notebook Basic_Code_Review to examples (#689) --------- Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> * Add Basic_Code_Review example to README (#1218) * Add Basic_Code_Review example to README * Update examples/prompting/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Added example for gemini api used to extract insights from github #923 #887 (#1150) * added example for gemini api used to extract insights from github --------- Co-authored-by: kkorpal <kkorpal@google.com> * Add example: EU AI Act compliance checking with Gemini function calling + Agent Module (#1167) * Add EU AI Act compliance example with Gemini function calling + Agent Module * style: use triple-quoted string per review feedback * fix: correct API schema + formatting per review - status["ethics"] -> status["ai_compliance"] (v0.9.21 schema rename; was the KeyError that blocked the reviewer run) - Remove unnecessary backslash line-continuations in the compliance_run prompt string; indent body; newline before closing """ - Replace static 22-row module table with dynamic discovery pointer (/api/status, /api/demo, /llms.txt) so the snapshot never goes stale - Branding: "ethics modules" -> "AI Compliance modules" in human-facing markdown; vertical slug documented as ai-compliance with ethics as legacy alias (both still accepted by the API) - Correct ETH_001 EU AI Act mapping (Art. 9 + 10, not 10 + 13) * fix: prevent trial key collision on reruns Follow-up to the schema/formatting fixes. Colab testing surfaced a runtime bug: the Agent Module API returns a masked preview of an existing trial key (e.g. `am_trial_841...f660`) if you request a new one while the old one is still active, and the original notebook wrapper blindly stored the preview — corrupting _trial_key and breaking every downstream retrieve_compliance_logic call. Changes: - Generate a unique per-run agent_id (uuid suffix) so reruns within 24 hours do not collide with a still-active trial on the server - Make get_trial_key idempotent (short-circuit if _trial_key already set in this session) so Gemini tool loops cannot re-trigger it - Detect status=="already_active" in the MCP response and refuse to store the masked preview; surface a clear error instead - Remove get_trial_key from the tools list passed to Gemini. Trial bootstrap is a setup step, not a runtime tool — the model should only see retrieve_compliance_logic and submit_proof_of_value - Reframe the cell 27 preamble to explain the setup/runtime split * fix: pass both token and trial_key to submit_pov MCP tool * fix: print full chat history so cell 30 shows the complete compliance report * chore: save executed notebook with cell outputs * fix: add Colab button + README link for CI compliance - Add Colab badge to notebook title cell (tfo-notebook-buttons CI check) - Add notebook entry to examples/README.md table (new-example-links CI check) * chore: retrigger CI checks * Fix notebook lint (inclusive_language) + nbfmt format - Rewords 'Agent-native' to 'Purpose-built for autonomous agents' in the branding cell to clear google::inclusive_language lint flag - Applies tensorflow_docs.tools.nbfmt formatting pass to clear Notebook format check - No other content changes; all 21 cell outputs preserved * Fix colab.name metadata + cell 30 prompt (third-person) to clear nbfmt + second_person checks --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * add gemini-3.5-flash (#1232) * New agent notebook (#1233) * Fixing typos * Adding links to the agents notebooks (#1234) * docs: fix typos and capitalization consistency in README (#1240) * docs: fix typos and capitalization consistency in README * docs: apply gemini suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Bump qs from 6.15.1 to 6.15.2 in /quickstarts/file-api (#1238) Bumps [qs](https://github.com/ljharb/qs) from 6.15.1 to 6.15.2. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.15.1...v6.15.2) --- updated-dependencies: - dependency-name: qs dependency-version: 6.15.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix scale= command in Lyria realtime quickstart (#1236) The scale= parser compared the raw prompt (which still contains the 'scale=' prefix) against enum names like A_FLAT_MAJOR_F_MINOR, so the match never succeeded and the command always printed 'Matching enum not found.' Strip the 'scale=' prefix before comparing, matching how the sibling bpm= and top_k= handlers already work. * update live api ws cookbook (#1223) * Interactions steps (#1237) * Merge origin/main into interaction-steps and resolve conflict * steps * Add environment support * work * cleanup * format * cleanup * Add back execution_count * Standardize Colab buttons and fix URLs across edited notebooks * feat: update visual model names to GA and add video-to-image example (#1244) * feat: update visual model names to GA and add video-to-image example - Updated gemini-3-pro-image-preview to gemini-3-pro-image (Nano Banana Pro GA) - Updated gemini-3.1-flash-image-preview to gemini-3.1-flash-image (Nano Banana 2 GA) - Added a new video-to-image example in Get_Started_Nano_Banana.ipynb - Formatted modified notebooks with nbfmt * feat(batch): add gemini-3.5-flash to model selector * style: format banana notebook to clean up PR diff * style: trim thought signature in Get_Started_Nano_Banana notebook To reduce file size and prevent git/diff hanging on massive cryptographically signed binary thoughts. * refactor: update Live API configuration, transcription support, and input handling for model version gemini-3.1-flash-live-preview (#1224) * Update Get_started_LiveAPI (#1222) * Update Get_started_LiveAPI * remove interactivity. * session resumption update. * run. * nbfmt * Resizing the NB notebook (#1245) * feat: add example for custom FPS in Grounding notebook (#1243) * feat: add example for custom FPS in Grounding notebook * Format custom frame rate explanation in Grounding.ipynb * Fix formatting of YouTube link and response generation * Fix formatting issues in Grounding.ipynb * Fix YouTube link formatting in Grounding.ipynb * docs: fix typographical and spelling errors in styleguide and quickstarts (#1253) * docs: fix typographical and spelling errors in styleguide.md * docs: fix typo in Image_out notebook header * fix: remove leftover google-generativeai imports from two notebooks (#1246) Two notebooks had leftover `import google.generativeai as genai` lines from a prior partial migration. Both notebooks otherwise use the new `google-genai` SDK correctly via `from google import genai`, and neither notebook's `%pip install` cell installs `google-generativeai`. On a clean Colab kernel the dead imports raise `ModuleNotFoundError`; on a kernel where the legacy package happens to be pre-installed, the dead imports silently shadow the working `genai` namespace. - quickstarts/Spatial_understanding.ipynb cell 19: delete the dead `import google.generativeai as genai` line; the rest of the cell (PIL.Image, io, os, requests, BytesIO) is genuinely used downstream - examples/Animated_Story_Video_Generation_gemini.ipynb cell 7: delete the cell entirely. The cell holds only the dead import No behavioural change beyond removing dead code that would otherwise fail or shadow at notebook runtime. * fix(examples): replace deprecated Live API session.send in Animated Story notebook (#1249) Use session.send_client_content(turns=..., turn_complete=True) instead of the deprecated session.send(input=..., end_of_turn=True), which emits a DeprecationWarning in google-genai (removal not before Q3 2025). Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct case-sensitive links to Search_Grounding/Code_Execution (#1248) Three cross-notebook links used lowercase filenames (Search_grounding.ipynb, Code_execution.ipynb) that 404 on case-sensitive file systems like GitHub. Point them at the actual files: Search_Grounding.ipynb and Code_Execution.ipynb. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct broken Contributing guide link in Template.ipynb (#1247) The template linked the contributing guide as `Contributing.mg`, which is both a typo (`.mg`) and a path that does not exist next to the notebook. Point it at the repo's CONTRIBUTING.md using the same absolute GitHub URL the notebook already uses elsewhere. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix: align error handling notebook with google-genai retries (#1229) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README (#1257) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README * Update quickstarts/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * feat: add Live Translation quickstart tutorial and examples (#1259) * feat: add Live Translation quickstart tutorial and examples * chore: clean up notebook metadata and reorder cell output attributes * refactor: Live Translation notebook and script from cookbook (#1261) * Prohibit yt-dlp usage for YouTube content (#1264) Added a restriction against using yt-dlp for downloading or streaming YouTube content due to terms of service violations. * Sketch2Paint using Gemini (#790) --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * Add service account auth section with IAM roles for Gemini, File, and… (#1258) * Add service account auth section with IAM roles for Gemini, File, and Vertex AI APIs * Remove service account section, add link to GCP auth docs instead * Add Vertex AI authentication documentation link * Fix embedding types & casing (#1032) * Fix embedding types & casing (fixes #1030) * Fix query task_type and indentation style violations * fix indentation style * fixed the formatting and linting issue * update model ID * fix formatting * Update styleguide with API key and crypto restrictions Added guidelines for API key usage and restrictions on crypto topics. * Manually updating the get started notebook * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Delete quickstarts/Not_yet_in_Interactions_API.ipynb * style, fix: format notebooks, update missing outputs, bump SDK versions, and align model selectors * fix: update Get_started_Lyria.ipynb to use lowercase response_modalities without config wrapper * docs: add type: text to response_format example in CONTRIBUTING.md * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update quickstarts/Enum.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: update Error_handling.ipynb to pass http_options on genai.Client instead of config wrapper * fix: mass update google-genai to >=2.9.0 and replace GOOGLE_API_KEY with GEMINI_API_KEY across repository * style: format all notebooks with nbfmt to comply with TensorFlow docs style --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Shipra <ships3040@gmail.com> Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Rohan Dwivedi <165134541+ROHANDWIVEDI2005@users.noreply.github.com> Co-authored-by: AgentModuleAdmin <0agentmodule@gmail.com> Co-authored-by: Patrick Loeber <50772274+patrickloeber@users.noreply.github.com> Co-authored-by: Irfaan Mansoori <irfaanmansoori100@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aryan Motgi <85900811+aryanmotgi@users.noreply.github.com> Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com> Co-authored-by: Mark Daoust <markdaoust@google.com> Co-authored-by: August Cayzer <august@cayzer.me> Co-authored-by: Sri Ujwal <113922053+sbeeredd04@users.noreply.github.com> Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> Co-authored-by: qianzhu / Lucien <2729478828@qq.com> Co-authored-by: Naveen Kumar G <naveen13524g@gmail.com> Co-authored-by: Nitin Tiwari <37960279+NSTiwari@users.noreply.github.com> Co-authored-by: Anika Islam <172253577+Surjasa@users.noreply.github.com> | 2 个月前 | |
refactor: Live Translation notebook and script from cookbook (#1261) | 2 个月前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Convert all quickstarts to the Interactions API (#1275) * Migrate quickstart notebooks to Interactions API (google-genai>=2.0.0) Migrate all quickstart notebooks from the legacy generate_content API to the new Interactions API using client.interactions.create(). Changes include: - All notebooks use google-genai>=2.0.0 and the Interactions API - Fix typos: thiking, inlcuding, EMBEDDIG, respose_mime_type, uniiformize, ouput - Fix Youtube -> YouTube across notebooks - Standardize !pip -> %pip for Colab best practices - Standardize 2-space -> 4-space Python indentation - Fix Audio.ipynb: complete incomplete transcript example - Fix Enum.ipynb: correct broken link to JSON_mode - Fix Error_handling.ipynb: clarify retry mechanism text - Fix Grounding.ipynb: title heading H2 -> H1 - Fix Video_understanding.ipynb: extra H1 -> H2 - Fix Get_started_OpenAI_Compatibility.ipynb: remove duplicate cells - Add Get_started_Generate_Content.ipynb (legacy API reference) - Delete New_in_002.ipynb (deprecated) - Run nbfmt formatting on all notebooks * Fix gemini-code-assist review comments - Video_understanding: move %%html magic before #@title (cell magics must be first line) - Grounding: restore @param Colab selector for MODEL_ID - Grounding: clear RateLimitError (429) output from cell - Asynchronous_requests: clear FileNotFoundError/ModuleNotFoundError/NameError outputs * Update CONTRIBUTING.md and styleguide with Interactions API guidelines - Add 'Interactions API' section explaining when to use client.interactions.create() - Document exceptions (Veo, Imagen, Lyria, LiveAPI, embeddings, TTS, batch, caching, File API) - Update SDK version from >=1.0.0 to >=2.0.0 - Update code examples from generate_content() to interactions.create() - Fix typo: 'uimport' -> 'import' in styleguide * Address gemini-code-assist review feedback (round 2) - Video_understanding: fix #@title/%%html order (#@title first for Colab forms) - Grounding: fix copy-paste prompt error (vegetable glycerin → Gemma chess) - Grounding: fix .: typo in 'Summarize this video.:' - Grounding: fix invalid \$ escape sequences → raw strings - Grounding: use .text shortcut for consistent response access - Batch_mode: fix GOOGLE_API_KEY → GEMINI_API_KEY in markdown text - Function_calling: add safe step.arguments None check - 29 notebooks: standardize pip install to use single quotes - Re-run nbfmt on all files * Fix GOOGLE_API_KEY, pip comments, model selectors, and remaining generate_content Global fixes across all notebooks: - GOOGLE_API_KEY → GEMINI_API_KEY in 18 notebooks (markdown + code) - Add '# 2.0 is needed to use the interactions API' comment to pip install lines - Remove gemini-2.5-flash-lite from all model selectors (3.1 is GA) - Add gemini-3-flash-preview to standard model selectors where missing Per-notebook fixes: - Authentication.ipynb: migrate generate_content → interactions.create - Embeddings.ipynb: migrate generate_content → interactions.create - Error_handling.ipynb: migrate generate_content → interactions.create - File_Search.ipynb: migrate generate_content → interactions.create - Get_started.ipynb: migrate generate_content → interactions.create - Get_started_thinking.ipynb: migrate generate_content → interactions.create (13 cells) - Grounding.ipynb: migrate generate_content → interactions.create (2 cells) Re-run nbfmt on all files * Audio notebook fixes + global: remove thinking remark, add Interactions API note Audio.ipynb fixes: - Remove outdated thinking model remark (all recent models think) - 'Use PyDub' → 'Use for example PyDub' + explain base64 encoding - Use Markdown display for transcript and timestamp sections - Add @param form magic to youtube_url for easy editing - Fix missing closing parenthesis in count tokens section Global fixes: - Remove thinking model remark from 13 other notebooks - Add Interactions API note to 4 notebooks that were missing it (Authentication, Embeddings, Deep_Research, Lyria) * Asynchronous_requests: display downloaded images before using them * Major Get_started.ipynb revision + global fixes Get_started.ipynb changes: - Remove overview sentence, expand TOC with all features - Point to Generate_Content notebook instead of archive branch - Fix pip comment: 'breaking changes' → 'GA/Stable release' - Show interaction.steps structure and .text shortcut - Show downloaded image in multimodal section - Remove image resize before base64 (unnecessary) - Remove duplicate blog post cell - Add image generation intro section - Rephrase safety: models manage safety automatically, no configurable settings - Add 24h retention detail for conversation state - Explain model_json_schema() for JSON generation - Fix client.aio code - Make 'Upload an image file' self-contained - Fix incorrect media_resolution reference - Google Maps: 'around here' → 'around the Eiffel Tower in Paris' - Add YouTube processing explanation - Function calling: explain no auto-FC in Interactions API - Caching: automatic with Interactions API - Remove 'Run this cell to set everything up' cell - Move thought_signatures into thinking section - Move media_resolution after upload files Global fixes: - 'for an example' → 'for a walkthrough' in 39 notebooks * Deep Research: remove note, split cells; Get_started: add image URL approach Get_started_Deep_Research.ipynb: - Removed Interactions API note (model doesn't work with generateContent) - Split 'Collaborative planning' and 'Step 1' into separate cells - Split 'Tool configuration' and 'Restrict to Google Search only' into separate cells Get_started.ipynb: - Added image URL as first multimodal approach (simplest way) - Added transition text explaining base64 alternative * Get_started: simplify PDF to URL approach; Deep Research: fix indentation Get_started.ipynb: - Replace PDF upload example with direct URL approach (arxiv paper) - No need to download/upload PDFs, just pass the URL directly Get_started_Deep_Research.ipynb: - Fix prompt indentation for EV batteries research prompt * Get_started: add code execution header, migration section, media res per-file; GC: fix URL context Get_started.ipynb: - Add proper '## Code execution' section header before existing code - Add 'Migrating from Gemini 2.5' section before Next Steps - Update Media resolution with per-file details and default behavior - Update TOC with code execution and migration links - Fix .text shortcut (doesn't exist on ModelOutputStep) Get_started_Generate_Content.ipynb: - Fix URL context output: display(Markdown()) → Markdown() * Remove Not_yet_in_Interactions_API refs, update caching, fix stale links - Remove all references to Not_yet_in_Interactions_API.ipynb (won't be published) - Delete redirect cells in Caching.ipynb and Safety.ipynb - Remove Not_yet comments from File_Search, Grounding, Spatial_understanding, Video_understanding, Get_started_thinking - Get_started.ipynb: rewrite caching section with implicit caching explanation from docs, remove Caching.ipynb link - Counting_Tokens.ipynb: update Caching.ipynb links to docs URL - Get_started_Generate_Content.ipynb: fix URL context Markdown display * Batch_mode: fix model selector order (default first) * Add gemini-3-flash-preview to model selectors in Code_Execution and thinking_REST * Counting_Tokens: use URIs directly for inline content, keep File API downloads Simplified multimodal token counting: - Image inline: pass URL directly via types.Part(file_data=...) instead of downloading with curl and loading with PIL - Audio: still downloads for File API upload (required) - Removed unnecessary curl/PIL dependencies for inline examples * Code_Execution: use image URI directly, remove curl/base64 - Replace curl download + base64 encoding with direct image URI - Fix wrong mime_type (was image/jpeg for a PNG file) - Simplifies the notebook and avoids transient image processing errors * Fix Error_handling headings, Enum model selector, Embeddings TOC + .text bug Error_handling.ipynb: - Add '## Error handling strategies' before 'Automatic retries' so sections aren't grouped under 'Setup your API key' in Colab TOC Enum.ipynb: - Add gemini-3-flash-preview to model selector (was missing) Embeddings.ipynb: - Add anchor links to TOC entries - Add anchor tags to section headers - Fix last cell: final_answer.text → final_answer.steps[-1].content[0].text - Add gemini-3-flash-preview to the RAG model selector * Function_calling: major refactor for Interactions vs GC clarity; robotics-er: fix pip Function_calling.ipynb: - Clarify Auto FC is client.chats only (not interactions API) - Add prints to add/subtract/multiply/divide functions - Explain .to_json_dict() and its use with interactions API - Rewrite manual FC intro as THE way for interactions API - Update explanations: interactions uses previous_interaction_id, not chat sessions - Fix indentation in compositional FC code - Mark AUTO/ANY/NONE modes as generateContent features - Show GC code example for ANY mode with tool_config - Rewrite Next Steps for both APIs (fix weird GenerateContentConfig text) gemini-robotics-er.ipynb: - Remove interactions API comment from pip install (not using it) * Add gemini-3-flash-preview to all model selectors; create Not_yet guide; fix File_API Global: - Add gemini-3-flash-preview to model selector dropdown in 19 notebooks (was set as default but missing from the list) Not_yet_in_Interactions_API.ipynb (NEW): - Document features only available with generateContent: - Automatic Function Calling (chats only) - Function Calling Modes (AUTO/ANY/NONE via tool_config) - Safety Settings Configuration - Explicit Context Caching - Batch API - Include code examples for both APIs where applicable File_API.ipynb: - Update intro text: generateContent/streamGenerateContent → interactions API * Major batch: migrate TTS/Lyria/NanoBanana to interactions API, rewrite thinking Get_started_TTS.ipynb: - Migrate all generate_content → interactions.create - Update play_audio helper for interactions response structure - Fix blob extraction patterns Get_Started_Nano_Banana.ipynb: - Migrate all 22 generate_content → interactions.create - Update display_response helper for interactions steps - Fix grounding metadata extraction - Fix duplicate SDK install comment Get_started_Lyria.ipynb: - Migrate all generate_content → interactions.create - Update display_lyria_response for interactions steps - Replace 'Using Interactions API' section with GC reference - Remove redundant interaction demo cells Get_started_thinking.ipynb: - Remove Gemini 2.5/3 generation-specific language - thinking_budget → thinking_level everywhere - generate_content → interactions.create in code cells - Fix response patterns (candidates[0].content.parts → interaction.steps) - Merge Gemini 3 section into main flow - thinking_budget kept only in legacy migration section Other fixes: - Remove interactions API comments from pip installs in imagen, LearnLM, LiveAPI, LiveAPI_tools, LyriaRealTime (not using interactions API) - OpenAI Compat: revert SDK comment - Interactions API notebook: remove colab button, add colab icons to table * Fix grounding, models, delete Image_out Grounding.ipynb: - YouTube: use video type input instead of url_context - PDF by URL: show both methods (direct URI + url_context) - Image by URL: show both methods (direct URI + url_context) Get_started.ipynb: - YouTube: use video type input instead of url_context Not_yet_in_Interactions_API.ipynb: - Add Maps grounding sources section (widget + citations) - Update TOC Models.ipynb: - Populate outputs using external API key (50 models listed) Image_out.ipynb: - Deleted (unused) * JSON_mode: explain response_format, add Pydantic model_json_schema - Explain why response_format with mime_type application/json is needed (prevents markdown wrapping / explanatory text) - 'The newest models allow you' → 'Another option is to pass...' - Replace hand-written JSON Schema with Pydantic + .model_json_schema() - Add model_validate_json() example for type-safe validation - Keep TypedDict fallback for non-Pydantic users - Update Next Steps with links to streaming, tools, and JSON schema docs * PDF_Files, Safety, Prompting updates PDF_Files.ipynb: - Add 'Read a PDF by URL' section (pass URI directly, no upload needed) - Move Setup/Configure API key to level 3 headings - Fix generateContent reference in Learning more Safety.ipynb: - Convert to info-only stub (like Caching notebook) - Explain that Interactions API uses built-in safety - Keep safety categories table and generateContent example as reference - Link to archived version for runnable code Prompting.ipynb: - Move Setup/Configure API key to level 3 headings - Add image-by-URI example (pass URL directly) * Fix remaining thinking_budget→thinking_level, Lyria text Thinking: Replace 4 remaining thinking_budget usages with thinking_level - Cells 23,27: thinking_budget=0 → thinking_level='none' - Cells 54,58: thinking_budget=thinking_budget → thinking_level=thinking_level - Cell 64 (legacy section) intentionally kept Lyria: Fix cell 13 text referencing generate_content * Final cleanups: Webhooks, Video, Streaming, Spatial Webhooks: - Remove SDK 2.0 minimum version requirements Video_understanding: - Correct Gemini 2.0/2.5 references to just Gemini - Remove video iframe player at the top and keep standard links Streaming: - Separate response declaration from loops to improve indentation/readability - Clarify client.aio async usage and properties - Add What's Next section at the end Spatial_understanding: - Translate Japanese bento prompt back to English - Completely remove experimental Segmentation section (which is no longer supported) * Apply PR #16 feedback audit fixes Addressed feedback for multiple notebooks: - Get_started & Get_started_Generate_Content: Re-executed and populated outputs, fixed notebook format and Colab userdata fallback. - Counting_Tokens: Replaced downloads with direct URI passing in cells 30, 32. - Embeddings: Added missing TOC links. - Get_started_TTS: Changed !pip to %pip and removed SDK 2.0 comment. - Imagen/LearnLM/LyriaRealTime: Removed unnecessary >=2.0.0 pins. - Spatial_understanding: Removed segmentation mention in cell 13. - Code_Execution: Populated outputs, added cat.png asset for execution. - Video_understanding: Removed pip install comment. - Grounding: Updated TOC. * Added new notebook Basic_Code_Review to examples (#689) --------- Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> * Add Basic_Code_Review example to README (#1218) * Add Basic_Code_Review example to README * Update examples/prompting/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Added example for gemini api used to extract insights from github #923 #887 (#1150) * added example for gemini api used to extract insights from github --------- Co-authored-by: kkorpal <kkorpal@google.com> * Add example: EU AI Act compliance checking with Gemini function calling + Agent Module (#1167) * Add EU AI Act compliance example with Gemini function calling + Agent Module * style: use triple-quoted string per review feedback * fix: correct API schema + formatting per review - status["ethics"] -> status["ai_compliance"] (v0.9.21 schema rename; was the KeyError that blocked the reviewer run) - Remove unnecessary backslash line-continuations in the compliance_run prompt string; indent body; newline before closing """ - Replace static 22-row module table with dynamic discovery pointer (/api/status, /api/demo, /llms.txt) so the snapshot never goes stale - Branding: "ethics modules" -> "AI Compliance modules" in human-facing markdown; vertical slug documented as ai-compliance with ethics as legacy alias (both still accepted by the API) - Correct ETH_001 EU AI Act mapping (Art. 9 + 10, not 10 + 13) * fix: prevent trial key collision on reruns Follow-up to the schema/formatting fixes. Colab testing surfaced a runtime bug: the Agent Module API returns a masked preview of an existing trial key (e.g. `am_trial_841...f660`) if you request a new one while the old one is still active, and the original notebook wrapper blindly stored the preview — corrupting _trial_key and breaking every downstream retrieve_compliance_logic call. Changes: - Generate a unique per-run agent_id (uuid suffix) so reruns within 24 hours do not collide with a still-active trial on the server - Make get_trial_key idempotent (short-circuit if _trial_key already set in this session) so Gemini tool loops cannot re-trigger it - Detect status=="already_active" in the MCP response and refuse to store the masked preview; surface a clear error instead - Remove get_trial_key from the tools list passed to Gemini. Trial bootstrap is a setup step, not a runtime tool — the model should only see retrieve_compliance_logic and submit_proof_of_value - Reframe the cell 27 preamble to explain the setup/runtime split * fix: pass both token and trial_key to submit_pov MCP tool * fix: print full chat history so cell 30 shows the complete compliance report * chore: save executed notebook with cell outputs * fix: add Colab button + README link for CI compliance - Add Colab badge to notebook title cell (tfo-notebook-buttons CI check) - Add notebook entry to examples/README.md table (new-example-links CI check) * chore: retrigger CI checks * Fix notebook lint (inclusive_language) + nbfmt format - Rewords 'Agent-native' to 'Purpose-built for autonomous agents' in the branding cell to clear google::inclusive_language lint flag - Applies tensorflow_docs.tools.nbfmt formatting pass to clear Notebook format check - No other content changes; all 21 cell outputs preserved * Fix colab.name metadata + cell 30 prompt (third-person) to clear nbfmt + second_person checks --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * add gemini-3.5-flash (#1232) * New agent notebook (#1233) * Fixing typos * Adding links to the agents notebooks (#1234) * docs: fix typos and capitalization consistency in README (#1240) * docs: fix typos and capitalization consistency in README * docs: apply gemini suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Bump qs from 6.15.1 to 6.15.2 in /quickstarts/file-api (#1238) Bumps [qs](https://github.com/ljharb/qs) from 6.15.1 to 6.15.2. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.15.1...v6.15.2) --- updated-dependencies: - dependency-name: qs dependency-version: 6.15.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix scale= command in Lyria realtime quickstart (#1236) The scale= parser compared the raw prompt (which still contains the 'scale=' prefix) against enum names like A_FLAT_MAJOR_F_MINOR, so the match never succeeded and the command always printed 'Matching enum not found.' Strip the 'scale=' prefix before comparing, matching how the sibling bpm= and top_k= handlers already work. * update live api ws cookbook (#1223) * Interactions steps (#1237) * Merge origin/main into interaction-steps and resolve conflict * steps * Add environment support * work * cleanup * format * cleanup * Add back execution_count * Standardize Colab buttons and fix URLs across edited notebooks * feat: update visual model names to GA and add video-to-image example (#1244) * feat: update visual model names to GA and add video-to-image example - Updated gemini-3-pro-image-preview to gemini-3-pro-image (Nano Banana Pro GA) - Updated gemini-3.1-flash-image-preview to gemini-3.1-flash-image (Nano Banana 2 GA) - Added a new video-to-image example in Get_Started_Nano_Banana.ipynb - Formatted modified notebooks with nbfmt * feat(batch): add gemini-3.5-flash to model selector * style: format banana notebook to clean up PR diff * style: trim thought signature in Get_Started_Nano_Banana notebook To reduce file size and prevent git/diff hanging on massive cryptographically signed binary thoughts. * refactor: update Live API configuration, transcription support, and input handling for model version gemini-3.1-flash-live-preview (#1224) * Update Get_started_LiveAPI (#1222) * Update Get_started_LiveAPI * remove interactivity. * session resumption update. * run. * nbfmt * Resizing the NB notebook (#1245) * feat: add example for custom FPS in Grounding notebook (#1243) * feat: add example for custom FPS in Grounding notebook * Format custom frame rate explanation in Grounding.ipynb * Fix formatting of YouTube link and response generation * Fix formatting issues in Grounding.ipynb * Fix YouTube link formatting in Grounding.ipynb * docs: fix typographical and spelling errors in styleguide and quickstarts (#1253) * docs: fix typographical and spelling errors in styleguide.md * docs: fix typo in Image_out notebook header * fix: remove leftover google-generativeai imports from two notebooks (#1246) Two notebooks had leftover `import google.generativeai as genai` lines from a prior partial migration. Both notebooks otherwise use the new `google-genai` SDK correctly via `from google import genai`, and neither notebook's `%pip install` cell installs `google-generativeai`. On a clean Colab kernel the dead imports raise `ModuleNotFoundError`; on a kernel where the legacy package happens to be pre-installed, the dead imports silently shadow the working `genai` namespace. - quickstarts/Spatial_understanding.ipynb cell 19: delete the dead `import google.generativeai as genai` line; the rest of the cell (PIL.Image, io, os, requests, BytesIO) is genuinely used downstream - examples/Animated_Story_Video_Generation_gemini.ipynb cell 7: delete the cell entirely. The cell holds only the dead import No behavioural change beyond removing dead code that would otherwise fail or shadow at notebook runtime. * fix(examples): replace deprecated Live API session.send in Animated Story notebook (#1249) Use session.send_client_content(turns=..., turn_complete=True) instead of the deprecated session.send(input=..., end_of_turn=True), which emits a DeprecationWarning in google-genai (removal not before Q3 2025). Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct case-sensitive links to Search_Grounding/Code_Execution (#1248) Three cross-notebook links used lowercase filenames (Search_grounding.ipynb, Code_execution.ipynb) that 404 on case-sensitive file systems like GitHub. Point them at the actual files: Search_Grounding.ipynb and Code_Execution.ipynb. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct broken Contributing guide link in Template.ipynb (#1247) The template linked the contributing guide as `Contributing.mg`, which is both a typo (`.mg`) and a path that does not exist next to the notebook. Point it at the repo's CONTRIBUTING.md using the same absolute GitHub URL the notebook already uses elsewhere. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix: align error handling notebook with google-genai retries (#1229) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README (#1257) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README * Update quickstarts/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * feat: add Live Translation quickstart tutorial and examples (#1259) * feat: add Live Translation quickstart tutorial and examples * chore: clean up notebook metadata and reorder cell output attributes * refactor: Live Translation notebook and script from cookbook (#1261) * Prohibit yt-dlp usage for YouTube content (#1264) Added a restriction against using yt-dlp for downloading or streaming YouTube content due to terms of service violations. * Sketch2Paint using Gemini (#790) --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * Add service account auth section with IAM roles for Gemini, File, and… (#1258) * Add service account auth section with IAM roles for Gemini, File, and Vertex AI APIs * Remove service account section, add link to GCP auth docs instead * Add Vertex AI authentication documentation link * Fix embedding types & casing (#1032) * Fix embedding types & casing (fixes #1030) * Fix query task_type and indentation style violations * fix indentation style * fixed the formatting and linting issue * update model ID * fix formatting * Update styleguide with API key and crypto restrictions Added guidelines for API key usage and restrictions on crypto topics. * Manually updating the get started notebook * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Delete quickstarts/Not_yet_in_Interactions_API.ipynb * style, fix: format notebooks, update missing outputs, bump SDK versions, and align model selectors * fix: update Get_started_Lyria.ipynb to use lowercase response_modalities without config wrapper * docs: add type: text to response_format example in CONTRIBUTING.md * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update quickstarts/Enum.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: update Error_handling.ipynb to pass http_options on genai.Client instead of config wrapper * fix: mass update google-genai to >=2.9.0 and replace GOOGLE_API_KEY with GEMINI_API_KEY across repository * style: format all notebooks with nbfmt to comply with TensorFlow docs style --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Shipra <ships3040@gmail.com> Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Rohan Dwivedi <165134541+ROHANDWIVEDI2005@users.noreply.github.com> Co-authored-by: AgentModuleAdmin <0agentmodule@gmail.com> Co-authored-by: Patrick Loeber <50772274+patrickloeber@users.noreply.github.com> Co-authored-by: Irfaan Mansoori <irfaanmansoori100@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aryan Motgi <85900811+aryanmotgi@users.noreply.github.com> Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com> Co-authored-by: Mark Daoust <markdaoust@google.com> Co-authored-by: August Cayzer <august@cayzer.me> Co-authored-by: Sri Ujwal <113922053+sbeeredd04@users.noreply.github.com> Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> Co-authored-by: qianzhu / Lucien <2729478828@qq.com> Co-authored-by: Naveen Kumar G <naveen13524g@gmail.com> Co-authored-by: Nitin Tiwari <37960279+NSTiwari@users.noreply.github.com> Co-authored-by: Anika Islam <172253577+Surjasa@users.noreply.github.com> | 2 个月前 | |
Fix scale= command in Lyria realtime quickstart (#1236) The scale= parser compared the raw prompt (which still contains the 'scale=' prefix) against enum names like A_FLAT_MAJOR_F_MINOR, so the match never succeeded and the command always printed 'Matching enum not found.' Strip the 'scale=' prefix before comparing, matching how the sibling bpm= and top_k= handlers already work. | 3 个月前 | |
Add Gemini 3.6 Flash & Gemini 3.5 Flash-Lite | 1 个月前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Convert all quickstarts to the Interactions API (#1275) * Migrate quickstart notebooks to Interactions API (google-genai>=2.0.0) Migrate all quickstart notebooks from the legacy generate_content API to the new Interactions API using client.interactions.create(). Changes include: - All notebooks use google-genai>=2.0.0 and the Interactions API - Fix typos: thiking, inlcuding, EMBEDDIG, respose_mime_type, uniiformize, ouput - Fix Youtube -> YouTube across notebooks - Standardize !pip -> %pip for Colab best practices - Standardize 2-space -> 4-space Python indentation - Fix Audio.ipynb: complete incomplete transcript example - Fix Enum.ipynb: correct broken link to JSON_mode - Fix Error_handling.ipynb: clarify retry mechanism text - Fix Grounding.ipynb: title heading H2 -> H1 - Fix Video_understanding.ipynb: extra H1 -> H2 - Fix Get_started_OpenAI_Compatibility.ipynb: remove duplicate cells - Add Get_started_Generate_Content.ipynb (legacy API reference) - Delete New_in_002.ipynb (deprecated) - Run nbfmt formatting on all notebooks * Fix gemini-code-assist review comments - Video_understanding: move %%html magic before #@title (cell magics must be first line) - Grounding: restore @param Colab selector for MODEL_ID - Grounding: clear RateLimitError (429) output from cell - Asynchronous_requests: clear FileNotFoundError/ModuleNotFoundError/NameError outputs * Update CONTRIBUTING.md and styleguide with Interactions API guidelines - Add 'Interactions API' section explaining when to use client.interactions.create() - Document exceptions (Veo, Imagen, Lyria, LiveAPI, embeddings, TTS, batch, caching, File API) - Update SDK version from >=1.0.0 to >=2.0.0 - Update code examples from generate_content() to interactions.create() - Fix typo: 'uimport' -> 'import' in styleguide * Address gemini-code-assist review feedback (round 2) - Video_understanding: fix #@title/%%html order (#@title first for Colab forms) - Grounding: fix copy-paste prompt error (vegetable glycerin → Gemma chess) - Grounding: fix .: typo in 'Summarize this video.:' - Grounding: fix invalid \$ escape sequences → raw strings - Grounding: use .text shortcut for consistent response access - Batch_mode: fix GOOGLE_API_KEY → GEMINI_API_KEY in markdown text - Function_calling: add safe step.arguments None check - 29 notebooks: standardize pip install to use single quotes - Re-run nbfmt on all files * Fix GOOGLE_API_KEY, pip comments, model selectors, and remaining generate_content Global fixes across all notebooks: - GOOGLE_API_KEY → GEMINI_API_KEY in 18 notebooks (markdown + code) - Add '# 2.0 is needed to use the interactions API' comment to pip install lines - Remove gemini-2.5-flash-lite from all model selectors (3.1 is GA) - Add gemini-3-flash-preview to standard model selectors where missing Per-notebook fixes: - Authentication.ipynb: migrate generate_content → interactions.create - Embeddings.ipynb: migrate generate_content → interactions.create - Error_handling.ipynb: migrate generate_content → interactions.create - File_Search.ipynb: migrate generate_content → interactions.create - Get_started.ipynb: migrate generate_content → interactions.create - Get_started_thinking.ipynb: migrate generate_content → interactions.create (13 cells) - Grounding.ipynb: migrate generate_content → interactions.create (2 cells) Re-run nbfmt on all files * Audio notebook fixes + global: remove thinking remark, add Interactions API note Audio.ipynb fixes: - Remove outdated thinking model remark (all recent models think) - 'Use PyDub' → 'Use for example PyDub' + explain base64 encoding - Use Markdown display for transcript and timestamp sections - Add @param form magic to youtube_url for easy editing - Fix missing closing parenthesis in count tokens section Global fixes: - Remove thinking model remark from 13 other notebooks - Add Interactions API note to 4 notebooks that were missing it (Authentication, Embeddings, Deep_Research, Lyria) * Asynchronous_requests: display downloaded images before using them * Major Get_started.ipynb revision + global fixes Get_started.ipynb changes: - Remove overview sentence, expand TOC with all features - Point to Generate_Content notebook instead of archive branch - Fix pip comment: 'breaking changes' → 'GA/Stable release' - Show interaction.steps structure and .text shortcut - Show downloaded image in multimodal section - Remove image resize before base64 (unnecessary) - Remove duplicate blog post cell - Add image generation intro section - Rephrase safety: models manage safety automatically, no configurable settings - Add 24h retention detail for conversation state - Explain model_json_schema() for JSON generation - Fix client.aio code - Make 'Upload an image file' self-contained - Fix incorrect media_resolution reference - Google Maps: 'around here' → 'around the Eiffel Tower in Paris' - Add YouTube processing explanation - Function calling: explain no auto-FC in Interactions API - Caching: automatic with Interactions API - Remove 'Run this cell to set everything up' cell - Move thought_signatures into thinking section - Move media_resolution after upload files Global fixes: - 'for an example' → 'for a walkthrough' in 39 notebooks * Deep Research: remove note, split cells; Get_started: add image URL approach Get_started_Deep_Research.ipynb: - Removed Interactions API note (model doesn't work with generateContent) - Split 'Collaborative planning' and 'Step 1' into separate cells - Split 'Tool configuration' and 'Restrict to Google Search only' into separate cells Get_started.ipynb: - Added image URL as first multimodal approach (simplest way) - Added transition text explaining base64 alternative * Get_started: simplify PDF to URL approach; Deep Research: fix indentation Get_started.ipynb: - Replace PDF upload example with direct URL approach (arxiv paper) - No need to download/upload PDFs, just pass the URL directly Get_started_Deep_Research.ipynb: - Fix prompt indentation for EV batteries research prompt * Get_started: add code execution header, migration section, media res per-file; GC: fix URL context Get_started.ipynb: - Add proper '## Code execution' section header before existing code - Add 'Migrating from Gemini 2.5' section before Next Steps - Update Media resolution with per-file details and default behavior - Update TOC with code execution and migration links - Fix .text shortcut (doesn't exist on ModelOutputStep) Get_started_Generate_Content.ipynb: - Fix URL context output: display(Markdown()) → Markdown() * Remove Not_yet_in_Interactions_API refs, update caching, fix stale links - Remove all references to Not_yet_in_Interactions_API.ipynb (won't be published) - Delete redirect cells in Caching.ipynb and Safety.ipynb - Remove Not_yet comments from File_Search, Grounding, Spatial_understanding, Video_understanding, Get_started_thinking - Get_started.ipynb: rewrite caching section with implicit caching explanation from docs, remove Caching.ipynb link - Counting_Tokens.ipynb: update Caching.ipynb links to docs URL - Get_started_Generate_Content.ipynb: fix URL context Markdown display * Batch_mode: fix model selector order (default first) * Add gemini-3-flash-preview to model selectors in Code_Execution and thinking_REST * Counting_Tokens: use URIs directly for inline content, keep File API downloads Simplified multimodal token counting: - Image inline: pass URL directly via types.Part(file_data=...) instead of downloading with curl and loading with PIL - Audio: still downloads for File API upload (required) - Removed unnecessary curl/PIL dependencies for inline examples * Code_Execution: use image URI directly, remove curl/base64 - Replace curl download + base64 encoding with direct image URI - Fix wrong mime_type (was image/jpeg for a PNG file) - Simplifies the notebook and avoids transient image processing errors * Fix Error_handling headings, Enum model selector, Embeddings TOC + .text bug Error_handling.ipynb: - Add '## Error handling strategies' before 'Automatic retries' so sections aren't grouped under 'Setup your API key' in Colab TOC Enum.ipynb: - Add gemini-3-flash-preview to model selector (was missing) Embeddings.ipynb: - Add anchor links to TOC entries - Add anchor tags to section headers - Fix last cell: final_answer.text → final_answer.steps[-1].content[0].text - Add gemini-3-flash-preview to the RAG model selector * Function_calling: major refactor for Interactions vs GC clarity; robotics-er: fix pip Function_calling.ipynb: - Clarify Auto FC is client.chats only (not interactions API) - Add prints to add/subtract/multiply/divide functions - Explain .to_json_dict() and its use with interactions API - Rewrite manual FC intro as THE way for interactions API - Update explanations: interactions uses previous_interaction_id, not chat sessions - Fix indentation in compositional FC code - Mark AUTO/ANY/NONE modes as generateContent features - Show GC code example for ANY mode with tool_config - Rewrite Next Steps for both APIs (fix weird GenerateContentConfig text) gemini-robotics-er.ipynb: - Remove interactions API comment from pip install (not using it) * Add gemini-3-flash-preview to all model selectors; create Not_yet guide; fix File_API Global: - Add gemini-3-flash-preview to model selector dropdown in 19 notebooks (was set as default but missing from the list) Not_yet_in_Interactions_API.ipynb (NEW): - Document features only available with generateContent: - Automatic Function Calling (chats only) - Function Calling Modes (AUTO/ANY/NONE via tool_config) - Safety Settings Configuration - Explicit Context Caching - Batch API - Include code examples for both APIs where applicable File_API.ipynb: - Update intro text: generateContent/streamGenerateContent → interactions API * Major batch: migrate TTS/Lyria/NanoBanana to interactions API, rewrite thinking Get_started_TTS.ipynb: - Migrate all generate_content → interactions.create - Update play_audio helper for interactions response structure - Fix blob extraction patterns Get_Started_Nano_Banana.ipynb: - Migrate all 22 generate_content → interactions.create - Update display_response helper for interactions steps - Fix grounding metadata extraction - Fix duplicate SDK install comment Get_started_Lyria.ipynb: - Migrate all generate_content → interactions.create - Update display_lyria_response for interactions steps - Replace 'Using Interactions API' section with GC reference - Remove redundant interaction demo cells Get_started_thinking.ipynb: - Remove Gemini 2.5/3 generation-specific language - thinking_budget → thinking_level everywhere - generate_content → interactions.create in code cells - Fix response patterns (candidates[0].content.parts → interaction.steps) - Merge Gemini 3 section into main flow - thinking_budget kept only in legacy migration section Other fixes: - Remove interactions API comments from pip installs in imagen, LearnLM, LiveAPI, LiveAPI_tools, LyriaRealTime (not using interactions API) - OpenAI Compat: revert SDK comment - Interactions API notebook: remove colab button, add colab icons to table * Fix grounding, models, delete Image_out Grounding.ipynb: - YouTube: use video type input instead of url_context - PDF by URL: show both methods (direct URI + url_context) - Image by URL: show both methods (direct URI + url_context) Get_started.ipynb: - YouTube: use video type input instead of url_context Not_yet_in_Interactions_API.ipynb: - Add Maps grounding sources section (widget + citations) - Update TOC Models.ipynb: - Populate outputs using external API key (50 models listed) Image_out.ipynb: - Deleted (unused) * JSON_mode: explain response_format, add Pydantic model_json_schema - Explain why response_format with mime_type application/json is needed (prevents markdown wrapping / explanatory text) - 'The newest models allow you' → 'Another option is to pass...' - Replace hand-written JSON Schema with Pydantic + .model_json_schema() - Add model_validate_json() example for type-safe validation - Keep TypedDict fallback for non-Pydantic users - Update Next Steps with links to streaming, tools, and JSON schema docs * PDF_Files, Safety, Prompting updates PDF_Files.ipynb: - Add 'Read a PDF by URL' section (pass URI directly, no upload needed) - Move Setup/Configure API key to level 3 headings - Fix generateContent reference in Learning more Safety.ipynb: - Convert to info-only stub (like Caching notebook) - Explain that Interactions API uses built-in safety - Keep safety categories table and generateContent example as reference - Link to archived version for runnable code Prompting.ipynb: - Move Setup/Configure API key to level 3 headings - Add image-by-URI example (pass URL directly) * Fix remaining thinking_budget→thinking_level, Lyria text Thinking: Replace 4 remaining thinking_budget usages with thinking_level - Cells 23,27: thinking_budget=0 → thinking_level='none' - Cells 54,58: thinking_budget=thinking_budget → thinking_level=thinking_level - Cell 64 (legacy section) intentionally kept Lyria: Fix cell 13 text referencing generate_content * Final cleanups: Webhooks, Video, Streaming, Spatial Webhooks: - Remove SDK 2.0 minimum version requirements Video_understanding: - Correct Gemini 2.0/2.5 references to just Gemini - Remove video iframe player at the top and keep standard links Streaming: - Separate response declaration from loops to improve indentation/readability - Clarify client.aio async usage and properties - Add What's Next section at the end Spatial_understanding: - Translate Japanese bento prompt back to English - Completely remove experimental Segmentation section (which is no longer supported) * Apply PR #16 feedback audit fixes Addressed feedback for multiple notebooks: - Get_started & Get_started_Generate_Content: Re-executed and populated outputs, fixed notebook format and Colab userdata fallback. - Counting_Tokens: Replaced downloads with direct URI passing in cells 30, 32. - Embeddings: Added missing TOC links. - Get_started_TTS: Changed !pip to %pip and removed SDK 2.0 comment. - Imagen/LearnLM/LyriaRealTime: Removed unnecessary >=2.0.0 pins. - Spatial_understanding: Removed segmentation mention in cell 13. - Code_Execution: Populated outputs, added cat.png asset for execution. - Video_understanding: Removed pip install comment. - Grounding: Updated TOC. * Added new notebook Basic_Code_Review to examples (#689) --------- Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> * Add Basic_Code_Review example to README (#1218) * Add Basic_Code_Review example to README * Update examples/prompting/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Added example for gemini api used to extract insights from github #923 #887 (#1150) * added example for gemini api used to extract insights from github --------- Co-authored-by: kkorpal <kkorpal@google.com> * Add example: EU AI Act compliance checking with Gemini function calling + Agent Module (#1167) * Add EU AI Act compliance example with Gemini function calling + Agent Module * style: use triple-quoted string per review feedback * fix: correct API schema + formatting per review - status["ethics"] -> status["ai_compliance"] (v0.9.21 schema rename; was the KeyError that blocked the reviewer run) - Remove unnecessary backslash line-continuations in the compliance_run prompt string; indent body; newline before closing """ - Replace static 22-row module table with dynamic discovery pointer (/api/status, /api/demo, /llms.txt) so the snapshot never goes stale - Branding: "ethics modules" -> "AI Compliance modules" in human-facing markdown; vertical slug documented as ai-compliance with ethics as legacy alias (both still accepted by the API) - Correct ETH_001 EU AI Act mapping (Art. 9 + 10, not 10 + 13) * fix: prevent trial key collision on reruns Follow-up to the schema/formatting fixes. Colab testing surfaced a runtime bug: the Agent Module API returns a masked preview of an existing trial key (e.g. `am_trial_841...f660`) if you request a new one while the old one is still active, and the original notebook wrapper blindly stored the preview — corrupting _trial_key and breaking every downstream retrieve_compliance_logic call. Changes: - Generate a unique per-run agent_id (uuid suffix) so reruns within 24 hours do not collide with a still-active trial on the server - Make get_trial_key idempotent (short-circuit if _trial_key already set in this session) so Gemini tool loops cannot re-trigger it - Detect status=="already_active" in the MCP response and refuse to store the masked preview; surface a clear error instead - Remove get_trial_key from the tools list passed to Gemini. Trial bootstrap is a setup step, not a runtime tool — the model should only see retrieve_compliance_logic and submit_proof_of_value - Reframe the cell 27 preamble to explain the setup/runtime split * fix: pass both token and trial_key to submit_pov MCP tool * fix: print full chat history so cell 30 shows the complete compliance report * chore: save executed notebook with cell outputs * fix: add Colab button + README link for CI compliance - Add Colab badge to notebook title cell (tfo-notebook-buttons CI check) - Add notebook entry to examples/README.md table (new-example-links CI check) * chore: retrigger CI checks * Fix notebook lint (inclusive_language) + nbfmt format - Rewords 'Agent-native' to 'Purpose-built for autonomous agents' in the branding cell to clear google::inclusive_language lint flag - Applies tensorflow_docs.tools.nbfmt formatting pass to clear Notebook format check - No other content changes; all 21 cell outputs preserved * Fix colab.name metadata + cell 30 prompt (third-person) to clear nbfmt + second_person checks --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * add gemini-3.5-flash (#1232) * New agent notebook (#1233) * Fixing typos * Adding links to the agents notebooks (#1234) * docs: fix typos and capitalization consistency in README (#1240) * docs: fix typos and capitalization consistency in README * docs: apply gemini suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Bump qs from 6.15.1 to 6.15.2 in /quickstarts/file-api (#1238) Bumps [qs](https://github.com/ljharb/qs) from 6.15.1 to 6.15.2. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.15.1...v6.15.2) --- updated-dependencies: - dependency-name: qs dependency-version: 6.15.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix scale= command in Lyria realtime quickstart (#1236) The scale= parser compared the raw prompt (which still contains the 'scale=' prefix) against enum names like A_FLAT_MAJOR_F_MINOR, so the match never succeeded and the command always printed 'Matching enum not found.' Strip the 'scale=' prefix before comparing, matching how the sibling bpm= and top_k= handlers already work. * update live api ws cookbook (#1223) * Interactions steps (#1237) * Merge origin/main into interaction-steps and resolve conflict * steps * Add environment support * work * cleanup * format * cleanup * Add back execution_count * Standardize Colab buttons and fix URLs across edited notebooks * feat: update visual model names to GA and add video-to-image example (#1244) * feat: update visual model names to GA and add video-to-image example - Updated gemini-3-pro-image-preview to gemini-3-pro-image (Nano Banana Pro GA) - Updated gemini-3.1-flash-image-preview to gemini-3.1-flash-image (Nano Banana 2 GA) - Added a new video-to-image example in Get_Started_Nano_Banana.ipynb - Formatted modified notebooks with nbfmt * feat(batch): add gemini-3.5-flash to model selector * style: format banana notebook to clean up PR diff * style: trim thought signature in Get_Started_Nano_Banana notebook To reduce file size and prevent git/diff hanging on massive cryptographically signed binary thoughts. * refactor: update Live API configuration, transcription support, and input handling for model version gemini-3.1-flash-live-preview (#1224) * Update Get_started_LiveAPI (#1222) * Update Get_started_LiveAPI * remove interactivity. * session resumption update. * run. * nbfmt * Resizing the NB notebook (#1245) * feat: add example for custom FPS in Grounding notebook (#1243) * feat: add example for custom FPS in Grounding notebook * Format custom frame rate explanation in Grounding.ipynb * Fix formatting of YouTube link and response generation * Fix formatting issues in Grounding.ipynb * Fix YouTube link formatting in Grounding.ipynb * docs: fix typographical and spelling errors in styleguide and quickstarts (#1253) * docs: fix typographical and spelling errors in styleguide.md * docs: fix typo in Image_out notebook header * fix: remove leftover google-generativeai imports from two notebooks (#1246) Two notebooks had leftover `import google.generativeai as genai` lines from a prior partial migration. Both notebooks otherwise use the new `google-genai` SDK correctly via `from google import genai`, and neither notebook's `%pip install` cell installs `google-generativeai`. On a clean Colab kernel the dead imports raise `ModuleNotFoundError`; on a kernel where the legacy package happens to be pre-installed, the dead imports silently shadow the working `genai` namespace. - quickstarts/Spatial_understanding.ipynb cell 19: delete the dead `import google.generativeai as genai` line; the rest of the cell (PIL.Image, io, os, requests, BytesIO) is genuinely used downstream - examples/Animated_Story_Video_Generation_gemini.ipynb cell 7: delete the cell entirely. The cell holds only the dead import No behavioural change beyond removing dead code that would otherwise fail or shadow at notebook runtime. * fix(examples): replace deprecated Live API session.send in Animated Story notebook (#1249) Use session.send_client_content(turns=..., turn_complete=True) instead of the deprecated session.send(input=..., end_of_turn=True), which emits a DeprecationWarning in google-genai (removal not before Q3 2025). Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct case-sensitive links to Search_Grounding/Code_Execution (#1248) Three cross-notebook links used lowercase filenames (Search_grounding.ipynb, Code_execution.ipynb) that 404 on case-sensitive file systems like GitHub. Point them at the actual files: Search_Grounding.ipynb and Code_Execution.ipynb. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct broken Contributing guide link in Template.ipynb (#1247) The template linked the contributing guide as `Contributing.mg`, which is both a typo (`.mg`) and a path that does not exist next to the notebook. Point it at the repo's CONTRIBUTING.md using the same absolute GitHub URL the notebook already uses elsewhere. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix: align error handling notebook with google-genai retries (#1229) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README (#1257) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README * Update quickstarts/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * feat: add Live Translation quickstart tutorial and examples (#1259) * feat: add Live Translation quickstart tutorial and examples * chore: clean up notebook metadata and reorder cell output attributes * refactor: Live Translation notebook and script from cookbook (#1261) * Prohibit yt-dlp usage for YouTube content (#1264) Added a restriction against using yt-dlp for downloading or streaming YouTube content due to terms of service violations. * Sketch2Paint using Gemini (#790) --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * Add service account auth section with IAM roles for Gemini, File, and… (#1258) * Add service account auth section with IAM roles for Gemini, File, and Vertex AI APIs * Remove service account section, add link to GCP auth docs instead * Add Vertex AI authentication documentation link * Fix embedding types & casing (#1032) * Fix embedding types & casing (fixes #1030) * Fix query task_type and indentation style violations * fix indentation style * fixed the formatting and linting issue * update model ID * fix formatting * Update styleguide with API key and crypto restrictions Added guidelines for API key usage and restrictions on crypto topics. * Manually updating the get started notebook * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Delete quickstarts/Not_yet_in_Interactions_API.ipynb * style, fix: format notebooks, update missing outputs, bump SDK versions, and align model selectors * fix: update Get_started_Lyria.ipynb to use lowercase response_modalities without config wrapper * docs: add type: text to response_format example in CONTRIBUTING.md * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update quickstarts/Enum.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: update Error_handling.ipynb to pass http_options on genai.Client instead of config wrapper * fix: mass update google-genai to >=2.9.0 and replace GOOGLE_API_KEY with GEMINI_API_KEY across repository * style: format all notebooks with nbfmt to comply with TensorFlow docs style --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Shipra <ships3040@gmail.com> Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Rohan Dwivedi <165134541+ROHANDWIVEDI2005@users.noreply.github.com> Co-authored-by: AgentModuleAdmin <0agentmodule@gmail.com> Co-authored-by: Patrick Loeber <50772274+patrickloeber@users.noreply.github.com> Co-authored-by: Irfaan Mansoori <irfaanmansoori100@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aryan Motgi <85900811+aryanmotgi@users.noreply.github.com> Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com> Co-authored-by: Mark Daoust <markdaoust@google.com> Co-authored-by: August Cayzer <august@cayzer.me> Co-authored-by: Sri Ujwal <113922053+sbeeredd04@users.noreply.github.com> Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> Co-authored-by: qianzhu / Lucien <2729478828@qq.com> Co-authored-by: Naveen Kumar G <naveen13524g@gmail.com> Co-authored-by: Nitin Tiwari <37960279+NSTiwari@users.noreply.github.com> Co-authored-by: Anika Islam <172253577+Surjasa@users.noreply.github.com> | 2 个月前 | |
Revert "Revert "Veo 3.1 (#1180)" (#1181)" (#1182) This reverts commit 69efd5041769417959ff379375b9bd63482162a9. | 5 个月前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Convert all quickstarts to the Interactions API (#1275) * Migrate quickstart notebooks to Interactions API (google-genai>=2.0.0) Migrate all quickstart notebooks from the legacy generate_content API to the new Interactions API using client.interactions.create(). Changes include: - All notebooks use google-genai>=2.0.0 and the Interactions API - Fix typos: thiking, inlcuding, EMBEDDIG, respose_mime_type, uniiformize, ouput - Fix Youtube -> YouTube across notebooks - Standardize !pip -> %pip for Colab best practices - Standardize 2-space -> 4-space Python indentation - Fix Audio.ipynb: complete incomplete transcript example - Fix Enum.ipynb: correct broken link to JSON_mode - Fix Error_handling.ipynb: clarify retry mechanism text - Fix Grounding.ipynb: title heading H2 -> H1 - Fix Video_understanding.ipynb: extra H1 -> H2 - Fix Get_started_OpenAI_Compatibility.ipynb: remove duplicate cells - Add Get_started_Generate_Content.ipynb (legacy API reference) - Delete New_in_002.ipynb (deprecated) - Run nbfmt formatting on all notebooks * Fix gemini-code-assist review comments - Video_understanding: move %%html magic before #@title (cell magics must be first line) - Grounding: restore @param Colab selector for MODEL_ID - Grounding: clear RateLimitError (429) output from cell - Asynchronous_requests: clear FileNotFoundError/ModuleNotFoundError/NameError outputs * Update CONTRIBUTING.md and styleguide with Interactions API guidelines - Add 'Interactions API' section explaining when to use client.interactions.create() - Document exceptions (Veo, Imagen, Lyria, LiveAPI, embeddings, TTS, batch, caching, File API) - Update SDK version from >=1.0.0 to >=2.0.0 - Update code examples from generate_content() to interactions.create() - Fix typo: 'uimport' -> 'import' in styleguide * Address gemini-code-assist review feedback (round 2) - Video_understanding: fix #@title/%%html order (#@title first for Colab forms) - Grounding: fix copy-paste prompt error (vegetable glycerin → Gemma chess) - Grounding: fix .: typo in 'Summarize this video.:' - Grounding: fix invalid \$ escape sequences → raw strings - Grounding: use .text shortcut for consistent response access - Batch_mode: fix GOOGLE_API_KEY → GEMINI_API_KEY in markdown text - Function_calling: add safe step.arguments None check - 29 notebooks: standardize pip install to use single quotes - Re-run nbfmt on all files * Fix GOOGLE_API_KEY, pip comments, model selectors, and remaining generate_content Global fixes across all notebooks: - GOOGLE_API_KEY → GEMINI_API_KEY in 18 notebooks (markdown + code) - Add '# 2.0 is needed to use the interactions API' comment to pip install lines - Remove gemini-2.5-flash-lite from all model selectors (3.1 is GA) - Add gemini-3-flash-preview to standard model selectors where missing Per-notebook fixes: - Authentication.ipynb: migrate generate_content → interactions.create - Embeddings.ipynb: migrate generate_content → interactions.create - Error_handling.ipynb: migrate generate_content → interactions.create - File_Search.ipynb: migrate generate_content → interactions.create - Get_started.ipynb: migrate generate_content → interactions.create - Get_started_thinking.ipynb: migrate generate_content → interactions.create (13 cells) - Grounding.ipynb: migrate generate_content → interactions.create (2 cells) Re-run nbfmt on all files * Audio notebook fixes + global: remove thinking remark, add Interactions API note Audio.ipynb fixes: - Remove outdated thinking model remark (all recent models think) - 'Use PyDub' → 'Use for example PyDub' + explain base64 encoding - Use Markdown display for transcript and timestamp sections - Add @param form magic to youtube_url for easy editing - Fix missing closing parenthesis in count tokens section Global fixes: - Remove thinking model remark from 13 other notebooks - Add Interactions API note to 4 notebooks that were missing it (Authentication, Embeddings, Deep_Research, Lyria) * Asynchronous_requests: display downloaded images before using them * Major Get_started.ipynb revision + global fixes Get_started.ipynb changes: - Remove overview sentence, expand TOC with all features - Point to Generate_Content notebook instead of archive branch - Fix pip comment: 'breaking changes' → 'GA/Stable release' - Show interaction.steps structure and .text shortcut - Show downloaded image in multimodal section - Remove image resize before base64 (unnecessary) - Remove duplicate blog post cell - Add image generation intro section - Rephrase safety: models manage safety automatically, no configurable settings - Add 24h retention detail for conversation state - Explain model_json_schema() for JSON generation - Fix client.aio code - Make 'Upload an image file' self-contained - Fix incorrect media_resolution reference - Google Maps: 'around here' → 'around the Eiffel Tower in Paris' - Add YouTube processing explanation - Function calling: explain no auto-FC in Interactions API - Caching: automatic with Interactions API - Remove 'Run this cell to set everything up' cell - Move thought_signatures into thinking section - Move media_resolution after upload files Global fixes: - 'for an example' → 'for a walkthrough' in 39 notebooks * Deep Research: remove note, split cells; Get_started: add image URL approach Get_started_Deep_Research.ipynb: - Removed Interactions API note (model doesn't work with generateContent) - Split 'Collaborative planning' and 'Step 1' into separate cells - Split 'Tool configuration' and 'Restrict to Google Search only' into separate cells Get_started.ipynb: - Added image URL as first multimodal approach (simplest way) - Added transition text explaining base64 alternative * Get_started: simplify PDF to URL approach; Deep Research: fix indentation Get_started.ipynb: - Replace PDF upload example with direct URL approach (arxiv paper) - No need to download/upload PDFs, just pass the URL directly Get_started_Deep_Research.ipynb: - Fix prompt indentation for EV batteries research prompt * Get_started: add code execution header, migration section, media res per-file; GC: fix URL context Get_started.ipynb: - Add proper '## Code execution' section header before existing code - Add 'Migrating from Gemini 2.5' section before Next Steps - Update Media resolution with per-file details and default behavior - Update TOC with code execution and migration links - Fix .text shortcut (doesn't exist on ModelOutputStep) Get_started_Generate_Content.ipynb: - Fix URL context output: display(Markdown()) → Markdown() * Remove Not_yet_in_Interactions_API refs, update caching, fix stale links - Remove all references to Not_yet_in_Interactions_API.ipynb (won't be published) - Delete redirect cells in Caching.ipynb and Safety.ipynb - Remove Not_yet comments from File_Search, Grounding, Spatial_understanding, Video_understanding, Get_started_thinking - Get_started.ipynb: rewrite caching section with implicit caching explanation from docs, remove Caching.ipynb link - Counting_Tokens.ipynb: update Caching.ipynb links to docs URL - Get_started_Generate_Content.ipynb: fix URL context Markdown display * Batch_mode: fix model selector order (default first) * Add gemini-3-flash-preview to model selectors in Code_Execution and thinking_REST * Counting_Tokens: use URIs directly for inline content, keep File API downloads Simplified multimodal token counting: - Image inline: pass URL directly via types.Part(file_data=...) instead of downloading with curl and loading with PIL - Audio: still downloads for File API upload (required) - Removed unnecessary curl/PIL dependencies for inline examples * Code_Execution: use image URI directly, remove curl/base64 - Replace curl download + base64 encoding with direct image URI - Fix wrong mime_type (was image/jpeg for a PNG file) - Simplifies the notebook and avoids transient image processing errors * Fix Error_handling headings, Enum model selector, Embeddings TOC + .text bug Error_handling.ipynb: - Add '## Error handling strategies' before 'Automatic retries' so sections aren't grouped under 'Setup your API key' in Colab TOC Enum.ipynb: - Add gemini-3-flash-preview to model selector (was missing) Embeddings.ipynb: - Add anchor links to TOC entries - Add anchor tags to section headers - Fix last cell: final_answer.text → final_answer.steps[-1].content[0].text - Add gemini-3-flash-preview to the RAG model selector * Function_calling: major refactor for Interactions vs GC clarity; robotics-er: fix pip Function_calling.ipynb: - Clarify Auto FC is client.chats only (not interactions API) - Add prints to add/subtract/multiply/divide functions - Explain .to_json_dict() and its use with interactions API - Rewrite manual FC intro as THE way for interactions API - Update explanations: interactions uses previous_interaction_id, not chat sessions - Fix indentation in compositional FC code - Mark AUTO/ANY/NONE modes as generateContent features - Show GC code example for ANY mode with tool_config - Rewrite Next Steps for both APIs (fix weird GenerateContentConfig text) gemini-robotics-er.ipynb: - Remove interactions API comment from pip install (not using it) * Add gemini-3-flash-preview to all model selectors; create Not_yet guide; fix File_API Global: - Add gemini-3-flash-preview to model selector dropdown in 19 notebooks (was set as default but missing from the list) Not_yet_in_Interactions_API.ipynb (NEW): - Document features only available with generateContent: - Automatic Function Calling (chats only) - Function Calling Modes (AUTO/ANY/NONE via tool_config) - Safety Settings Configuration - Explicit Context Caching - Batch API - Include code examples for both APIs where applicable File_API.ipynb: - Update intro text: generateContent/streamGenerateContent → interactions API * Major batch: migrate TTS/Lyria/NanoBanana to interactions API, rewrite thinking Get_started_TTS.ipynb: - Migrate all generate_content → interactions.create - Update play_audio helper for interactions response structure - Fix blob extraction patterns Get_Started_Nano_Banana.ipynb: - Migrate all 22 generate_content → interactions.create - Update display_response helper for interactions steps - Fix grounding metadata extraction - Fix duplicate SDK install comment Get_started_Lyria.ipynb: - Migrate all generate_content → interactions.create - Update display_lyria_response for interactions steps - Replace 'Using Interactions API' section with GC reference - Remove redundant interaction demo cells Get_started_thinking.ipynb: - Remove Gemini 2.5/3 generation-specific language - thinking_budget → thinking_level everywhere - generate_content → interactions.create in code cells - Fix response patterns (candidates[0].content.parts → interaction.steps) - Merge Gemini 3 section into main flow - thinking_budget kept only in legacy migration section Other fixes: - Remove interactions API comments from pip installs in imagen, LearnLM, LiveAPI, LiveAPI_tools, LyriaRealTime (not using interactions API) - OpenAI Compat: revert SDK comment - Interactions API notebook: remove colab button, add colab icons to table * Fix grounding, models, delete Image_out Grounding.ipynb: - YouTube: use video type input instead of url_context - PDF by URL: show both methods (direct URI + url_context) - Image by URL: show both methods (direct URI + url_context) Get_started.ipynb: - YouTube: use video type input instead of url_context Not_yet_in_Interactions_API.ipynb: - Add Maps grounding sources section (widget + citations) - Update TOC Models.ipynb: - Populate outputs using external API key (50 models listed) Image_out.ipynb: - Deleted (unused) * JSON_mode: explain response_format, add Pydantic model_json_schema - Explain why response_format with mime_type application/json is needed (prevents markdown wrapping / explanatory text) - 'The newest models allow you' → 'Another option is to pass...' - Replace hand-written JSON Schema with Pydantic + .model_json_schema() - Add model_validate_json() example for type-safe validation - Keep TypedDict fallback for non-Pydantic users - Update Next Steps with links to streaming, tools, and JSON schema docs * PDF_Files, Safety, Prompting updates PDF_Files.ipynb: - Add 'Read a PDF by URL' section (pass URI directly, no upload needed) - Move Setup/Configure API key to level 3 headings - Fix generateContent reference in Learning more Safety.ipynb: - Convert to info-only stub (like Caching notebook) - Explain that Interactions API uses built-in safety - Keep safety categories table and generateContent example as reference - Link to archived version for runnable code Prompting.ipynb: - Move Setup/Configure API key to level 3 headings - Add image-by-URI example (pass URL directly) * Fix remaining thinking_budget→thinking_level, Lyria text Thinking: Replace 4 remaining thinking_budget usages with thinking_level - Cells 23,27: thinking_budget=0 → thinking_level='none' - Cells 54,58: thinking_budget=thinking_budget → thinking_level=thinking_level - Cell 64 (legacy section) intentionally kept Lyria: Fix cell 13 text referencing generate_content * Final cleanups: Webhooks, Video, Streaming, Spatial Webhooks: - Remove SDK 2.0 minimum version requirements Video_understanding: - Correct Gemini 2.0/2.5 references to just Gemini - Remove video iframe player at the top and keep standard links Streaming: - Separate response declaration from loops to improve indentation/readability - Clarify client.aio async usage and properties - Add What's Next section at the end Spatial_understanding: - Translate Japanese bento prompt back to English - Completely remove experimental Segmentation section (which is no longer supported) * Apply PR #16 feedback audit fixes Addressed feedback for multiple notebooks: - Get_started & Get_started_Generate_Content: Re-executed and populated outputs, fixed notebook format and Colab userdata fallback. - Counting_Tokens: Replaced downloads with direct URI passing in cells 30, 32. - Embeddings: Added missing TOC links. - Get_started_TTS: Changed !pip to %pip and removed SDK 2.0 comment. - Imagen/LearnLM/LyriaRealTime: Removed unnecessary >=2.0.0 pins. - Spatial_understanding: Removed segmentation mention in cell 13. - Code_Execution: Populated outputs, added cat.png asset for execution. - Video_understanding: Removed pip install comment. - Grounding: Updated TOC. * Added new notebook Basic_Code_Review to examples (#689) --------- Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> * Add Basic_Code_Review example to README (#1218) * Add Basic_Code_Review example to README * Update examples/prompting/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Added example for gemini api used to extract insights from github #923 #887 (#1150) * added example for gemini api used to extract insights from github --------- Co-authored-by: kkorpal <kkorpal@google.com> * Add example: EU AI Act compliance checking with Gemini function calling + Agent Module (#1167) * Add EU AI Act compliance example with Gemini function calling + Agent Module * style: use triple-quoted string per review feedback * fix: correct API schema + formatting per review - status["ethics"] -> status["ai_compliance"] (v0.9.21 schema rename; was the KeyError that blocked the reviewer run) - Remove unnecessary backslash line-continuations in the compliance_run prompt string; indent body; newline before closing """ - Replace static 22-row module table with dynamic discovery pointer (/api/status, /api/demo, /llms.txt) so the snapshot never goes stale - Branding: "ethics modules" -> "AI Compliance modules" in human-facing markdown; vertical slug documented as ai-compliance with ethics as legacy alias (both still accepted by the API) - Correct ETH_001 EU AI Act mapping (Art. 9 + 10, not 10 + 13) * fix: prevent trial key collision on reruns Follow-up to the schema/formatting fixes. Colab testing surfaced a runtime bug: the Agent Module API returns a masked preview of an existing trial key (e.g. `am_trial_841...f660`) if you request a new one while the old one is still active, and the original notebook wrapper blindly stored the preview — corrupting _trial_key and breaking every downstream retrieve_compliance_logic call. Changes: - Generate a unique per-run agent_id (uuid suffix) so reruns within 24 hours do not collide with a still-active trial on the server - Make get_trial_key idempotent (short-circuit if _trial_key already set in this session) so Gemini tool loops cannot re-trigger it - Detect status=="already_active" in the MCP response and refuse to store the masked preview; surface a clear error instead - Remove get_trial_key from the tools list passed to Gemini. Trial bootstrap is a setup step, not a runtime tool — the model should only see retrieve_compliance_logic and submit_proof_of_value - Reframe the cell 27 preamble to explain the setup/runtime split * fix: pass both token and trial_key to submit_pov MCP tool * fix: print full chat history so cell 30 shows the complete compliance report * chore: save executed notebook with cell outputs * fix: add Colab button + README link for CI compliance - Add Colab badge to notebook title cell (tfo-notebook-buttons CI check) - Add notebook entry to examples/README.md table (new-example-links CI check) * chore: retrigger CI checks * Fix notebook lint (inclusive_language) + nbfmt format - Rewords 'Agent-native' to 'Purpose-built for autonomous agents' in the branding cell to clear google::inclusive_language lint flag - Applies tensorflow_docs.tools.nbfmt formatting pass to clear Notebook format check - No other content changes; all 21 cell outputs preserved * Fix colab.name metadata + cell 30 prompt (third-person) to clear nbfmt + second_person checks --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * add gemini-3.5-flash (#1232) * New agent notebook (#1233) * Fixing typos * Adding links to the agents notebooks (#1234) * docs: fix typos and capitalization consistency in README (#1240) * docs: fix typos and capitalization consistency in README * docs: apply gemini suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Bump qs from 6.15.1 to 6.15.2 in /quickstarts/file-api (#1238) Bumps [qs](https://github.com/ljharb/qs) from 6.15.1 to 6.15.2. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.15.1...v6.15.2) --- updated-dependencies: - dependency-name: qs dependency-version: 6.15.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix scale= command in Lyria realtime quickstart (#1236) The scale= parser compared the raw prompt (which still contains the 'scale=' prefix) against enum names like A_FLAT_MAJOR_F_MINOR, so the match never succeeded and the command always printed 'Matching enum not found.' Strip the 'scale=' prefix before comparing, matching how the sibling bpm= and top_k= handlers already work. * update live api ws cookbook (#1223) * Interactions steps (#1237) * Merge origin/main into interaction-steps and resolve conflict * steps * Add environment support * work * cleanup * format * cleanup * Add back execution_count * Standardize Colab buttons and fix URLs across edited notebooks * feat: update visual model names to GA and add video-to-image example (#1244) * feat: update visual model names to GA and add video-to-image example - Updated gemini-3-pro-image-preview to gemini-3-pro-image (Nano Banana Pro GA) - Updated gemini-3.1-flash-image-preview to gemini-3.1-flash-image (Nano Banana 2 GA) - Added a new video-to-image example in Get_Started_Nano_Banana.ipynb - Formatted modified notebooks with nbfmt * feat(batch): add gemini-3.5-flash to model selector * style: format banana notebook to clean up PR diff * style: trim thought signature in Get_Started_Nano_Banana notebook To reduce file size and prevent git/diff hanging on massive cryptographically signed binary thoughts. * refactor: update Live API configuration, transcription support, and input handling for model version gemini-3.1-flash-live-preview (#1224) * Update Get_started_LiveAPI (#1222) * Update Get_started_LiveAPI * remove interactivity. * session resumption update. * run. * nbfmt * Resizing the NB notebook (#1245) * feat: add example for custom FPS in Grounding notebook (#1243) * feat: add example for custom FPS in Grounding notebook * Format custom frame rate explanation in Grounding.ipynb * Fix formatting of YouTube link and response generation * Fix formatting issues in Grounding.ipynb * Fix YouTube link formatting in Grounding.ipynb * docs: fix typographical and spelling errors in styleguide and quickstarts (#1253) * docs: fix typographical and spelling errors in styleguide.md * docs: fix typo in Image_out notebook header * fix: remove leftover google-generativeai imports from two notebooks (#1246) Two notebooks had leftover `import google.generativeai as genai` lines from a prior partial migration. Both notebooks otherwise use the new `google-genai` SDK correctly via `from google import genai`, and neither notebook's `%pip install` cell installs `google-generativeai`. On a clean Colab kernel the dead imports raise `ModuleNotFoundError`; on a kernel where the legacy package happens to be pre-installed, the dead imports silently shadow the working `genai` namespace. - quickstarts/Spatial_understanding.ipynb cell 19: delete the dead `import google.generativeai as genai` line; the rest of the cell (PIL.Image, io, os, requests, BytesIO) is genuinely used downstream - examples/Animated_Story_Video_Generation_gemini.ipynb cell 7: delete the cell entirely. The cell holds only the dead import No behavioural change beyond removing dead code that would otherwise fail or shadow at notebook runtime. * fix(examples): replace deprecated Live API session.send in Animated Story notebook (#1249) Use session.send_client_content(turns=..., turn_complete=True) instead of the deprecated session.send(input=..., end_of_turn=True), which emits a DeprecationWarning in google-genai (removal not before Q3 2025). Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct case-sensitive links to Search_Grounding/Code_Execution (#1248) Three cross-notebook links used lowercase filenames (Search_grounding.ipynb, Code_execution.ipynb) that 404 on case-sensitive file systems like GitHub. Point them at the actual files: Search_Grounding.ipynb and Code_Execution.ipynb. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct broken Contributing guide link in Template.ipynb (#1247) The template linked the contributing guide as `Contributing.mg`, which is both a typo (`.mg`) and a path that does not exist next to the notebook. Point it at the repo's CONTRIBUTING.md using the same absolute GitHub URL the notebook already uses elsewhere. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix: align error handling notebook with google-genai retries (#1229) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README (#1257) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README * Update quickstarts/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * feat: add Live Translation quickstart tutorial and examples (#1259) * feat: add Live Translation quickstart tutorial and examples * chore: clean up notebook metadata and reorder cell output attributes * refactor: Live Translation notebook and script from cookbook (#1261) * Prohibit yt-dlp usage for YouTube content (#1264) Added a restriction against using yt-dlp for downloading or streaming YouTube content due to terms of service violations. * Sketch2Paint using Gemini (#790) --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * Add service account auth section with IAM roles for Gemini, File, and… (#1258) * Add service account auth section with IAM roles for Gemini, File, and Vertex AI APIs * Remove service account section, add link to GCP auth docs instead * Add Vertex AI authentication documentation link * Fix embedding types & casing (#1032) * Fix embedding types & casing (fixes #1030) * Fix query task_type and indentation style violations * fix indentation style * fixed the formatting and linting issue * update model ID * fix formatting * Update styleguide with API key and crypto restrictions Added guidelines for API key usage and restrictions on crypto topics. * Manually updating the get started notebook * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Delete quickstarts/Not_yet_in_Interactions_API.ipynb * style, fix: format notebooks, update missing outputs, bump SDK versions, and align model selectors * fix: update Get_started_Lyria.ipynb to use lowercase response_modalities without config wrapper * docs: add type: text to response_format example in CONTRIBUTING.md * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update quickstarts/Enum.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: update Error_handling.ipynb to pass http_options on genai.Client instead of config wrapper * fix: mass update google-genai to >=2.9.0 and replace GOOGLE_API_KEY with GEMINI_API_KEY across repository * style: format all notebooks with nbfmt to comply with TensorFlow docs style --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Shipra <ships3040@gmail.com> Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Rohan Dwivedi <165134541+ROHANDWIVEDI2005@users.noreply.github.com> Co-authored-by: AgentModuleAdmin <0agentmodule@gmail.com> Co-authored-by: Patrick Loeber <50772274+patrickloeber@users.noreply.github.com> Co-authored-by: Irfaan Mansoori <irfaanmansoori100@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aryan Motgi <85900811+aryanmotgi@users.noreply.github.com> Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com> Co-authored-by: Mark Daoust <markdaoust@google.com> Co-authored-by: August Cayzer <august@cayzer.me> Co-authored-by: Sri Ujwal <113922053+sbeeredd04@users.noreply.github.com> Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> Co-authored-by: qianzhu / Lucien <2729478828@qq.com> Co-authored-by: Naveen Kumar G <naveen13524g@gmail.com> Co-authored-by: Nitin Tiwari <37960279+NSTiwari@users.noreply.github.com> Co-authored-by: Anika Islam <172253577+Surjasa@users.noreply.github.com> | 2 个月前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Update model selectors and references across cookbook to Gemini 3.7 Flash (#1319) * Update model selectors and references from Gemini 3.6 Flash to 3.7 Flash * Replace previous Flash model references with Gemini 3.7 Flash * Fix duplicate @param entries and preserve Cost Estimation pricing | 23 天前 | |
Convert all quickstarts to the Interactions API (#1275) * Migrate quickstart notebooks to Interactions API (google-genai>=2.0.0) Migrate all quickstart notebooks from the legacy generate_content API to the new Interactions API using client.interactions.create(). Changes include: - All notebooks use google-genai>=2.0.0 and the Interactions API - Fix typos: thiking, inlcuding, EMBEDDIG, respose_mime_type, uniiformize, ouput - Fix Youtube -> YouTube across notebooks - Standardize !pip -> %pip for Colab best practices - Standardize 2-space -> 4-space Python indentation - Fix Audio.ipynb: complete incomplete transcript example - Fix Enum.ipynb: correct broken link to JSON_mode - Fix Error_handling.ipynb: clarify retry mechanism text - Fix Grounding.ipynb: title heading H2 -> H1 - Fix Video_understanding.ipynb: extra H1 -> H2 - Fix Get_started_OpenAI_Compatibility.ipynb: remove duplicate cells - Add Get_started_Generate_Content.ipynb (legacy API reference) - Delete New_in_002.ipynb (deprecated) - Run nbfmt formatting on all notebooks * Fix gemini-code-assist review comments - Video_understanding: move %%html magic before #@title (cell magics must be first line) - Grounding: restore @param Colab selector for MODEL_ID - Grounding: clear RateLimitError (429) output from cell - Asynchronous_requests: clear FileNotFoundError/ModuleNotFoundError/NameError outputs * Update CONTRIBUTING.md and styleguide with Interactions API guidelines - Add 'Interactions API' section explaining when to use client.interactions.create() - Document exceptions (Veo, Imagen, Lyria, LiveAPI, embeddings, TTS, batch, caching, File API) - Update SDK version from >=1.0.0 to >=2.0.0 - Update code examples from generate_content() to interactions.create() - Fix typo: 'uimport' -> 'import' in styleguide * Address gemini-code-assist review feedback (round 2) - Video_understanding: fix #@title/%%html order (#@title first for Colab forms) - Grounding: fix copy-paste prompt error (vegetable glycerin → Gemma chess) - Grounding: fix .: typo in 'Summarize this video.:' - Grounding: fix invalid \$ escape sequences → raw strings - Grounding: use .text shortcut for consistent response access - Batch_mode: fix GOOGLE_API_KEY → GEMINI_API_KEY in markdown text - Function_calling: add safe step.arguments None check - 29 notebooks: standardize pip install to use single quotes - Re-run nbfmt on all files * Fix GOOGLE_API_KEY, pip comments, model selectors, and remaining generate_content Global fixes across all notebooks: - GOOGLE_API_KEY → GEMINI_API_KEY in 18 notebooks (markdown + code) - Add '# 2.0 is needed to use the interactions API' comment to pip install lines - Remove gemini-2.5-flash-lite from all model selectors (3.1 is GA) - Add gemini-3-flash-preview to standard model selectors where missing Per-notebook fixes: - Authentication.ipynb: migrate generate_content → interactions.create - Embeddings.ipynb: migrate generate_content → interactions.create - Error_handling.ipynb: migrate generate_content → interactions.create - File_Search.ipynb: migrate generate_content → interactions.create - Get_started.ipynb: migrate generate_content → interactions.create - Get_started_thinking.ipynb: migrate generate_content → interactions.create (13 cells) - Grounding.ipynb: migrate generate_content → interactions.create (2 cells) Re-run nbfmt on all files * Audio notebook fixes + global: remove thinking remark, add Interactions API note Audio.ipynb fixes: - Remove outdated thinking model remark (all recent models think) - 'Use PyDub' → 'Use for example PyDub' + explain base64 encoding - Use Markdown display for transcript and timestamp sections - Add @param form magic to youtube_url for easy editing - Fix missing closing parenthesis in count tokens section Global fixes: - Remove thinking model remark from 13 other notebooks - Add Interactions API note to 4 notebooks that were missing it (Authentication, Embeddings, Deep_Research, Lyria) * Asynchronous_requests: display downloaded images before using them * Major Get_started.ipynb revision + global fixes Get_started.ipynb changes: - Remove overview sentence, expand TOC with all features - Point to Generate_Content notebook instead of archive branch - Fix pip comment: 'breaking changes' → 'GA/Stable release' - Show interaction.steps structure and .text shortcut - Show downloaded image in multimodal section - Remove image resize before base64 (unnecessary) - Remove duplicate blog post cell - Add image generation intro section - Rephrase safety: models manage safety automatically, no configurable settings - Add 24h retention detail for conversation state - Explain model_json_schema() for JSON generation - Fix client.aio code - Make 'Upload an image file' self-contained - Fix incorrect media_resolution reference - Google Maps: 'around here' → 'around the Eiffel Tower in Paris' - Add YouTube processing explanation - Function calling: explain no auto-FC in Interactions API - Caching: automatic with Interactions API - Remove 'Run this cell to set everything up' cell - Move thought_signatures into thinking section - Move media_resolution after upload files Global fixes: - 'for an example' → 'for a walkthrough' in 39 notebooks * Deep Research: remove note, split cells; Get_started: add image URL approach Get_started_Deep_Research.ipynb: - Removed Interactions API note (model doesn't work with generateContent) - Split 'Collaborative planning' and 'Step 1' into separate cells - Split 'Tool configuration' and 'Restrict to Google Search only' into separate cells Get_started.ipynb: - Added image URL as first multimodal approach (simplest way) - Added transition text explaining base64 alternative * Get_started: simplify PDF to URL approach; Deep Research: fix indentation Get_started.ipynb: - Replace PDF upload example with direct URL approach (arxiv paper) - No need to download/upload PDFs, just pass the URL directly Get_started_Deep_Research.ipynb: - Fix prompt indentation for EV batteries research prompt * Get_started: add code execution header, migration section, media res per-file; GC: fix URL context Get_started.ipynb: - Add proper '## Code execution' section header before existing code - Add 'Migrating from Gemini 2.5' section before Next Steps - Update Media resolution with per-file details and default behavior - Update TOC with code execution and migration links - Fix .text shortcut (doesn't exist on ModelOutputStep) Get_started_Generate_Content.ipynb: - Fix URL context output: display(Markdown()) → Markdown() * Remove Not_yet_in_Interactions_API refs, update caching, fix stale links - Remove all references to Not_yet_in_Interactions_API.ipynb (won't be published) - Delete redirect cells in Caching.ipynb and Safety.ipynb - Remove Not_yet comments from File_Search, Grounding, Spatial_understanding, Video_understanding, Get_started_thinking - Get_started.ipynb: rewrite caching section with implicit caching explanation from docs, remove Caching.ipynb link - Counting_Tokens.ipynb: update Caching.ipynb links to docs URL - Get_started_Generate_Content.ipynb: fix URL context Markdown display * Batch_mode: fix model selector order (default first) * Add gemini-3-flash-preview to model selectors in Code_Execution and thinking_REST * Counting_Tokens: use URIs directly for inline content, keep File API downloads Simplified multimodal token counting: - Image inline: pass URL directly via types.Part(file_data=...) instead of downloading with curl and loading with PIL - Audio: still downloads for File API upload (required) - Removed unnecessary curl/PIL dependencies for inline examples * Code_Execution: use image URI directly, remove curl/base64 - Replace curl download + base64 encoding with direct image URI - Fix wrong mime_type (was image/jpeg for a PNG file) - Simplifies the notebook and avoids transient image processing errors * Fix Error_handling headings, Enum model selector, Embeddings TOC + .text bug Error_handling.ipynb: - Add '## Error handling strategies' before 'Automatic retries' so sections aren't grouped under 'Setup your API key' in Colab TOC Enum.ipynb: - Add gemini-3-flash-preview to model selector (was missing) Embeddings.ipynb: - Add anchor links to TOC entries - Add anchor tags to section headers - Fix last cell: final_answer.text → final_answer.steps[-1].content[0].text - Add gemini-3-flash-preview to the RAG model selector * Function_calling: major refactor for Interactions vs GC clarity; robotics-er: fix pip Function_calling.ipynb: - Clarify Auto FC is client.chats only (not interactions API) - Add prints to add/subtract/multiply/divide functions - Explain .to_json_dict() and its use with interactions API - Rewrite manual FC intro as THE way for interactions API - Update explanations: interactions uses previous_interaction_id, not chat sessions - Fix indentation in compositional FC code - Mark AUTO/ANY/NONE modes as generateContent features - Show GC code example for ANY mode with tool_config - Rewrite Next Steps for both APIs (fix weird GenerateContentConfig text) gemini-robotics-er.ipynb: - Remove interactions API comment from pip install (not using it) * Add gemini-3-flash-preview to all model selectors; create Not_yet guide; fix File_API Global: - Add gemini-3-flash-preview to model selector dropdown in 19 notebooks (was set as default but missing from the list) Not_yet_in_Interactions_API.ipynb (NEW): - Document features only available with generateContent: - Automatic Function Calling (chats only) - Function Calling Modes (AUTO/ANY/NONE via tool_config) - Safety Settings Configuration - Explicit Context Caching - Batch API - Include code examples for both APIs where applicable File_API.ipynb: - Update intro text: generateContent/streamGenerateContent → interactions API * Major batch: migrate TTS/Lyria/NanoBanana to interactions API, rewrite thinking Get_started_TTS.ipynb: - Migrate all generate_content → interactions.create - Update play_audio helper for interactions response structure - Fix blob extraction patterns Get_Started_Nano_Banana.ipynb: - Migrate all 22 generate_content → interactions.create - Update display_response helper for interactions steps - Fix grounding metadata extraction - Fix duplicate SDK install comment Get_started_Lyria.ipynb: - Migrate all generate_content → interactions.create - Update display_lyria_response for interactions steps - Replace 'Using Interactions API' section with GC reference - Remove redundant interaction demo cells Get_started_thinking.ipynb: - Remove Gemini 2.5/3 generation-specific language - thinking_budget → thinking_level everywhere - generate_content → interactions.create in code cells - Fix response patterns (candidates[0].content.parts → interaction.steps) - Merge Gemini 3 section into main flow - thinking_budget kept only in legacy migration section Other fixes: - Remove interactions API comments from pip installs in imagen, LearnLM, LiveAPI, LiveAPI_tools, LyriaRealTime (not using interactions API) - OpenAI Compat: revert SDK comment - Interactions API notebook: remove colab button, add colab icons to table * Fix grounding, models, delete Image_out Grounding.ipynb: - YouTube: use video type input instead of url_context - PDF by URL: show both methods (direct URI + url_context) - Image by URL: show both methods (direct URI + url_context) Get_started.ipynb: - YouTube: use video type input instead of url_context Not_yet_in_Interactions_API.ipynb: - Add Maps grounding sources section (widget + citations) - Update TOC Models.ipynb: - Populate outputs using external API key (50 models listed) Image_out.ipynb: - Deleted (unused) * JSON_mode: explain response_format, add Pydantic model_json_schema - Explain why response_format with mime_type application/json is needed (prevents markdown wrapping / explanatory text) - 'The newest models allow you' → 'Another option is to pass...' - Replace hand-written JSON Schema with Pydantic + .model_json_schema() - Add model_validate_json() example for type-safe validation - Keep TypedDict fallback for non-Pydantic users - Update Next Steps with links to streaming, tools, and JSON schema docs * PDF_Files, Safety, Prompting updates PDF_Files.ipynb: - Add 'Read a PDF by URL' section (pass URI directly, no upload needed) - Move Setup/Configure API key to level 3 headings - Fix generateContent reference in Learning more Safety.ipynb: - Convert to info-only stub (like Caching notebook) - Explain that Interactions API uses built-in safety - Keep safety categories table and generateContent example as reference - Link to archived version for runnable code Prompting.ipynb: - Move Setup/Configure API key to level 3 headings - Add image-by-URI example (pass URL directly) * Fix remaining thinking_budget→thinking_level, Lyria text Thinking: Replace 4 remaining thinking_budget usages with thinking_level - Cells 23,27: thinking_budget=0 → thinking_level='none' - Cells 54,58: thinking_budget=thinking_budget → thinking_level=thinking_level - Cell 64 (legacy section) intentionally kept Lyria: Fix cell 13 text referencing generate_content * Final cleanups: Webhooks, Video, Streaming, Spatial Webhooks: - Remove SDK 2.0 minimum version requirements Video_understanding: - Correct Gemini 2.0/2.5 references to just Gemini - Remove video iframe player at the top and keep standard links Streaming: - Separate response declaration from loops to improve indentation/readability - Clarify client.aio async usage and properties - Add What's Next section at the end Spatial_understanding: - Translate Japanese bento prompt back to English - Completely remove experimental Segmentation section (which is no longer supported) * Apply PR #16 feedback audit fixes Addressed feedback for multiple notebooks: - Get_started & Get_started_Generate_Content: Re-executed and populated outputs, fixed notebook format and Colab userdata fallback. - Counting_Tokens: Replaced downloads with direct URI passing in cells 30, 32. - Embeddings: Added missing TOC links. - Get_started_TTS: Changed !pip to %pip and removed SDK 2.0 comment. - Imagen/LearnLM/LyriaRealTime: Removed unnecessary >=2.0.0 pins. - Spatial_understanding: Removed segmentation mention in cell 13. - Code_Execution: Populated outputs, added cat.png asset for execution. - Video_understanding: Removed pip install comment. - Grounding: Updated TOC. * Added new notebook Basic_Code_Review to examples (#689) --------- Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> * Add Basic_Code_Review example to README (#1218) * Add Basic_Code_Review example to README * Update examples/prompting/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Added example for gemini api used to extract insights from github #923 #887 (#1150) * added example for gemini api used to extract insights from github --------- Co-authored-by: kkorpal <kkorpal@google.com> * Add example: EU AI Act compliance checking with Gemini function calling + Agent Module (#1167) * Add EU AI Act compliance example with Gemini function calling + Agent Module * style: use triple-quoted string per review feedback * fix: correct API schema + formatting per review - status["ethics"] -> status["ai_compliance"] (v0.9.21 schema rename; was the KeyError that blocked the reviewer run) - Remove unnecessary backslash line-continuations in the compliance_run prompt string; indent body; newline before closing """ - Replace static 22-row module table with dynamic discovery pointer (/api/status, /api/demo, /llms.txt) so the snapshot never goes stale - Branding: "ethics modules" -> "AI Compliance modules" in human-facing markdown; vertical slug documented as ai-compliance with ethics as legacy alias (both still accepted by the API) - Correct ETH_001 EU AI Act mapping (Art. 9 + 10, not 10 + 13) * fix: prevent trial key collision on reruns Follow-up to the schema/formatting fixes. Colab testing surfaced a runtime bug: the Agent Module API returns a masked preview of an existing trial key (e.g. `am_trial_841...f660`) if you request a new one while the old one is still active, and the original notebook wrapper blindly stored the preview — corrupting _trial_key and breaking every downstream retrieve_compliance_logic call. Changes: - Generate a unique per-run agent_id (uuid suffix) so reruns within 24 hours do not collide with a still-active trial on the server - Make get_trial_key idempotent (short-circuit if _trial_key already set in this session) so Gemini tool loops cannot re-trigger it - Detect status=="already_active" in the MCP response and refuse to store the masked preview; surface a clear error instead - Remove get_trial_key from the tools list passed to Gemini. Trial bootstrap is a setup step, not a runtime tool — the model should only see retrieve_compliance_logic and submit_proof_of_value - Reframe the cell 27 preamble to explain the setup/runtime split * fix: pass both token and trial_key to submit_pov MCP tool * fix: print full chat history so cell 30 shows the complete compliance report * chore: save executed notebook with cell outputs * fix: add Colab button + README link for CI compliance - Add Colab badge to notebook title cell (tfo-notebook-buttons CI check) - Add notebook entry to examples/README.md table (new-example-links CI check) * chore: retrigger CI checks * Fix notebook lint (inclusive_language) + nbfmt format - Rewords 'Agent-native' to 'Purpose-built for autonomous agents' in the branding cell to clear google::inclusive_language lint flag - Applies tensorflow_docs.tools.nbfmt formatting pass to clear Notebook format check - No other content changes; all 21 cell outputs preserved * Fix colab.name metadata + cell 30 prompt (third-person) to clear nbfmt + second_person checks --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * add gemini-3.5-flash (#1232) * New agent notebook (#1233) * Fixing typos * Adding links to the agents notebooks (#1234) * docs: fix typos and capitalization consistency in README (#1240) * docs: fix typos and capitalization consistency in README * docs: apply gemini suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Bump qs from 6.15.1 to 6.15.2 in /quickstarts/file-api (#1238) Bumps [qs](https://github.com/ljharb/qs) from 6.15.1 to 6.15.2. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.15.1...v6.15.2) --- updated-dependencies: - dependency-name: qs dependency-version: 6.15.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix scale= command in Lyria realtime quickstart (#1236) The scale= parser compared the raw prompt (which still contains the 'scale=' prefix) against enum names like A_FLAT_MAJOR_F_MINOR, so the match never succeeded and the command always printed 'Matching enum not found.' Strip the 'scale=' prefix before comparing, matching how the sibling bpm= and top_k= handlers already work. * update live api ws cookbook (#1223) * Interactions steps (#1237) * Merge origin/main into interaction-steps and resolve conflict * steps * Add environment support * work * cleanup * format * cleanup * Add back execution_count * Standardize Colab buttons and fix URLs across edited notebooks * feat: update visual model names to GA and add video-to-image example (#1244) * feat: update visual model names to GA and add video-to-image example - Updated gemini-3-pro-image-preview to gemini-3-pro-image (Nano Banana Pro GA) - Updated gemini-3.1-flash-image-preview to gemini-3.1-flash-image (Nano Banana 2 GA) - Added a new video-to-image example in Get_Started_Nano_Banana.ipynb - Formatted modified notebooks with nbfmt * feat(batch): add gemini-3.5-flash to model selector * style: format banana notebook to clean up PR diff * style: trim thought signature in Get_Started_Nano_Banana notebook To reduce file size and prevent git/diff hanging on massive cryptographically signed binary thoughts. * refactor: update Live API configuration, transcription support, and input handling for model version gemini-3.1-flash-live-preview (#1224) * Update Get_started_LiveAPI (#1222) * Update Get_started_LiveAPI * remove interactivity. * session resumption update. * run. * nbfmt * Resizing the NB notebook (#1245) * feat: add example for custom FPS in Grounding notebook (#1243) * feat: add example for custom FPS in Grounding notebook * Format custom frame rate explanation in Grounding.ipynb * Fix formatting of YouTube link and response generation * Fix formatting issues in Grounding.ipynb * Fix YouTube link formatting in Grounding.ipynb * docs: fix typographical and spelling errors in styleguide and quickstarts (#1253) * docs: fix typographical and spelling errors in styleguide.md * docs: fix typo in Image_out notebook header * fix: remove leftover google-generativeai imports from two notebooks (#1246) Two notebooks had leftover `import google.generativeai as genai` lines from a prior partial migration. Both notebooks otherwise use the new `google-genai` SDK correctly via `from google import genai`, and neither notebook's `%pip install` cell installs `google-generativeai`. On a clean Colab kernel the dead imports raise `ModuleNotFoundError`; on a kernel where the legacy package happens to be pre-installed, the dead imports silently shadow the working `genai` namespace. - quickstarts/Spatial_understanding.ipynb cell 19: delete the dead `import google.generativeai as genai` line; the rest of the cell (PIL.Image, io, os, requests, BytesIO) is genuinely used downstream - examples/Animated_Story_Video_Generation_gemini.ipynb cell 7: delete the cell entirely. The cell holds only the dead import No behavioural change beyond removing dead code that would otherwise fail or shadow at notebook runtime. * fix(examples): replace deprecated Live API session.send in Animated Story notebook (#1249) Use session.send_client_content(turns=..., turn_complete=True) instead of the deprecated session.send(input=..., end_of_turn=True), which emits a DeprecationWarning in google-genai (removal not before Q3 2025). Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct case-sensitive links to Search_Grounding/Code_Execution (#1248) Three cross-notebook links used lowercase filenames (Search_grounding.ipynb, Code_execution.ipynb) that 404 on case-sensitive file systems like GitHub. Point them at the actual files: Search_Grounding.ipynb and Code_Execution.ipynb. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct broken Contributing guide link in Template.ipynb (#1247) The template linked the contributing guide as `Contributing.mg`, which is both a typo (`.mg`) and a path that does not exist next to the notebook. Point it at the repo's CONTRIBUTING.md using the same absolute GitHub URL the notebook already uses elsewhere. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix: align error handling notebook with google-genai retries (#1229) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README (#1257) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README * Update quickstarts/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * feat: add Live Translation quickstart tutorial and examples (#1259) * feat: add Live Translation quickstart tutorial and examples * chore: clean up notebook metadata and reorder cell output attributes * refactor: Live Translation notebook and script from cookbook (#1261) * Prohibit yt-dlp usage for YouTube content (#1264) Added a restriction against using yt-dlp for downloading or streaming YouTube content due to terms of service violations. * Sketch2Paint using Gemini (#790) --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * Add service account auth section with IAM roles for Gemini, File, and… (#1258) * Add service account auth section with IAM roles for Gemini, File, and Vertex AI APIs * Remove service account section, add link to GCP auth docs instead * Add Vertex AI authentication documentation link * Fix embedding types & casing (#1032) * Fix embedding types & casing (fixes #1030) * Fix query task_type and indentation style violations * fix indentation style * fixed the formatting and linting issue * update model ID * fix formatting * Update styleguide with API key and crypto restrictions Added guidelines for API key usage and restrictions on crypto topics. * Manually updating the get started notebook * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Delete quickstarts/Not_yet_in_Interactions_API.ipynb * style, fix: format notebooks, update missing outputs, bump SDK versions, and align model selectors * fix: update Get_started_Lyria.ipynb to use lowercase response_modalities without config wrapper * docs: add type: text to response_format example in CONTRIBUTING.md * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update quickstarts/Enum.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: update Error_handling.ipynb to pass http_options on genai.Client instead of config wrapper * fix: mass update google-genai to >=2.9.0 and replace GOOGLE_API_KEY with GEMINI_API_KEY across repository * style: format all notebooks with nbfmt to comply with TensorFlow docs style --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Shipra <ships3040@gmail.com> Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Rohan Dwivedi <165134541+ROHANDWIVEDI2005@users.noreply.github.com> Co-authored-by: AgentModuleAdmin <0agentmodule@gmail.com> Co-authored-by: Patrick Loeber <50772274+patrickloeber@users.noreply.github.com> Co-authored-by: Irfaan Mansoori <irfaanmansoori100@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aryan Motgi <85900811+aryanmotgi@users.noreply.github.com> Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com> Co-authored-by: Mark Daoust <markdaoust@google.com> Co-authored-by: August Cayzer <august@cayzer.me> Co-authored-by: Sri Ujwal <113922053+sbeeredd04@users.noreply.github.com> Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> Co-authored-by: qianzhu / Lucien <2729478828@qq.com> Co-authored-by: Naveen Kumar G <naveen13524g@gmail.com> Co-authored-by: Nitin Tiwari <37960279+NSTiwari@users.noreply.github.com> Co-authored-by: Anika Islam <172253577+Surjasa@users.noreply.github.com> | 2 个月前 | |
Convert all quickstarts to the Interactions API (#1275) * Migrate quickstart notebooks to Interactions API (google-genai>=2.0.0) Migrate all quickstart notebooks from the legacy generate_content API to the new Interactions API using client.interactions.create(). Changes include: - All notebooks use google-genai>=2.0.0 and the Interactions API - Fix typos: thiking, inlcuding, EMBEDDIG, respose_mime_type, uniiformize, ouput - Fix Youtube -> YouTube across notebooks - Standardize !pip -> %pip for Colab best practices - Standardize 2-space -> 4-space Python indentation - Fix Audio.ipynb: complete incomplete transcript example - Fix Enum.ipynb: correct broken link to JSON_mode - Fix Error_handling.ipynb: clarify retry mechanism text - Fix Grounding.ipynb: title heading H2 -> H1 - Fix Video_understanding.ipynb: extra H1 -> H2 - Fix Get_started_OpenAI_Compatibility.ipynb: remove duplicate cells - Add Get_started_Generate_Content.ipynb (legacy API reference) - Delete New_in_002.ipynb (deprecated) - Run nbfmt formatting on all notebooks * Fix gemini-code-assist review comments - Video_understanding: move %%html magic before #@title (cell magics must be first line) - Grounding: restore @param Colab selector for MODEL_ID - Grounding: clear RateLimitError (429) output from cell - Asynchronous_requests: clear FileNotFoundError/ModuleNotFoundError/NameError outputs * Update CONTRIBUTING.md and styleguide with Interactions API guidelines - Add 'Interactions API' section explaining when to use client.interactions.create() - Document exceptions (Veo, Imagen, Lyria, LiveAPI, embeddings, TTS, batch, caching, File API) - Update SDK version from >=1.0.0 to >=2.0.0 - Update code examples from generate_content() to interactions.create() - Fix typo: 'uimport' -> 'import' in styleguide * Address gemini-code-assist review feedback (round 2) - Video_understanding: fix #@title/%%html order (#@title first for Colab forms) - Grounding: fix copy-paste prompt error (vegetable glycerin → Gemma chess) - Grounding: fix .: typo in 'Summarize this video.:' - Grounding: fix invalid \$ escape sequences → raw strings - Grounding: use .text shortcut for consistent response access - Batch_mode: fix GOOGLE_API_KEY → GEMINI_API_KEY in markdown text - Function_calling: add safe step.arguments None check - 29 notebooks: standardize pip install to use single quotes - Re-run nbfmt on all files * Fix GOOGLE_API_KEY, pip comments, model selectors, and remaining generate_content Global fixes across all notebooks: - GOOGLE_API_KEY → GEMINI_API_KEY in 18 notebooks (markdown + code) - Add '# 2.0 is needed to use the interactions API' comment to pip install lines - Remove gemini-2.5-flash-lite from all model selectors (3.1 is GA) - Add gemini-3-flash-preview to standard model selectors where missing Per-notebook fixes: - Authentication.ipynb: migrate generate_content → interactions.create - Embeddings.ipynb: migrate generate_content → interactions.create - Error_handling.ipynb: migrate generate_content → interactions.create - File_Search.ipynb: migrate generate_content → interactions.create - Get_started.ipynb: migrate generate_content → interactions.create - Get_started_thinking.ipynb: migrate generate_content → interactions.create (13 cells) - Grounding.ipynb: migrate generate_content → interactions.create (2 cells) Re-run nbfmt on all files * Audio notebook fixes + global: remove thinking remark, add Interactions API note Audio.ipynb fixes: - Remove outdated thinking model remark (all recent models think) - 'Use PyDub' → 'Use for example PyDub' + explain base64 encoding - Use Markdown display for transcript and timestamp sections - Add @param form magic to youtube_url for easy editing - Fix missing closing parenthesis in count tokens section Global fixes: - Remove thinking model remark from 13 other notebooks - Add Interactions API note to 4 notebooks that were missing it (Authentication, Embeddings, Deep_Research, Lyria) * Asynchronous_requests: display downloaded images before using them * Major Get_started.ipynb revision + global fixes Get_started.ipynb changes: - Remove overview sentence, expand TOC with all features - Point to Generate_Content notebook instead of archive branch - Fix pip comment: 'breaking changes' → 'GA/Stable release' - Show interaction.steps structure and .text shortcut - Show downloaded image in multimodal section - Remove image resize before base64 (unnecessary) - Remove duplicate blog post cell - Add image generation intro section - Rephrase safety: models manage safety automatically, no configurable settings - Add 24h retention detail for conversation state - Explain model_json_schema() for JSON generation - Fix client.aio code - Make 'Upload an image file' self-contained - Fix incorrect media_resolution reference - Google Maps: 'around here' → 'around the Eiffel Tower in Paris' - Add YouTube processing explanation - Function calling: explain no auto-FC in Interactions API - Caching: automatic with Interactions API - Remove 'Run this cell to set everything up' cell - Move thought_signatures into thinking section - Move media_resolution after upload files Global fixes: - 'for an example' → 'for a walkthrough' in 39 notebooks * Deep Research: remove note, split cells; Get_started: add image URL approach Get_started_Deep_Research.ipynb: - Removed Interactions API note (model doesn't work with generateContent) - Split 'Collaborative planning' and 'Step 1' into separate cells - Split 'Tool configuration' and 'Restrict to Google Search only' into separate cells Get_started.ipynb: - Added image URL as first multimodal approach (simplest way) - Added transition text explaining base64 alternative * Get_started: simplify PDF to URL approach; Deep Research: fix indentation Get_started.ipynb: - Replace PDF upload example with direct URL approach (arxiv paper) - No need to download/upload PDFs, just pass the URL directly Get_started_Deep_Research.ipynb: - Fix prompt indentation for EV batteries research prompt * Get_started: add code execution header, migration section, media res per-file; GC: fix URL context Get_started.ipynb: - Add proper '## Code execution' section header before existing code - Add 'Migrating from Gemini 2.5' section before Next Steps - Update Media resolution with per-file details and default behavior - Update TOC with code execution and migration links - Fix .text shortcut (doesn't exist on ModelOutputStep) Get_started_Generate_Content.ipynb: - Fix URL context output: display(Markdown()) → Markdown() * Remove Not_yet_in_Interactions_API refs, update caching, fix stale links - Remove all references to Not_yet_in_Interactions_API.ipynb (won't be published) - Delete redirect cells in Caching.ipynb and Safety.ipynb - Remove Not_yet comments from File_Search, Grounding, Spatial_understanding, Video_understanding, Get_started_thinking - Get_started.ipynb: rewrite caching section with implicit caching explanation from docs, remove Caching.ipynb link - Counting_Tokens.ipynb: update Caching.ipynb links to docs URL - Get_started_Generate_Content.ipynb: fix URL context Markdown display * Batch_mode: fix model selector order (default first) * Add gemini-3-flash-preview to model selectors in Code_Execution and thinking_REST * Counting_Tokens: use URIs directly for inline content, keep File API downloads Simplified multimodal token counting: - Image inline: pass URL directly via types.Part(file_data=...) instead of downloading with curl and loading with PIL - Audio: still downloads for File API upload (required) - Removed unnecessary curl/PIL dependencies for inline examples * Code_Execution: use image URI directly, remove curl/base64 - Replace curl download + base64 encoding with direct image URI - Fix wrong mime_type (was image/jpeg for a PNG file) - Simplifies the notebook and avoids transient image processing errors * Fix Error_handling headings, Enum model selector, Embeddings TOC + .text bug Error_handling.ipynb: - Add '## Error handling strategies' before 'Automatic retries' so sections aren't grouped under 'Setup your API key' in Colab TOC Enum.ipynb: - Add gemini-3-flash-preview to model selector (was missing) Embeddings.ipynb: - Add anchor links to TOC entries - Add anchor tags to section headers - Fix last cell: final_answer.text → final_answer.steps[-1].content[0].text - Add gemini-3-flash-preview to the RAG model selector * Function_calling: major refactor for Interactions vs GC clarity; robotics-er: fix pip Function_calling.ipynb: - Clarify Auto FC is client.chats only (not interactions API) - Add prints to add/subtract/multiply/divide functions - Explain .to_json_dict() and its use with interactions API - Rewrite manual FC intro as THE way for interactions API - Update explanations: interactions uses previous_interaction_id, not chat sessions - Fix indentation in compositional FC code - Mark AUTO/ANY/NONE modes as generateContent features - Show GC code example for ANY mode with tool_config - Rewrite Next Steps for both APIs (fix weird GenerateContentConfig text) gemini-robotics-er.ipynb: - Remove interactions API comment from pip install (not using it) * Add gemini-3-flash-preview to all model selectors; create Not_yet guide; fix File_API Global: - Add gemini-3-flash-preview to model selector dropdown in 19 notebooks (was set as default but missing from the list) Not_yet_in_Interactions_API.ipynb (NEW): - Document features only available with generateContent: - Automatic Function Calling (chats only) - Function Calling Modes (AUTO/ANY/NONE via tool_config) - Safety Settings Configuration - Explicit Context Caching - Batch API - Include code examples for both APIs where applicable File_API.ipynb: - Update intro text: generateContent/streamGenerateContent → interactions API * Major batch: migrate TTS/Lyria/NanoBanana to interactions API, rewrite thinking Get_started_TTS.ipynb: - Migrate all generate_content → interactions.create - Update play_audio helper for interactions response structure - Fix blob extraction patterns Get_Started_Nano_Banana.ipynb: - Migrate all 22 generate_content → interactions.create - Update display_response helper for interactions steps - Fix grounding metadata extraction - Fix duplicate SDK install comment Get_started_Lyria.ipynb: - Migrate all generate_content → interactions.create - Update display_lyria_response for interactions steps - Replace 'Using Interactions API' section with GC reference - Remove redundant interaction demo cells Get_started_thinking.ipynb: - Remove Gemini 2.5/3 generation-specific language - thinking_budget → thinking_level everywhere - generate_content → interactions.create in code cells - Fix response patterns (candidates[0].content.parts → interaction.steps) - Merge Gemini 3 section into main flow - thinking_budget kept only in legacy migration section Other fixes: - Remove interactions API comments from pip installs in imagen, LearnLM, LiveAPI, LiveAPI_tools, LyriaRealTime (not using interactions API) - OpenAI Compat: revert SDK comment - Interactions API notebook: remove colab button, add colab icons to table * Fix grounding, models, delete Image_out Grounding.ipynb: - YouTube: use video type input instead of url_context - PDF by URL: show both methods (direct URI + url_context) - Image by URL: show both methods (direct URI + url_context) Get_started.ipynb: - YouTube: use video type input instead of url_context Not_yet_in_Interactions_API.ipynb: - Add Maps grounding sources section (widget + citations) - Update TOC Models.ipynb: - Populate outputs using external API key (50 models listed) Image_out.ipynb: - Deleted (unused) * JSON_mode: explain response_format, add Pydantic model_json_schema - Explain why response_format with mime_type application/json is needed (prevents markdown wrapping / explanatory text) - 'The newest models allow you' → 'Another option is to pass...' - Replace hand-written JSON Schema with Pydantic + .model_json_schema() - Add model_validate_json() example for type-safe validation - Keep TypedDict fallback for non-Pydantic users - Update Next Steps with links to streaming, tools, and JSON schema docs * PDF_Files, Safety, Prompting updates PDF_Files.ipynb: - Add 'Read a PDF by URL' section (pass URI directly, no upload needed) - Move Setup/Configure API key to level 3 headings - Fix generateContent reference in Learning more Safety.ipynb: - Convert to info-only stub (like Caching notebook) - Explain that Interactions API uses built-in safety - Keep safety categories table and generateContent example as reference - Link to archived version for runnable code Prompting.ipynb: - Move Setup/Configure API key to level 3 headings - Add image-by-URI example (pass URL directly) * Fix remaining thinking_budget→thinking_level, Lyria text Thinking: Replace 4 remaining thinking_budget usages with thinking_level - Cells 23,27: thinking_budget=0 → thinking_level='none' - Cells 54,58: thinking_budget=thinking_budget → thinking_level=thinking_level - Cell 64 (legacy section) intentionally kept Lyria: Fix cell 13 text referencing generate_content * Final cleanups: Webhooks, Video, Streaming, Spatial Webhooks: - Remove SDK 2.0 minimum version requirements Video_understanding: - Correct Gemini 2.0/2.5 references to just Gemini - Remove video iframe player at the top and keep standard links Streaming: - Separate response declaration from loops to improve indentation/readability - Clarify client.aio async usage and properties - Add What's Next section at the end Spatial_understanding: - Translate Japanese bento prompt back to English - Completely remove experimental Segmentation section (which is no longer supported) * Apply PR #16 feedback audit fixes Addressed feedback for multiple notebooks: - Get_started & Get_started_Generate_Content: Re-executed and populated outputs, fixed notebook format and Colab userdata fallback. - Counting_Tokens: Replaced downloads with direct URI passing in cells 30, 32. - Embeddings: Added missing TOC links. - Get_started_TTS: Changed !pip to %pip and removed SDK 2.0 comment. - Imagen/LearnLM/LyriaRealTime: Removed unnecessary >=2.0.0 pins. - Spatial_understanding: Removed segmentation mention in cell 13. - Code_Execution: Populated outputs, added cat.png asset for execution. - Video_understanding: Removed pip install comment. - Grounding: Updated TOC. * Added new notebook Basic_Code_Review to examples (#689) --------- Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> * Add Basic_Code_Review example to README (#1218) * Add Basic_Code_Review example to README * Update examples/prompting/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Added example for gemini api used to extract insights from github #923 #887 (#1150) * added example for gemini api used to extract insights from github --------- Co-authored-by: kkorpal <kkorpal@google.com> * Add example: EU AI Act compliance checking with Gemini function calling + Agent Module (#1167) * Add EU AI Act compliance example with Gemini function calling + Agent Module * style: use triple-quoted string per review feedback * fix: correct API schema + formatting per review - status["ethics"] -> status["ai_compliance"] (v0.9.21 schema rename; was the KeyError that blocked the reviewer run) - Remove unnecessary backslash line-continuations in the compliance_run prompt string; indent body; newline before closing """ - Replace static 22-row module table with dynamic discovery pointer (/api/status, /api/demo, /llms.txt) so the snapshot never goes stale - Branding: "ethics modules" -> "AI Compliance modules" in human-facing markdown; vertical slug documented as ai-compliance with ethics as legacy alias (both still accepted by the API) - Correct ETH_001 EU AI Act mapping (Art. 9 + 10, not 10 + 13) * fix: prevent trial key collision on reruns Follow-up to the schema/formatting fixes. Colab testing surfaced a runtime bug: the Agent Module API returns a masked preview of an existing trial key (e.g. `am_trial_841...f660`) if you request a new one while the old one is still active, and the original notebook wrapper blindly stored the preview — corrupting _trial_key and breaking every downstream retrieve_compliance_logic call. Changes: - Generate a unique per-run agent_id (uuid suffix) so reruns within 24 hours do not collide with a still-active trial on the server - Make get_trial_key idempotent (short-circuit if _trial_key already set in this session) so Gemini tool loops cannot re-trigger it - Detect status=="already_active" in the MCP response and refuse to store the masked preview; surface a clear error instead - Remove get_trial_key from the tools list passed to Gemini. Trial bootstrap is a setup step, not a runtime tool — the model should only see retrieve_compliance_logic and submit_proof_of_value - Reframe the cell 27 preamble to explain the setup/runtime split * fix: pass both token and trial_key to submit_pov MCP tool * fix: print full chat history so cell 30 shows the complete compliance report * chore: save executed notebook with cell outputs * fix: add Colab button + README link for CI compliance - Add Colab badge to notebook title cell (tfo-notebook-buttons CI check) - Add notebook entry to examples/README.md table (new-example-links CI check) * chore: retrigger CI checks * Fix notebook lint (inclusive_language) + nbfmt format - Rewords 'Agent-native' to 'Purpose-built for autonomous agents' in the branding cell to clear google::inclusive_language lint flag - Applies tensorflow_docs.tools.nbfmt formatting pass to clear Notebook format check - No other content changes; all 21 cell outputs preserved * Fix colab.name metadata + cell 30 prompt (third-person) to clear nbfmt + second_person checks --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * add gemini-3.5-flash (#1232) * New agent notebook (#1233) * Fixing typos * Adding links to the agents notebooks (#1234) * docs: fix typos and capitalization consistency in README (#1240) * docs: fix typos and capitalization consistency in README * docs: apply gemini suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Bump qs from 6.15.1 to 6.15.2 in /quickstarts/file-api (#1238) Bumps [qs](https://github.com/ljharb/qs) from 6.15.1 to 6.15.2. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.15.1...v6.15.2) --- updated-dependencies: - dependency-name: qs dependency-version: 6.15.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix scale= command in Lyria realtime quickstart (#1236) The scale= parser compared the raw prompt (which still contains the 'scale=' prefix) against enum names like A_FLAT_MAJOR_F_MINOR, so the match never succeeded and the command always printed 'Matching enum not found.' Strip the 'scale=' prefix before comparing, matching how the sibling bpm= and top_k= handlers already work. * update live api ws cookbook (#1223) * Interactions steps (#1237) * Merge origin/main into interaction-steps and resolve conflict * steps * Add environment support * work * cleanup * format * cleanup * Add back execution_count * Standardize Colab buttons and fix URLs across edited notebooks * feat: update visual model names to GA and add video-to-image example (#1244) * feat: update visual model names to GA and add video-to-image example - Updated gemini-3-pro-image-preview to gemini-3-pro-image (Nano Banana Pro GA) - Updated gemini-3.1-flash-image-preview to gemini-3.1-flash-image (Nano Banana 2 GA) - Added a new video-to-image example in Get_Started_Nano_Banana.ipynb - Formatted modified notebooks with nbfmt * feat(batch): add gemini-3.5-flash to model selector * style: format banana notebook to clean up PR diff * style: trim thought signature in Get_Started_Nano_Banana notebook To reduce file size and prevent git/diff hanging on massive cryptographically signed binary thoughts. * refactor: update Live API configuration, transcription support, and input handling for model version gemini-3.1-flash-live-preview (#1224) * Update Get_started_LiveAPI (#1222) * Update Get_started_LiveAPI * remove interactivity. * session resumption update. * run. * nbfmt * Resizing the NB notebook (#1245) * feat: add example for custom FPS in Grounding notebook (#1243) * feat: add example for custom FPS in Grounding notebook * Format custom frame rate explanation in Grounding.ipynb * Fix formatting of YouTube link and response generation * Fix formatting issues in Grounding.ipynb * Fix YouTube link formatting in Grounding.ipynb * docs: fix typographical and spelling errors in styleguide and quickstarts (#1253) * docs: fix typographical and spelling errors in styleguide.md * docs: fix typo in Image_out notebook header * fix: remove leftover google-generativeai imports from two notebooks (#1246) Two notebooks had leftover `import google.generativeai as genai` lines from a prior partial migration. Both notebooks otherwise use the new `google-genai` SDK correctly via `from google import genai`, and neither notebook's `%pip install` cell installs `google-generativeai`. On a clean Colab kernel the dead imports raise `ModuleNotFoundError`; on a kernel where the legacy package happens to be pre-installed, the dead imports silently shadow the working `genai` namespace. - quickstarts/Spatial_understanding.ipynb cell 19: delete the dead `import google.generativeai as genai` line; the rest of the cell (PIL.Image, io, os, requests, BytesIO) is genuinely used downstream - examples/Animated_Story_Video_Generation_gemini.ipynb cell 7: delete the cell entirely. The cell holds only the dead import No behavioural change beyond removing dead code that would otherwise fail or shadow at notebook runtime. * fix(examples): replace deprecated Live API session.send in Animated Story notebook (#1249) Use session.send_client_content(turns=..., turn_complete=True) instead of the deprecated session.send(input=..., end_of_turn=True), which emits a DeprecationWarning in google-genai (removal not before Q3 2025). Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct case-sensitive links to Search_Grounding/Code_Execution (#1248) Three cross-notebook links used lowercase filenames (Search_grounding.ipynb, Code_execution.ipynb) that 404 on case-sensitive file systems like GitHub. Point them at the actual files: Search_Grounding.ipynb and Code_Execution.ipynb. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix(quickstarts): correct broken Contributing guide link in Template.ipynb (#1247) The template linked the contributing guide as `Contributing.mg`, which is both a typo (`.mg`) and a path that does not exist next to the notebook. Point it at the repo's CONTRIBUTING.md using the same absolute GitHub URL the notebook already uses elsewhere. Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> * fix: align error handling notebook with google-genai retries (#1229) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README (#1257) * docs: fix broken/incomplete links and remove duplicate entry in quickstarts README * Update quickstarts/README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * feat: add Live Translation quickstart tutorial and examples (#1259) * feat: add Live Translation quickstart tutorial and examples * chore: clean up notebook metadata and reorder cell output attributes * refactor: Live Translation notebook and script from cookbook (#1261) * Prohibit yt-dlp usage for YouTube content (#1264) Added a restriction against using yt-dlp for downloading or streaming YouTube content due to terms of service violations. * Sketch2Paint using Gemini (#790) --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> * Add service account auth section with IAM roles for Gemini, File, and… (#1258) * Add service account auth section with IAM roles for Gemini, File, and Vertex AI APIs * Remove service account section, add link to GCP auth docs instead * Add Vertex AI authentication documentation link * Fix embedding types & casing (#1032) * Fix embedding types & casing (fixes #1030) * Fix query task_type and indentation style violations * fix indentation style * fixed the formatting and linting issue * update model ID * fix formatting * Update styleguide with API key and crypto restrictions Added guidelines for API key usage and restrictions on crypto topics. * Manually updating the get started notebook * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Delete quickstarts/Not_yet_in_Interactions_API.ipynb * style, fix: format notebooks, update missing outputs, bump SDK versions, and align model selectors * fix: update Get_started_Lyria.ipynb to use lowercase response_modalities without config wrapper * docs: add type: text to response_format example in CONTRIBUTING.md * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update quickstarts/Enum.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/GitHub_issue_analyzer.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update examples/Agent_Module_EU_AI_Act_Compliance.ipynb Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: update Error_handling.ipynb to pass http_options on genai.Client instead of config wrapper * fix: mass update google-genai to >=2.9.0 and replace GOOGLE_API_KEY with GEMINI_API_KEY across repository * style: format all notebooks with nbfmt to comply with TensorFlow docs style --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Shipra <ships3040@gmail.com> Co-authored-by: kkorpal <kkorpal@google.com> Co-authored-by: Shipra <Shi-pra-19@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Rohan Dwivedi <165134541+ROHANDWIVEDI2005@users.noreply.github.com> Co-authored-by: AgentModuleAdmin <0agentmodule@gmail.com> Co-authored-by: Patrick Loeber <50772274+patrickloeber@users.noreply.github.com> Co-authored-by: Irfaan Mansoori <irfaanmansoori100@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aryan Motgi <85900811+aryanmotgi@users.noreply.github.com> Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com> Co-authored-by: Mark Daoust <markdaoust@google.com> Co-authored-by: August Cayzer <august@cayzer.me> Co-authored-by: Sri Ujwal <113922053+sbeeredd04@users.noreply.github.com> Co-authored-by: Sri Ujwal <sbeeredd04@users.noreply.github.com> Co-authored-by: qianzhu / Lucien <2729478828@qq.com> Co-authored-by: Naveen Kumar G <naveen13524g@gmail.com> Co-authored-by: Nitin Tiwari <37960279+NSTiwari@users.noreply.github.com> Co-authored-by: Anika Islam <172253577+Surjasa@users.noreply.github.com> | 2 个月前 | |
Add redirect to the other Colab for gemini-robotics-er.ipynb (#1306) * Add redirect to the other Colab for gemini-robotics-er.ipynb * Fix lint * Simplify notebook redirect JSON * Update redirect notebook to remove badge * Add valid Colab badge back to satisfy CI linter rules * Update Colab link in gemini-robotics-er.ipynb --------- Co-authored-by: Guillaume Vernade <Giom-V@users.noreply.github.com> | 1 个月前 |
Gemini API Tutorials
This folder contains guides to help you explore all Gemini API features using complete end-to-end code examples.
When you're confident in your Gemini capabilities, the examples folder will be an endless source of inspiration on how to mix those capabilities together.
Gemini 3.7 Flash: Stronger performance on complex agentic and multimodal tasks while reducing token usage. Get started with the Get Started
and the thinking
guides.
Omni Flash: The Nano Banana of video editing is here! Lean how to call the model using the interactions API, edit videos with natural language and more here
!
🍌 Nano-Banana 2 Lite: Go bananas with our latest and fastest image generation model: Nano-Banana 2 Lite. Get started here
with a ton of examples!
Agents API: Create and run your custom agents using the new Antigravity agent
!
Table of contents
If you're new to Gemini API, you should start with these two guides:
| Quickstart | Description | Open |
|---|---|---|
| Authentication | Start here to learn how you can set up your API key so you can get access to the Gemini API. | |
| Get Started | Learn how to make your first calls to the Gemini API and get a quick overview of everything it can do. | |
Then learn about how to Get Started with the other models that you can use with the API:
| Quickstart | Description | Open |
|---|---|---|
| Managed agents | Create and run agents on isolated VM from the Gemini API | |
| Lyria 3 | Convert your ideas into songs with full control over the music structure and more!. | |
| Nano-Banana 2 & Pro aka. Gemini Image | Get to know how the Gemini model can directly output images and edit them through multi-turn discussion. Now featuring Gemini 3.7 Flash! | |
| Omni Flash | Get started with high-speed video generation and conversational editing using Gemini Omni Flash and the Interactions API. | |
| Veo | Get started with video generation using the Veo models. | |
| Imagen | Get started with our image generation model. | |
| Imagen (REST) | Get started with our image generation model (REST version). | |
| Thinking models | The thinking models are, as their names imply, capable of deeper chains of thoughts than the classical models, this guide will show you how to use those thinking capabilities to solve complex problems. | |
| Lyria RealTime | The Lyria RealTime model let's your generate music and prompt the model in real-time to have it mis it for you live. | |
| Text-to-speech | The TTS models let you generate speeches with one or even two speakers! | |
There're multiple ways to call the models using the Gemini API, these other Get Started guides will then show you the other ways to call the model:
| Quickstart | Description | Open |
|---|---|---|
| Get started with Live API | Get started with the live API with this comprehensive overview of its capabilities | |
| Get started with Live Translation | Translate audio streams in real-time using the Live Translation API | |
| OpenAI compatibility | Did you know that you could use Gemini using the OpenAI SDK? | |
Finally, these guides will deep-dive into specific capabilities of the Gemini models and API:
| Quickstart | Description | Open |
|---|---|---|
| Grounding | Learn how to use diffrent ways (Google Search, Google Maps, Youtube, url context) to ground your answers with external sources. | |
| File Search | Upload and search your data using the hosted RAG capability of the File Search tool. | |
| Search Grounding | Deep-dive into the Google search grounding capabilities. | |
| Gemini Robotics-ER 1.5 Preview | Learn how to use the Gemini Robotics Embodied Reasoning model for spatial understanding and reasoning | |
| Batch-mode | Use Batch-mode to send large volume of non-time-sensitive requests to the model and get a 50% discount. | |
| Inference tiers | Learn how to use the different inference tiers to help you balance speed, cost, and reliability. | |
| Webhooks | Configure webhooks to receive real-time notifications when asynchronous operations like batch jobs and video generation complete. | |
| Function Calling | Discover how to have Gemini call you own function and enhaced its capabilites. | |
| Spatial understanding | Learn how to use Gemini's spatial understanding capabilities to detect what's in your images, and reason about them | |
| Video understanding | Learn how to use Gemini's video understanding capabilities to analyze what's in your videos | |
| Get started with Live API tools | Now you know everything about the Live API, go to the next level and learn how to use tools with it! | |
These guides will walk you through the various use cases of the Gemini API:
| Quickstart | Description | Open |
|---|---|---|
| Asynchronous requests | Learn how to use Python's async/await API with the Gemini SDK to parallelize calls. | |
| Counting Tokens | Tokens are the basic inputs to the Gemini models. Learn how to count tokens in your text and multimodal prompts. | |
| Models | Learn about the different models and parameters available in the Gemini API. | |
| Working with files | Use the Gemini API to upload files (audio, video, images, code, text) and perform actions with them through the Gemini models. | |
| Audio | Learn how to use the Gemini API with audio files. | |
| JSON mode | Discover how to use JSON mode. | |
| PDF files | Learn how to work with PDF files, and upload text and images. | |
| System Instructions | Give models additional context on how to respond by setting system instructions. | |
| Streaming | Learn how to use streaming for single interactions, and for chat. | |
| Embeddings | Create high-quality and task-specific embeddings. | |
| AI Tutors with LearnLM | Demonstrates how to craft AI tutoring experiences using system instructions aligned with learning science principles. |