Skip to content

Commit 0a2ce03

Browse files
committed
Format, Syntax, checks
1 parent f9b8ab0 commit 0a2ce03

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

grounding/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.sap.ai.sdk</groupId>
66
<artifactId>sdk-parent</artifactId>
7-
<version>1.3.0-SNAPSHOT</version>
7+
<version>1.4.0-SNAPSHOT</version>
88
</parent>
99
<artifactId>grounding</artifactId>
1010
<name>Grounding client</name>

sample-code/spring-app/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@
6565
<groupId>com.sap.cloud.sdk.cloudplatform</groupId>
6666
<artifactId>cloudplatform-core</artifactId>
6767
</dependency>
68+
<dependency>
69+
<groupId>com.sap.cloud.sdk.datamodel</groupId>
70+
<artifactId>openapi-core</artifactId>
71+
</dependency>
6872
<dependency>
6973
<groupId>org.springframework.ai</groupId>
7074
<artifactId>spring-ai-core</artifactId>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Object getAllRepositories(
9292
*
9393
* <p>Only UNKNOWN and STOPPED deployments can be DELETED
9494
*/
95-
@GetMapping("/retrieval/repositories")
95+
@GetMapping("/retrieval/search")
9696
Object searchInDocuments(
9797
@Nullable @RequestParam(value = "format", required = false) final String format) {
9898
final var filter =
@@ -191,10 +191,10 @@ Object deleteDocuments(
191191
final var ids = documents.getResources().stream().map(DocumentWithoutChunks::getId).toList();
192192
log.info("Deleting collection {} with {} documents: {}", collectionId, ids.size(), ids);
193193

194-
for (UUID documentId : ids) {
194+
for (final var documentId : ids) {
195195
final var del = CLIENT_VECTOR.deleteDocumentById(RESOURCE_GROUP, collectionId, documentId);
196196
if (del.getStatusCode() >= 400) {
197-
final var msg = "Document {} could not be deleted, status code [{}], headers: ";
197+
final var msg = "Document {} could not be deleted, status code [{}], headers: {}";
198198
log.error(msg, documentId, del.getStatusCode(), del.getHeaders());
199199
throw new IllegalStateException("Document deletion failed for id " + documentId);
200200
}

sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/GroundingTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void getRepositoriesGetAll() {
4747
final var repositoryCount = ((DataRepositories) result).getCount();
4848

4949
assertThat(repositoryCount).isGreaterThan(0);
50-
for (var repository : repositoryList) {
50+
for (final var repository : repositoryList) {
5151
assertThat(repository.getId()).isNotNull();
5252
assertThat(repository.getTitle()).isNotNull();
5353
}
@@ -98,14 +98,14 @@ void testCreateDeleteCollection() {
9898

9999
private void assertDocumentSearchResult(RetievalSearchResults search, String dayOfWeek) {
100100
assertThat(search.getResults()).isNotEmpty();
101-
for (var resultsByFilter : search.getResults()) {
101+
for (final var resultsByFilter : search.getResults()) {
102102
assertThat(resultsByFilter.getFilterId()).isEqualTo("question");
103103
assertThat(resultsByFilter.getResults()).isNotEmpty();
104-
for (var result : resultsByFilter.getResults()) {
104+
for (final var result : resultsByFilter.getResults()) {
105105
assertThat(result.getDataRepository().getDocuments()).isNotEmpty();
106-
for (var document : result.getDataRepository().getDocuments()) {
106+
for (final var document : result.getDataRepository().getDocuments()) {
107107
assertThat(document.getChunks()).isNotEmpty();
108-
for (var chunk : document.getChunks()) {
108+
for (final var chunk : document.getChunks()) {
109109
assertThat(chunk.getContent()).contains(dayOfWeek);
110110
}
111111
}
@@ -122,7 +122,7 @@ void testCollectionsGetAll() {
122122
final var collectionsCount = ((CollectionsListResponse) result).getCount();
123123

124124
assertThat(collectionsCount).isGreaterThan(0);
125-
for (var collection : collectionsList) {
125+
for (final var collection : collectionsList) {
126126
assertThat(collection.getId()).isNotNull();
127127
assertThat(collection.getTitle()).isNotEmpty();
128128
assertThat(collection.getEmbeddingConfig()).isNotNull();
@@ -138,7 +138,7 @@ void testGetDocumentById(UUID collectionId, UUID documentId) {
138138
final var chunks = ((DocumentResponse) result).getChunks();
139139

140140
assertThat(chunks).isNotEmpty();
141-
for (var chunk : chunks) {
141+
for (final var chunk : chunks) {
142142
assertThat(chunk.getContent()).isNotEmpty();
143143
assertThat(chunk.getMetadata()).isNotNull().isNotEmpty();
144144
}

0 commit comments

Comments
 (0)