-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add custom Vertex AI Model Garden example #2868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
docs/models/google.md
Outdated
) | ||
provider = GoogleProvider(client=client) | ||
model = GoogleModel( | ||
f'projects/{project}/locations/{location}/publishers/meta/models/llama-3.3-70b-instruct-maas', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would just publishers/meta/models/llama-3.3-70b-instruct-maas
work as the project and location have already been configured?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. All these patterns should work:
f`{model_id}`,
f`publishers/{publisher}/models/{model_id}`,
f`projects/{project}/locations/{location}/publishers/{publisher}/models/{model_id}`
which is aligned with:
https://googleapis.github.io/python-genai/genai.html#genai.models.AsyncModels.generate_content_stream
Should I use the partial resource name publishers/meta/models/llama-3.3-70b-instruct-maas
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stefannae Yeah, let's use the simplest option that doesn't require additional variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DouweM okay, made the change
This PR is stale, and will be closed in 3 days if no reply is received. |
Co-authored-by: Douwe Maan <[email protected]>
docs/models/google.md
Outdated
project='your-gcp-project-id', | ||
location='us-central1', # the region where the model is available | ||
) | ||
model = GoogleModel('llama-3.3-70b-instruct-maas', provider=provider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From googleapis.github.io/python-genai/genai.html#genai.models.AsyncModels.generate_content_stream, it seems like this should be meta/llama-3.3-70b-instruct-maas
, so we should fix it here and specify {publisher}/{model_id}
in the docs above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this 4th way of specifying the model. Still, the simplest way, according to the same docs (and tested - I've tested them all), is llama-3.3-70b-instruct-maas
.
Should we keep llama-3.3-70b-instruct-maas
in the example and add {publisher}/{model_id}
to the list of patterns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stefannae Hmm, the docs make it sound like excluding the publisher only works with Gemini models, so even though you've verified it works with llama as well, I'd prefer to document and use only {publisher}/{model_id}
, or say "{model_id}
for Gemini models" like the docs do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DouweM, they have a formatting issue with the docs, which visually reads better from the docstring https://github.com/googleapis/python-genai/blob/538c755e84777e6b76d5152aac18268e4d0c99c6/google/genai/models.py#L6377-L6401
This way, seems Gemini is only used as an example:
For the `model` parameter, supported formats for Vertex AI API include:
- The Gemini model ID, for example: 'gemini-2.0-flash'
- The full resource name starts with 'projects/', for example:
'projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash'
- The partial resource name with 'publishers/', for example:
'publishers/google/models/gemini-2.0-flash' or
- `/` separated publisher and model name, for example:
'google/gemini-2.0-flash'
For the `model` parameter, supported formats for Gemini API include:
- The Gemini model ID, for example: 'gemini-2.0-flash'
- The model name starts with 'models/', for example:
'models/gemini-2.0-flash'
- For tuned models, the model name starts with 'tunedModels/',
for example:
'tunedModels/1234567890123456789'
Though given how the endpoints are defined in Vertex AI, it is probably better to switch to {publisher}/{model_id}
in the example. Let me know your preference, and I'll make the change.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stefannae Yeah let's do that, I'm interpreting "Gemini model ID" as "this only works for Gemini models"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DouweM ok, pushed the update!
@stefannae Thanks Stefan, should merge shortly! |
This PR adds an example of how to use models besides Gemini from the Vertex AI Model Garden.