diff --git a/models/spring-ai-zhipuai/src/main/java/org/springframework/ai/zhipuai/api/ZhiPuAiApi.java b/models/spring-ai-zhipuai/src/main/java/org/springframework/ai/zhipuai/api/ZhiPuAiApi.java index d6d92d0eed..3db31df222 100644 --- a/models/spring-ai-zhipuai/src/main/java/org/springframework/ai/zhipuai/api/ZhiPuAiApi.java +++ b/models/spring-ai-zhipuai/src/main/java/org/springframework/ai/zhipuai/api/ZhiPuAiApi.java @@ -299,7 +299,11 @@ public enum EmbeddingModel { /** * DIMENSION: 1024 */ - Embedding_2("Embedding-2"); + Embedding_2("Embedding-2"), + /** + * DIMENSION: 2048 + */ + Embedding_3("Embedding-3"); public final String value; diff --git a/models/spring-ai-zhipuai/src/test/java/org/springframework/ai/zhipuai/embedding/EmbeddingIT.java b/models/spring-ai-zhipuai/src/test/java/org/springframework/ai/zhipuai/embedding/EmbeddingIT.java index 447546d60d..c5a902b6d7 100644 --- a/models/spring-ai-zhipuai/src/test/java/org/springframework/ai/zhipuai/embedding/EmbeddingIT.java +++ b/models/spring-ai-zhipuai/src/test/java/org/springframework/ai/zhipuai/embedding/EmbeddingIT.java @@ -21,9 +21,12 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; +import org.springframework.ai.embedding.EmbeddingRequest; import org.springframework.ai.embedding.EmbeddingResponse; import org.springframework.ai.zhipuai.ZhiPuAiEmbeddingModel; +import org.springframework.ai.zhipuai.ZhiPuAiEmbeddingOptions; import org.springframework.ai.zhipuai.ZhiPuAiTestConfiguration; +import org.springframework.ai.zhipuai.api.ZhiPuAiApi; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -53,6 +56,25 @@ void defaultEmbedding() { assertThat(this.embeddingModel.dimensions()).isEqualTo(1024); } + @Test + void embedding3() { + assertThat(this.embeddingModel).isNotNull(); + + var options = ZhiPuAiEmbeddingOptions.builder() + .withModel(ZhiPuAiApi.EmbeddingModel.Embedding_3.getValue()) + .build(); + + EmbeddingRequest embeddingRequest = new EmbeddingRequest(List.of("Here comes the sun"), options); + EmbeddingResponse embeddingResponse = this.embeddingModel.call(embeddingRequest); + + assertThat(embeddingResponse.getResults()).hasSize(1); + + assertThat(embeddingResponse.getResults().get(0)).isNotNull(); + assertThat(embeddingResponse.getResults().get(0).getOutput()).hasSize(2048); + + // assertThat(this.embeddingModel.dimensions()).isEqualTo(2048); + } + @Test void batchEmbedding() { assertThat(this.embeddingModel).isNotNull();