Skip to content

Commit 0a9d57a

Browse files
bot-sdk-jsMatKuhr
andauthored
feat: [DevOps] Update Orchestration to 2502a (#325)
* Update orchestration based on v0.53.1 * Update tests and add release Note --------- Co-authored-by: Matthias Kuhr <[email protected]>
1 parent 3b3dc57 commit 0a9d57a

File tree

11 files changed

+87
-47
lines changed

11 files changed

+87
-47
lines changed

docs/release-notes/release_notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
### ✨ New Functionality
1414

15+
- Upgrade to release 2502a of AI Core.
1516
- [Add Orchestration `LlamaGuardFilter`](../guides/ORCHESTRATION_CHAT_COMPLETION.md#chat-completion-filter).
1617

1718
### 📈 Improvements

orchestration/src/main/java/com/sap/ai/sdk/orchestration/Grounding.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public class Grounding implements GroundingProvider {
2828

2929
@Nonnull
3030
private List<GroundingModuleConfigConfigFiltersInner> filters =
31-
List.of(
32-
DocumentGroundingFilter.create().id("").dataRepositoryType(DataRepositoryType.VECTOR));
31+
List.of(DocumentGroundingFilter.create().dataRepositoryType(DataRepositoryType.VECTOR));
3332

3433
@Setter(onMethod_ = {@Nonnull})
3534
private TypeEnum documentGroundingService = TypeEnum.DOCUMENT_GROUNDING_SERVICE;

orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DataRepositoryType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import com.fasterxml.jackson.annotation.JsonValue;
1616
import javax.annotation.Nonnull;
1717

18-
/** Gets or Sets DataRepositoryType */
18+
/** Only include DataRepositories with the given type. */
1919
public enum DataRepositoryType {
2020
VECTOR("vector"),
2121

@@ -59,6 +59,6 @@ public static DataRepositoryType fromValue(@Nonnull final String value) {
5959
return b;
6060
}
6161
}
62-
return null;
62+
return UNKNOWN_DEFAULT_OPEN_API;
6363
}
6464
}

orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/DocumentGroundingFilter.java

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class DocumentGroundingFilter implements GroundingModuleConfigConfigFilte
3333
// CHECKSTYLE:ON
3434
{
3535
@JsonProperty("id")
36-
private Object id = null;
36+
private String id;
3737

3838
@JsonProperty("search_config")
3939
private GroundingFilterSearchConfiguration searchConfig;
@@ -66,7 +66,7 @@ protected DocumentGroundingFilter() {}
6666
* @return The same instance of this {@link DocumentGroundingFilter} class
6767
*/
6868
@Nonnull
69-
public DocumentGroundingFilter id(@Nullable final Object id) {
69+
public DocumentGroundingFilter id(@Nullable final String id) {
7070
this.id = id;
7171
return this;
7272
}
@@ -76,8 +76,8 @@ public DocumentGroundingFilter id(@Nullable final Object id) {
7676
*
7777
* @return id The id of this {@link DocumentGroundingFilter} instance.
7878
*/
79-
@Nullable
80-
public Object getId() {
79+
@Nonnull
80+
public String getId() {
8181
return id;
8282
}
8383

@@ -86,7 +86,7 @@ public Object getId() {
8686
*
8787
* @param id Identifier of this SearchFilter - unique per request.
8888
*/
89-
public void setId(@Nullable final Object id) {
89+
public void setId(@Nullable final String id) {
9090
this.id = id;
9191
}
9292

@@ -183,7 +183,7 @@ public void setDataRepositories(@Nullable final List<String> dataRepositories) {
183183
*/
184184
@Nonnull
185185
public DocumentGroundingFilter dataRepositoryType(
186-
@Nullable final DataRepositoryType dataRepositoryType) {
186+
@Nonnull final DataRepositoryType dataRepositoryType) {
187187
this.dataRepositoryType = dataRepositoryType;
188188
return this;
189189
}
@@ -194,7 +194,7 @@ public DocumentGroundingFilter dataRepositoryType(
194194
* @return dataRepositoryType The dataRepositoryType of this {@link DocumentGroundingFilter}
195195
* instance.
196196
*/
197-
@Nullable
197+
@Nonnull
198198
public DataRepositoryType getDataRepositoryType() {
199199
return dataRepositoryType;
200200
}
@@ -204,7 +204,7 @@ public DataRepositoryType getDataRepositoryType() {
204204
*
205205
* @param dataRepositoryType The dataRepositoryType of this {@link DocumentGroundingFilter}
206206
*/
207-
public void setDataRepositoryType(@Nullable final DataRepositoryType dataRepositoryType) {
207+
public void setDataRepositoryType(@Nonnull final DataRepositoryType dataRepositoryType) {
208208
this.dataRepositoryType = dataRepositoryType;
209209
}
210210

@@ -473,31 +473,19 @@ private String toIndentedString(final java.lang.Object o) {
473473
* DocumentGroundingFilter} instance with all required arguments.
474474
*/
475475
public static Builder create() {
476-
return (id) ->
477-
(dataRepositoryType) ->
478-
new DocumentGroundingFilter().id(id).dataRepositoryType(dataRepositoryType);
476+
return (dataRepositoryType) ->
477+
new DocumentGroundingFilter().dataRepositoryType(dataRepositoryType);
479478
}
480479

481480
/** Builder helper class. */
482481
public interface Builder {
483-
/**
484-
* Set the id of this {@link DocumentGroundingFilter} instance.
485-
*
486-
* @param id Identifier of this SearchFilter - unique per request.
487-
* @return The DocumentGroundingFilter builder.
488-
*/
489-
Builder1 id(@Nullable final Object id);
490-
}
491-
492-
/** Builder helper class. */
493-
public interface Builder1 {
494482
/**
495483
* Set the dataRepositoryType of this {@link DocumentGroundingFilter} instance.
496484
*
497485
* @param dataRepositoryType The dataRepositoryType of this {@link DocumentGroundingFilter}
498486
* @return The DocumentGroundingFilter instance.
499487
*/
500488
DocumentGroundingFilter dataRepositoryType(
501-
@Nullable final DataRepositoryType dataRepositoryType);
489+
@Nonnull final DataRepositoryType dataRepositoryType);
502490
}
503491
}

orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/GroundingModuleConfigConfig.java

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public class GroundingModuleConfigConfig
4141
@JsonProperty("output_param")
4242
private String outputParam;
4343

44+
@JsonProperty("metadata_params")
45+
private List<String> metadataParams = new ArrayList<>();
46+
4447
@JsonAnySetter @JsonAnyGetter
4548
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
4649

@@ -175,6 +178,54 @@ public void setOutputParam(@Nonnull final String outputParam) {
175178
this.outputParam = outputParam;
176179
}
177180

181+
/**
182+
* Set the metadataParams of this {@link GroundingModuleConfigConfig} instance and return the same
183+
* instance.
184+
*
185+
* @param metadataParams Parameter name used for specifying metadata parameters
186+
* @return The same instance of this {@link GroundingModuleConfigConfig} class
187+
*/
188+
@Nonnull
189+
public GroundingModuleConfigConfig metadataParams(@Nullable final List<String> metadataParams) {
190+
this.metadataParams = metadataParams;
191+
return this;
192+
}
193+
194+
/**
195+
* Add one metadataParams instance to this {@link GroundingModuleConfigConfig}.
196+
*
197+
* @param metadataParamsItem The metadataParams that should be added
198+
* @return The same instance of type {@link GroundingModuleConfigConfig}
199+
*/
200+
@Nonnull
201+
public GroundingModuleConfigConfig addMetadataParamsItem(
202+
@Nonnull final String metadataParamsItem) {
203+
if (this.metadataParams == null) {
204+
this.metadataParams = new ArrayList<>();
205+
}
206+
this.metadataParams.add(metadataParamsItem);
207+
return this;
208+
}
209+
210+
/**
211+
* Parameter name used for specifying metadata parameters
212+
*
213+
* @return metadataParams The metadataParams of this {@link GroundingModuleConfigConfig} instance.
214+
*/
215+
@Nonnull
216+
public List<String> getMetadataParams() {
217+
return metadataParams;
218+
}
219+
220+
/**
221+
* Set the metadataParams of this {@link GroundingModuleConfigConfig} instance.
222+
*
223+
* @param metadataParams Parameter name used for specifying metadata parameters
224+
*/
225+
public void setMetadataParams(@Nullable final List<String> metadataParams) {
226+
this.metadataParams = metadataParams;
227+
}
228+
178229
/**
179230
* Get the names of the unrecognizable properties of the {@link GroundingModuleConfigConfig}.
180231
*
@@ -228,12 +279,13 @@ public boolean equals(@Nullable final java.lang.Object o) {
228279
this.cloudSdkCustomFields, groundingModuleConfigConfig.cloudSdkCustomFields)
229280
&& Objects.equals(this.filters, groundingModuleConfigConfig.filters)
230281
&& Objects.equals(this.inputParams, groundingModuleConfigConfig.inputParams)
231-
&& Objects.equals(this.outputParam, groundingModuleConfigConfig.outputParam);
282+
&& Objects.equals(this.outputParam, groundingModuleConfigConfig.outputParam)
283+
&& Objects.equals(this.metadataParams, groundingModuleConfigConfig.metadataParams);
232284
}
233285

234286
@Override
235287
public int hashCode() {
236-
return Objects.hash(filters, inputParams, outputParam, cloudSdkCustomFields);
288+
return Objects.hash(filters, inputParams, outputParam, metadataParams, cloudSdkCustomFields);
237289
}
238290

239291
@Override
@@ -244,6 +296,7 @@ public String toString() {
244296
sb.append(" filters: ").append(toIndentedString(filters)).append("\n");
245297
sb.append(" inputParams: ").append(toIndentedString(inputParams)).append("\n");
246298
sb.append(" outputParam: ").append(toIndentedString(outputParam)).append("\n");
299+
sb.append(" metadataParams: ").append(toIndentedString(metadataParams)).append("\n");
247300
cloudSdkCustomFields.forEach(
248301
(k, v) ->
249302
sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));

orchestration/src/main/java/com/sap/ai/sdk/orchestration/model/SearchSelectOptionEnum.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ public static SearchSelectOptionEnum fromValue(@Nonnull final String value) {
5757
return b;
5858
}
5959
}
60-
return null;
60+
return UNKNOWN_DEFAULT_OPEN_API;
6161
}
6262
}

orchestration/src/main/resources/spec/orchestration.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,11 +1034,15 @@ components:
10341034
type: string
10351035
description: Parameter name used for grounding output
10361036
example: groundingOutput
1037+
metadata_params:
1038+
type: array
1039+
items:
1040+
type: string
1041+
description: Parameter name used for specifying metadata parameters
10371042

10381043
DocumentGroundingFilter:
10391044
type: object
10401045
required:
1041-
- id
10421046
- data_repository_type
10431047
additionalProperties: false
10441048
properties:
@@ -1079,6 +1083,7 @@ components:
10791083
GroundingFilterId:
10801084
title: Id
10811085
description: Identifier of this SearchFilter - unique per request.
1086+
type: string
10821087
GroundingFilterSearchConfiguration:
10831088
additionalProperties: false
10841089
properties:
@@ -1101,11 +1106,9 @@ components:
11011106
DataRepositoryType:
11021107
type: string
11031108
description: Only include DataRepositories with the given type.
1104-
anyOf:
1105-
- enum:
1106-
- vector
1107-
- help.sap.com
1108-
- {}
1109+
enum:
1110+
- vector
1111+
- help.sap.com
11091112
title: DataRepositoryType
11101113
KeyValueListPair:
11111114
additionalProperties: false
@@ -1152,10 +1155,8 @@ components:
11521155
title: SearchDocumentKeyValueListPair
11531156
SearchSelectOptionEnum:
11541157
type: string
1155-
anyOf:
1156-
- enum:
1157-
- ignoreIfKeyAbsent
1158-
- {}
1158+
enum:
1159+
- ignoreIfKeyAbsent
11591160
title: SearchSelectOptionEnum
11601161

11611162
ErrorResponse:

orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfigTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ void testGroundingConfig() {
145145
List<GroundingModuleConfigConfigFiltersInner> filters = configConfig.getFilters();
146146
assertThat(filters).hasSize(1);
147147
DocumentGroundingFilter filter = (DocumentGroundingFilter) filters.get(0);
148-
assertThat(filter.getId()).isEqualTo("");
148+
assertThat(filter.getId()).isNull();
149149
assertThat(filter.getDataRepositoryType()).isEqualTo(VECTOR);
150150
}
151151

152152
@Test
153153
void testGroundingConfigWithFilters() {
154-
var filter1 = DocumentGroundingFilter.create().id("123").dataRepositoryType(VECTOR);
155-
var filter2 = DocumentGroundingFilter.create().id("234").dataRepositoryType(VECTOR);
154+
var filter1 = DocumentGroundingFilter.create().dataRepositoryType(VECTOR).id("123");
155+
var filter2 = DocumentGroundingFilter.create().dataRepositoryType(VECTOR).id("234");
156156
var groundingConfig = Grounding.create().filters(filter1, filter2);
157157
var config =
158158
new OrchestrationModuleConfig().withLlmConfig(GPT_4O).withGrounding(groundingConfig);

orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationUnitTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ void testGrounding() throws IOException {
153153
.selectMode(List.of(SearchSelectOptionEnum.IGNORE_IF_KEY_ABSENT));
154154
final var databaseFilter =
155155
DocumentGroundingFilter.create()
156-
.id("arbitrary-user-defined-id")
157156
.dataRepositoryType(DataRepositoryType.VECTOR)
158157
.searchConfig(GroundingFilterSearchConfiguration.create().maxChunkCount(3))
159158
.documentMetadata(List.of(documentMetadata))

orchestration/src/test/resources/groundingRequest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"type" : "document_grounding_service",
2626
"config" : {
2727
"filters" : [ {
28-
"id" : "arbitrary-user-defined-id",
2928
"search_config" : {
3029
"max_chunk_count" : 3
3130
},
@@ -43,7 +42,8 @@
4342
} ]
4443
} ],
4544
"input_params" : [ "query" ],
46-
"output_param" : "results"
45+
"output_param" : "results",
46+
"metadata_params" : [ ]
4747
}
4848
}
4949
},

0 commit comments

Comments
 (0)