Skip to content

expose the listModels call #104

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

Closed
wants to merge 1 commit into from
Closed

expose the listModels call #104

wants to merge 1 commit into from

Conversation

devoncarew
Copy link
Collaborator

This exposes model.listModels as a static method on GenerativeModel. The user needs to explicitly pass the api Key to this static method (instead of passing it into the GenerativeModel ctor as for the other calls).

I expose ApiClient? apiClient as a param as well for testability; this does make for a kludgy method sig (w/ params String apiKey, int? pageSize, String? pageToken, http.Client? httpClient, and ApiClient? apiClient).

@devoncarew devoncarew requested a review from natebosch March 25, 2024 21:23
@natebosch
Copy link
Collaborator

I'll start a discussion thread about this - it's not present in the other SDKs I checked and I'm not sure if this is a discrepancy we'd be worried about.

@devoncarew
Copy link
Collaborator Author

I'll start a discussion thread about this - it's not present in the other SDKs I checked and I'm not sure if this is a discrepancy we'd be worried about.

sgtm; note that this is documented in the REST protocol. And the motivating real for this use case is that multiple times I've gotten error messages back from the server - 'models/xxx is not found for API version v1, or is not supported for GenerateContent. Call ListModels to see the list of available models and their supported methods'; its definitely a bit of a semantic mis-match to give that error to the user but to provide no way for them to list the models / call the indicated method.

@devoncarew
Copy link
Collaborator Author

It looks like it's exposed by the python SDK:

https://ai.google.dev/api/python/google/generativeai/list_models

@devoncarew
Copy link
Collaborator Author

Dropping this PR as I believe the python (and REST) SDKs are intended to fully expose the APIs - including for admin functions - and the other language SDKs are intended to be more client SDKs. Happy to re-open if we think this is worth exposing.

@devoncarew devoncarew closed this Apr 1, 2024
@devoncarew devoncarew deleted the expose_listModels branch May 1, 2024 20:00
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.

consider exposing the ListModels API call
2 participants