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

Discussion: Keep API interface consistent #3

Closed
doggy8088 opened this issue Mar 21, 2024 · 3 comments
Closed

Discussion: Keep API interface consistent #3

doggy8088 opened this issue Mar 21, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@doggy8088
Copy link
Contributor

There are two types of Google Cloud Generative AI:

  1. Google AI Gemini API

    // Google AI with an API key
    var model = new GenerativeModel(apiKey: "your API key", model: Model.GeminiPro);
  2. Vertex AI Gemini API

    // Vertex AI with OAuth. Use `gcloud auth application-default print-access-token` to get the access token.
    var vertex = new VertexAI(projectId: projectId, region: region);
    var model = vertex.GenerativeModel(model: Model.Gemini10Pro);

What if we keep these two APIs consistent?

For example,

  1. Google AI Gemini API

    // Google AI with an API key
    var googleai = new GoogleAI(apiKey: "your API key");
    var model = googleai.GenerativeModel(model: Model.Gemini10Pro);
  2. Vertex AI Gemini API

    // Vertex AI with OAuth. Use `gcloud auth application-default print-access-token` to get the access token.
    var vertexai = new VertexAI(projectId: projectId, region: region);
    var model = vertexai.GenerativeModel(model: Model.Gemini10Pro);
@jochenkirstaetter
Copy link
Contributor

jochenkirstaetter commented Mar 21, 2024

Hi @doggy8088 ,

Thanks for the suggestion. That would be similar to the genai object available in the other SDKs. I didn't consider the abstraction of the Google AI. However, it can make sense to add this extra layer.

One of the issues I'm facing at the moment, is that "administrative" methods like ListModels, GetModel are at the wrong location. This might also be relevant for CreateTunedModel.

Also, take into consideration that GenerativeModel can work autonomously to detect the targetted API based on environmental constraints, like using .env and envVars.

using Mscc.GenerativeAI;
var model = new GenerativeModel();

As described in the README: Using Environment variables

Again, thanks for the suggestion. This is helpful to clear my own thoughts.

jochenkirstaetter added a commit that referenced this issue Mar 21, 2024
@jochenkirstaetter
Copy link
Contributor

Hi @doggy8088

I added this request to version 0.8.4.
See commit: 16403ce

I hope that it's more consistent now.
Eventually, I have to make further changes regarding Google AI using OAuth / ADC authentication. Currently, there is a null check of ApiKey in the method.

@jochenkirstaetter jochenkirstaetter added the enhancement New feature or request label Mar 21, 2024
@doggy8088
Copy link
Contributor Author

Just a reminder that the README.md should be updated as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants