|
|
@@ -2,6 +2,7 @@ package com.zsjz.ai.module.agent.rag;
|
|
|
|
|
|
import com.zsjz.ai.module.embedding.service.EmbeddingService;
|
|
|
import io.agentscope.core.embedding.EmbeddingModel;
|
|
|
+import io.agentscope.core.embedding.EmbeddingResponse;
|
|
|
import io.agentscope.core.message.TextBlock;
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
import org.junit.jupiter.api.DisplayName;
|
|
|
@@ -62,7 +63,7 @@ class EmbeddingProviderTest {
|
|
|
void localDisabledUsesOnlineModel() {
|
|
|
when(localEmbeddingService.isEnabled()).thenReturn(false);
|
|
|
EmbeddingModel onlineModel = mock(EmbeddingModel.class);
|
|
|
- when(onlineModel.embed(any(TextBlock.class))).thenReturn(Mono.just(new double[]{0.3, 0.4}));
|
|
|
+ when(onlineModel.embed(any(TextBlock.class))).thenReturn(Mono.just(EmbeddingResponse.builder().embedding(new double[]{0.3, 0.4}).build()));
|
|
|
when(embeddingModelFactory.resolveDefault())
|
|
|
.thenReturn(new EmbeddingModelFactory.EmbeddingSpec(1L, "qwen-embed", onlineModel, 2));
|
|
|
|
|
|
@@ -106,7 +107,7 @@ class EmbeddingProviderTest {
|
|
|
void onlineDimensionMismatchFails() {
|
|
|
when(localEmbeddingService.isEnabled()).thenReturn(false);
|
|
|
EmbeddingModel onlineModel = mock(EmbeddingModel.class);
|
|
|
- when(onlineModel.embed(any(TextBlock.class))).thenReturn(Mono.just(new double[]{0.3, 0.4}));
|
|
|
+ when(onlineModel.embed(any(TextBlock.class))).thenReturn(Mono.just(EmbeddingResponse.builder().embedding(new double[]{0.3, 0.4}).build()));
|
|
|
when(embeddingModelFactory.resolveDefault())
|
|
|
.thenReturn(new EmbeddingModelFactory.EmbeddingSpec(1L, "qwen-embed", onlineModel, 4));
|
|
|
|