New code for Vertex embeddings prevents the ChatModel to be instantiated due to missing configuration for embeddings, even if the code does not leverage embeddings. https://docs.spring.io/spring-ai/reference/api/embeddings/vertexai-embeddings-text.html
Sample code: simple repro https://github.com/GoogleCloudPlatform/serverless-production-readiness-java-gcp/tree/main/ai-patterns/spring-ai-quotes
Can be bypassed for now by adding the embedding started to the pom.xml and embedding project and location to the application properties. please see the image below
Thank you
Comment From: tzolov
@ddobrin not sure i understand what is the problem.
If yo add the spring-ai-vertex-ai-embedding-spring-boot-starter
dependency to the POM you're expected to configure the necessary properties spring.ai.vertex.ai.embedding.project-id
and spring.ai.vertex.ai.embedding.location
.
Btw, same applies when adding the Gemini boot starter (e.g. spring-ai-vertex-ai-gemini-spring-boot-starter
) dependency to the POM.
If you miss to set the spring.ai.vertex.ai.gemini.projectId
and spring.ai.vertex.ai.gemini.location
properties the auto-configuration will fail.
New code for Vertex embeddings prevents the ChatModel to be instantiated due to missing configuration for embeddings, even if the code does not leverage embeddings. If the code doesn't leverage embeddings then you should remove the
spring-ai-vertex-ai-embedding-spring-boot-starter
dependency?
I've created a new project only with spring-ai-vertex-ai-gemini-spring-boot-starter dependency and it works fine.
Comment From: ddobrin
Thank you for looking into it. I should be more specific.
The small sample, built for quick validation purposes, started failing during a rebuild, when it picked a new Spring AI snapshot.
The code does not use embeddings, just a spring-ai-vertex-ai-gemini-spring-boot-starter
.
If the spring-ai-vertex-ai-embedding-spring-boot-starter
starter is added, with the corresponding project-id and location, the execution succeeds.
Captured the error:
Comment From: tzolov
@ddobrin thank you for reporting this. Indeed was a bug in our VertexAI Embedding auto-configuration. It is fixed by 7e98fb78b77dc14a2e2ee2018230b9ab2e1ce5a6.
Comment From: arvind-ojha1
Hi @tzolov I am using spring ai 1.0.0-M5 BOM and adding implementation 'org.springframework.ai:spring-ai-vertex-ai-embedding-spring-boot-starter' dependency is autoconfiguring the embedding model but while creating the embedding for a text it throws error the below error
io.grpc.StatusRuntimeException: UNKNOWN: Missing :te header at io.grpc.Status.asRuntimeException(Status.java:532) ~[grpc-api-1.68.0.jar:1.68.0]