I’m working on a Spring Boot project where I need to implement embeddings using the Spring AI framework. I found an online reference that uses org.springframework.ai.embedding.EmbeddingClient
, but when I try to import this class, I get the following error:
The import org.springframework.ai.embedding.EmbeddingClient cannot be resolved
I’m currently using spring-ai version 1.0.0-M1
. Is this class removed or deprecated in this version? If so, what is the recommended way to implement embeddings with Spring AI and OpenAI in this version?
Here is my pom.xml configuration for the Spring AI dependency:
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-milvus-store-spring-boot-starter</artifactId>
</dependency>
And here is the relevant part of my code:
import org.springframework.ai.embedding.EmbeddingClient;
public class EmbeddingService {
private EmbeddingClient embeddingClient;
public EmbeddingService(EmbeddingClient embeddingClient) {
this.embeddingClient = embeddingClient;
}
public void generateEmbedding(String input) {
// Implementation here
}
}
Any guidance on how to resolve this issue or alternative approaches to using embeddings with Spring AI and OpenAI would be greatly appreciated.
Thank you in advance for your help!