Skip to content

Commit c0919c3

Browse files
committed
fix: test class - embeddingRequest has two params, but only one result return
Signed-off-by: eeaters <[email protected]>
1 parent 54c889a commit c0919c3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

models/spring-ai-zhipuai/src/test/java/org/springframework/ai/zhipuai/api/ZhiPuAiRetryTests.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ public void zhiPuAiChatStreamNonTransientError() {
159159
public void zhiPuAiEmbeddingTransientError() {
160160

161161
EmbeddingList<Embedding> expectedEmbeddings = new EmbeddingList<>("list",
162-
List.of(new Embedding(0, new float[] { 9.9f, 8.8f })), "model", new ZhiPuAiApi.Usage(10, 10, 10));
162+
List.of(new Embedding(0, new float[] { 9.9f, 8.8f }), new Embedding(0, new float[] { 9.9f, 8.8f })),
163+
"model", new ZhiPuAiApi.Usage(10, 10, 10));
163164

164165
given(this.zhiPuAiApi.embeddings(isA(EmbeddingRequest.class)))
165166
.willThrow(new TransientAiException("Transient Error 1"))
@@ -169,9 +170,11 @@ public void zhiPuAiEmbeddingTransientError() {
169170
var result = this.embeddingModel
170171
.call(new org.springframework.ai.embedding.EmbeddingRequest(List.of("text1", "text2"), options));
171172

173+
assertThat(result.getResults().size()).isEqualTo(2);
172174
assertThat(result).isNotNull();
175+
// choose the first result
173176
assertThat(result.getResult().getOutput()).isEqualTo(new float[] { 9.9f, 8.8f });
174-
assertThat(this.retryListener.onSuccessRetryCount).isEqualTo(0);
177+
assertThat(this.retryListener.onSuccessRetryCount).isEqualTo(2);
175178
assertThat(this.retryListener.onErrorRetryCount).isEqualTo(2);
176179
}
177180

0 commit comments

Comments
 (0)