Closed LindaLawton closed 2 months ago
Thanks for the report Linda.
The default is grpc
, and I see you're not in Colab, so this has nothing to do with Colab's default being transport='rest'
.
I'm working on a replication, but I didn't have a tuned model and my tuning job is at the back of the queue for now.
Hmmm....
genai.configure(api_key=os.getenv("API_KEY"))
genai.configure(transport='grpc')
I'm not sure about most of these steps, but it's possible that:
gcloud auth application-default ...
), from when you tuned the model.api_key=
overrides the application-default-credentials..configure
doesn't edit the configuration. It replaces the configuration.
.configure(transport='grpc')
throws out the api-key, and puts you on the application-default credentials. .configure()
or configure(transport='rest')
might have the same effect.While I wait for tuning to wake up could you confirm any of those other points?
Let me know if you want my tuning sample its basically the one from the docs though. Note im just testing so just use the sample tuned data.
PS: didnt know you could do checkboxes in Git markdown. #cool
I think this all fits my interpretation of what's going wrong here.
GOOGLE_APPLICATION_CREDENTIALS set in the .env var.
That sets the ADC as the default credentials.
Why would setting apikey overwrite application default credentials
Because the API can't take both the ADC and an API key at the same time. It has to choose one or the other.
and why would it work again adding grpc?
ADC works for Tuned Models, API key doesn't.
When you call genai.configure(api_key="...")
it stores configuration= {'api_key': ...}
.
When you call genai.configure(transport="grpc")
it stores configuration={'transport': 'grpc'}
, and forgets the api_key
.
It doesn't have anything to do with actually switching between rest and grpc, just clearing the api-key from the config:
Steps to reproduce: https://colab.research.google.com/drive/1C8nKL6cKjrwGom_Ye3ssB2iqw7gQyB4T?usp=sharing
Marking this issue as stale since it has been open for 14 days with no activity. This issue will be closed if no further activity occurs.
This issue was closed because it has been inactive for 28 days. Please post a new issue if you need further assistance. Thanks!
Description of the bug:
When Accessing a tuned model i need to configure grcp.
Why is this needed
Actual vs expected behavior:
I am really just curious its more of a question then a bug.
full error stacktrace
Any other information you'd like to share?
My full sample