Skip to content

Commit 431b3a3

Browse files
committed
Address unfixed API change
1 parent cef42ef commit 431b3a3

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/GroundingController.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
import com.sap.ai.sdk.grounding.model.DocumentKeyValueListPair;
2020
import com.sap.ai.sdk.grounding.model.DocumentWithoutChunks;
2121
import com.sap.ai.sdk.grounding.model.EmbeddingConfig;
22+
import com.sap.ai.sdk.grounding.model.GetPipeline;
2223
import com.sap.ai.sdk.grounding.model.KeyValueListPair;
24+
import com.sap.ai.sdk.grounding.model.MSSharePointPipelineGetResponse;
2325
import com.sap.ai.sdk.grounding.model.RetrievalSearchFilter;
2426
import com.sap.ai.sdk.grounding.model.RetrievalSearchInput;
27+
import com.sap.ai.sdk.grounding.model.S3PipelineGetResponse;
28+
import com.sap.ai.sdk.grounding.model.SFTPPipelineGetResponse;
2529
import com.sap.ai.sdk.grounding.model.SearchConfiguration;
2630
import com.sap.ai.sdk.grounding.model.TextOnlyBaseChunk;
2731
import com.sap.cloud.sdk.services.openapi.core.OpenApiResponse;
@@ -63,8 +67,15 @@ Object getAllPipelines(
6367
if ("json".equals(format)) {
6468
return pipelines;
6569
}
66-
final var ids = List.of();
67-
// pipelines.getResources().stream().map(getPipeline::getId).collect(joining(", "));
70+
final var ids = new ArrayList<>();
71+
for (GetPipeline resource : pipelines.getResources()) {
72+
switch (resource.getType().toString()) {
73+
case "MSSharePoint" -> ids.add(((MSSharePointPipelineGetResponse) resource).getId());
74+
case "S3" -> ids.add(((S3PipelineGetResponse) resource).getId());
75+
case "SFTP" -> ids.add(((SFTPPipelineGetResponse) resource).getId());
76+
default -> log.warn("Unknown pipeline type: {}", resource.getType());
77+
}
78+
}
6879
return "Found pipelines with ids: " + ids;
6980
}
7081

0 commit comments

Comments
 (0)