fix: define model literal and add types prefix in URL Context example#36
Closed
xiaolai wants to merge 1 commit intogoogle-gemini:mainfrom
Closed
fix: define model literal and add types prefix in URL Context example#36xiaolai wants to merge 1 commit intogoogle-gemini:mainfrom
xiaolai wants to merge 1 commit intogoogle-gemini:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates a Python code example in the documentation for Vertex AI. Specifically, it replaces a generic model variable with a specific model ID ('gemini-3-flash-preview') and corrects the reference to 'GenerateContentConfig' by adding the 'types' prefix. I have no feedback to provide.
Contributor
Author
|
@googlebot I signed it! |
The Url Context code sample in `references/structured_and_tools.md` referenced an undefined `model_id` variable and used a bare `GenerateContentConfig(...)` call. Reproducing the snippet raises `NameError: name 'model_id' is not defined`, and even after defining that variable a `NameError` on `GenerateContentConfig` follows because the file only imports it as `types.GenerateContentConfig`. Aligns this code block with the four other examples in the same file (Structured Output, Function Calling, Search Grounding, Code Execution), all of which use `model="gemini-3-flash-preview"` and `types.GenerateContentConfig(...)`.
b58e438 to
944243b
Compare
Member
|
No longer needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Url Context code sample in
skills/vertex-ai-api-dev/references/structured_and_tools.md(the block under## Url Context) has two issues that prevent it from running as written:model=model_id—model_idis never defined in the snippet (every other code block in the same file uses a literal model string). Copy-pasting this example raisesNameError: name 'model_id' is not defined.config=GenerateContentConfig(...)— the file imports the SDK asfrom google.genai import types, so the constructor must be qualified astypes.GenerateContentConfig(...). The four sibling examples in the same file (Structured Output, Function Calling, Search Grounding, Code Execution) all use the qualified form.The fix matches the rest of the file:
The other code blocks in the same file already use
gemini-3-flash-preview, so it's the conservative pick for consistency.