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

feat (provider/google-vertex): Add support for edge runtime. #3908

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

shaper
Copy link
Contributor

@shaper shaper commented Nov 27, 2024

No description provided.

orca-security-us[bot]

This comment was marked as outdated.

Copy link

socket-security bot commented Nov 27, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] Transitive: environment, filesystem, network +20 1.94 MB google-wombot

🚮 Removed packages: npm/@google-cloud/[email protected]

View full report↗︎

@shaper shaper requested a review from lgrammel November 27, 2024 00:14
@shaper shaper marked this pull request as ready for review November 27, 2024 00:14
@@ -40,6 +40,7 @@ Optional. A list of unique safety settings for blocking unsafe content.
*/
safetySettings?: Array<{
category:
| 'HARM_CATEGORY_UNSPECIFIED'
Copy link
Collaborator

Choose a reason for hiding this comment

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

are these harm categories the same in vertex & genai? i vaguely remember differences.

Copy link
Contributor Author

@shaper shaper Nov 30, 2024

Choose a reason for hiding this comment

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

The only difference I see is for the older PaLM models. Here is my understanding:

GenAI Harm Categories
Vertex Harm Categories

The PaLM entries in the GenAI link are missing:

HARM_CATEGORY_DEROGATORY | PaLM - Negative or harmful comments targeting identity and/or protected attribute.
HARM_CATEGORY_TOXICITY | PaLM - Content that is rude, disrespectful, or profane.
HARM_CATEGORY_VIOLENCE | PaLM - Describes scenarios depicting violence against an individual or group, or general descriptions of gore.
HARM_CATEGORY_SEXUAL | PaLM - Contains references to sexual acts or other lewd content.
HARM_CATEGORY_MEDICAL | PaLM - Promotes unchecked medical advice.
HARM_CATEGORY_DANGEROUS | PaLM - Dangerous content that promotes, facilitates, or encourages harmful acts.

I assume these have been updated over time. Based on the current specs linked above, my take is that this PR is newly updated to reflect the latest, and the only consideration is whether to add the PaLM entries:

  • we were missing the HARM_CATEGORY_UNSPECIFIED in GenAI but they are relevant there
  • we were missing HARM_CATEGORY_CIVIC_INTEGRITY in both GenAI and Vertex, and it's relevant in both
  • we were missing the PaLM entries above in both. GenAI spec has the PaLM entries and Vertex doesn't
  • https://ai.google.dev/palm_docs notes "Warning: The PaLM API is decomissioned. The Vertex AI PaLM API is scheduled to be decomissioned in October 2024. Please upgrade to the Gemini API. Learn more about this in the PaLM API deprecation guide."

It is not clear to me that the PaLM models are a forward-going concern, so I would personally omit them for now.

@lgrammel
Copy link
Collaborator

Needs docs update (showing how to use different auth solutions) and changeset (works on edge now).

- vertex: peer deps for google, google-auth-library
- vertex: don't export experimental auth token fns
- vertex: no need for "module" export for './internal'
- vertex: revise edge-compatible auth (buffer, file creds)
- vertex: provider incorporates user option for generateAuthToken
- vertex: update export symbol for edge-compatible auth token generation fn
- google: 'content' in response schema optional for safety failure parsing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants