Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

markmcd
Copy link
Member

@markmcd markmcd commented Nov 10, 2023

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

  • I have performed a self-review of my code.
  • I have added detailed comments to my code where applicable.
  • I have verified that my change does not break existing code.
  • My PR is based on the latest changes of the main branch (if unsure, please run git pull --rebase upstream main).
  • I am familiar with the Google Style Guide for the language I have coded in.
  • I have read through the Contributing Guide and signed the Contributor License Agreement.

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.
@markmcd markmcd requested a review from a team as a code owner November 10, 2023 09:03
@github-actions github-actions bot added the status:awaiting review PR awaiting review from a maintainer label Nov 10, 2023
"""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
Copy link
Contributor

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?

Copy link
Member

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
Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:awaiting review PR awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants