-
Notifications
You must be signed in to change notification settings - Fork 462
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
Adds a PermissionService sample for Python #170
base: main
Are you sure you want to change the base?
Conversation
This is pretty basic, but I find myself coming back to it, especially for sharing tuned models with service accounts. Adding it to the repo in case it's helpful for others too.
"""Sample functions illustrating how to share models using the permission service.""" | ||
import google.generativeai as palm | ||
import google.ai.generativelanguage as glm | ||
from google.ai.generativelanguage_v1beta3 import types |
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.
Is this still correct with the latest SDK updates?
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.
This shouldn't be necessary. the current default (v1beta
) is a superset of this old one so glm
is all you need.
"""Sample functions illustrating how to share models using the permission service.""" | ||
import google.generativeai as palm | ||
import google.ai.generativelanguage as glm | ||
from google.ai.generativelanguage_v1beta3 import types |
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.
This shouldn't be necessary. the current default (v1beta
) is a superset of this old one so glm
is all you need.
new_user = "my-service@my-project.iam.gserviceaccount.com" | ||
perm = types.Permission( | ||
grantee_type=types.Permission.GranteeType.USER, | ||
role=types.Permission.Role.READER, |
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.
These are available on glm.Permission
https://ai.google.dev/api/python/google/ai/generativelanguage/Permission
This is pretty basic, but I find myself coming back to it, especially for sharing tuned models with service accounts. Adding it to the repo in case it's helpful for others too.
Type of change
Choose one: Other
Checklist
git pull --rebase upstream main
).