Open johanhaleby opened 2 months ago
Dear All,
I am not able to invoke the vertex ai embedding model from spring ai , I am getting permission denied issue ... knowing that i am having the proper privileges into my service account , how can i invoke the embedding model ... Thanks in advance
Just to confirm, @account123456789, @johanhaleby, have you created the service account key file, downloaded it and set the GOOGLE_APPLICATION_CREDENTIALS account file to the location of the file, as ADC is looking first for that before other locations link
@ddobrin Even if that works I don't want to do this. I'd like my application to be able to load the service account key file from classpath or something like Google Cloud Secret Manager.
@johanhaleby - The prev comment "... GOOGLE_APPLICATION_CREDENTIALS account file to the location of the file..." should have been "... GOOGLE_APPLICATION_CREDENTIALS environment variable to the location of the file..."
If I understand correctly, you are looking for usage in a local solution
With #1739 merged, you can configure the builder as follows:
VertexAiEmbeddingConnectionDetails.builder()
.withProjectId(projectId)
.withLocation(region)
.withApiEndpoint(endpoint)
.withPredictionServiceSettings(
PredictionServiceSettings.newBuilder()
.setEndpoint(endpoint)
.setCredentialsProvider(FixedCredentialsProvider.create(credentials))
.build());
Where credentials
is an instance of a GoogleCredentials
object (this can be loaded from a service account json)
In 1.0.0-M2, the documentation for vertexai says to do this as part of the prerequisites:
However, it would be really useful to be able to specify credentials by other means, for example using a GCP service account. The vertex AI google cloud SDK supports this by passing an instance of
com.google.auth.Credentials
tocom.google.api.gax.rpc.ClientContext
used inPredictionServiceSettings. Builder
. But inorg.springframework.ai.vertexai.embedding.VertexAiEmbeddigConnectionDetails
thepredictionServiceSettings
is hardcoded to:making it very difficult to use a service account with spring ai.