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

Undesirable API inconsistencies Google AI vs. Vertex AI #50

Open
fredsa opened this issue Feb 21, 2024 · 5 comments
Open

Undesirable API inconsistencies Google AI vs. Vertex AI #50

fredsa opened this issue Feb 21, 2024 · 5 comments
Assignees
Labels
status:triaged Issue/PR triaged to the corresponding sub-team type:feature request New feature request or enhancement

Comments

@fredsa
Copy link
Contributor

fredsa commented Feb 21, 2024

Human authored Google AI and Vertex AI packages should use identical APIs for the same functionality.

Where the two APIs currently different, we should:

  1. Agree on the preferred API
  2. Apply changes to make the APIs consistent
    • Where possible, add a new API & deprecate the old API (to be deleted at a later date in a newer version)
    • If not possible, do consider a breaking changes in order to get both packages into a good state for the
      long-term, to the benefit of all future developers that be exposed to both

Context

Compare these two human-authored packages:

EXEPCTED

  • Google AI and Vertex AI packages share identical API signatures for the same functionality. This ensures developer can easily convert or migrate between the two offerings without unnecessary friction.
  • Differences that exist in minor underlying API differences between auto-generated "Generative Language API"(generativelanguage.googleapis.com) and "Vertex AI API" (aiplatform.googleapis.com) implementations should not result unnecessary differences in the human-authored packages.

ACTUAL

Two package are different:

  1. BlockReason vs. BlockedReason

    https://pkg.go.dev/github.com/google/generative-ai-go/genai

    type BlockReason
        func (v BlockReason) String() string
    type BlockedError
        func (e *BlockedError) Error() string
    

    https://pkg.go.dev/cloud.google.com/go/vertexai/genai

    type BlockedError
        func (e *BlockedError) Error() string
    type BlockedReason
        func (v BlockedReason) String() string
    
  2. SetTopK inconsistent type: int32 vs. float32

    https://pkg.go.dev/github.com/google/generative-ai-go/genai

    func (c *GenerationConfig) SetTopK(x int32)
    

    https://pkg.go.dev/cloud.google.com/go/vertexai/genai

    func (c *GenerationConfig) SetTopK(x float32)
    
  3. CitationSource vs. Citation, with field and field type differences

    type CitationSource struct {
        StartIndex *[int32](https://pkg.go.dev/builtin#int32)
        EndIndex *[int32](https://pkg.go.dev/builtin#int32)
        URI *[string](https://pkg.go.dev/builtin#string)
        License [string](https://pkg.go.dev/builtin#string)
    }
    
    type Citation struct {
        StartIndex [int32](https://pkg.go.dev/builtin#int32)
        EndIndex [int32](https://pkg.go.dev/builtin#int32)
        URI [string](https://pkg.go.dev/builtin#string)
        Title [string](https://pkg.go.dev/builtin#string)
        License [string](https://pkg.go.dev/builtin#string)
        PublicationDate [civil](https://pkg.go.dev/cloud.google.com/go/civil).[Date](https://pkg.go.dev/cloud.google.com/go/civil#Date)
    }
    
@eliben
Copy link
Member

eliben commented Feb 21, 2024

It seems like these come from the underlying RPC/GAPIC surfaces and we copy them with protoveneer.
@jba we could configure protoveneer to modify the output to have consistency, since the underlying protos are unlikely to change at this point. We're still in version 0.x and these are all relatively minor, so we could just change them, perhaps also keeping an alias around for a release or two in deprecated mode. WDYT?

@jba
Copy link
Collaborator

jba commented Feb 21, 2024 via email

@jba
Copy link
Collaborator

jba commented Feb 22, 2024 via email

@eliben eliben added the type:feature request New feature request or enhancement label Feb 27, 2024
@singhniraj08 singhniraj08 added the status:triaged Issue/PR triaged to the corresponding sub-team label Mar 19, 2024
@wjkoh
Copy link

wjkoh commented Jun 17, 2024

Sorry for piggybacking on this thread. I was wondering what the difference is between generative-ai-go and vertexai. Are there any guidelines for when to use each one?

@eliben
Copy link
Member

eliben commented Jun 23, 2024

@wjkoh see https://ai.google.dev/gemini-api/docs/migrate-to-cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:triaged Issue/PR triaged to the corresponding sub-team type:feature request New feature request or enhancement
Projects
None yet
Development

No branches or pull requests

6 participants