Skip to content

Commit 69b7a5b

Browse files
chore: Orchestration spec update (#588)
* Update orchestration based on main * Update orchestration based on main * Update orchestration based on main * Update orchestration based on main * fix tests * generate and "fix" * improve release notes * improve release notes --------- Co-authored-by: SAP Cloud SDK Bot <[email protected]>
1 parent 7404d71 commit 69b7a5b

22 files changed

+2162
-163
lines changed

docs/release_notes.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,34 @@
88

99
### 🔧 Compatibility Notes
1010

11-
-
11+
- Breaking change:
12+
- two fields in `OrchestrationModuleConfig` changed:
13+
- `inputTranslationConfig` is now of type `SAPDocumentTranslationInput`
14+
- `outputTranslationConfig` is now of type `SAPDocumentTranslationOutput`
15+
- when using `OrchestrationModuleConfig.withInputTranslationConfig()` and `OrchestrationModuleConfig.withOutputTranslationConfig()` consider the following diff:
16+
```diff
17+
var config = new OrchestrationModuleConfig("some prompt");
18+
config
19+
.withInputTranslationConfig(
20+
- SAPDocumentTranslation.create()
21+
- .type(SAP_DOCUMENT_TRANSLATION)
22+
- .config(SAPDocumentTranslationConfig.create().targetLanguage("en-US")))
23+
+ SAPDocumentTranslationInput.create()
24+
+ .type(SAPDocumentTranslationInput.TypeEnum.SAP_DOCUMENT_TRANSLATION)
25+
+ .config(SAPDocumentTranslationInputConfig.create().targetLanguage("en-US")))
26+
.withOutputTranslationConfig(
27+
- SAPDocumentTranslation.create()
28+
- .type(SAP_DOCUMENT_TRANSLATION)
29+
+ SAPDocumentTranslationOutput.create()
30+
+ .type(SAPDocumentTranslationOutput.TypeEnum.SAP_DOCUMENT_TRANSLATION)
31+
.config(
32+
- SAPDocumentTranslationConfig.create()
33+
- .targetLanguage("de-DE")
34+
+ SAPDocumentTranslationOutputConfig.create()
35+
+ .targetLanguage(
36+
+ SAPDocumentTranslationOutputTargetLanguage.create("de-DE"))
37+
.sourceLanguage("en-US")));
38+
```
1239

1340
### ✨ New Functionality
1441

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
import com.sap.ai.sdk.orchestration.model.MaskingModuleConfigProviders;
1010
import com.sap.ai.sdk.orchestration.model.OutputFilteringConfig;
1111
import com.sap.ai.sdk.orchestration.model.PromptTemplatingModuleConfigPrompt;
12-
import com.sap.ai.sdk.orchestration.model.SAPDocumentTranslation;
12+
import com.sap.ai.sdk.orchestration.model.SAPDocumentTranslationInput;
13+
import com.sap.ai.sdk.orchestration.model.SAPDocumentTranslationOutput;
1314
import java.util.ArrayList;
1415
import java.util.Arrays;
1516
import java.util.Objects;
@@ -96,9 +97,9 @@ public class OrchestrationModuleConfig {
9697
*/
9798
@Nullable GroundingModuleConfig groundingConfig;
9899

99-
@Nullable SAPDocumentTranslation inputTranslationConfig;
100+
@Nullable SAPDocumentTranslationInput inputTranslationConfig;
100101

101-
@Nullable SAPDocumentTranslation outputTranslationConfig;
102+
@Nullable SAPDocumentTranslationOutput outputTranslationConfig;
102103

103104
/**
104105
* Creates a new configuration with the given LLM configuration.
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
/*
2+
* Internal Orchestration Service API
3+
* Orchestration is an inference service which provides common additional capabilities for business AI scenarios, such as content filtering and data masking. At the core of the service is the LLM module which allows for an easy, harmonized access to the language models of gen AI hub. The service is designed to be modular and extensible, allowing for the addition of new modules in the future. Each module can be configured independently and at runtime, allowing for a high degree of flexibility in the orchestration of AI services.
4+
*
5+
*
6+
*
7+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
8+
* https://openapi-generator.tech
9+
* Do not edit the class manually.
10+
*/
11+
12+
package com.sap.ai.sdk.orchestration.model;
13+
14+
import com.fasterxml.jackson.annotation.JsonAnyGetter;
15+
import com.fasterxml.jackson.annotation.JsonAnySetter;
16+
import com.fasterxml.jackson.annotation.JsonIgnore;
17+
import com.fasterxml.jackson.annotation.JsonProperty;
18+
import java.util.LinkedHashMap;
19+
import java.util.Map;
20+
import java.util.NoSuchElementException;
21+
import java.util.Objects;
22+
import java.util.Set;
23+
import javax.annotation.Nonnull;
24+
import javax.annotation.Nullable;
25+
26+
/** Input Translation module result */
27+
// CHECKSTYLE:OFF
28+
public class InputTranslationModuleResult
29+
// CHECKSTYLE:ON
30+
{
31+
@JsonProperty("message")
32+
private String message;
33+
34+
@JsonProperty("data")
35+
private InputTranslationModuleResultData data;
36+
37+
@JsonAnySetter @JsonAnyGetter
38+
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
39+
40+
/** Default constructor for InputTranslationModuleResult. */
41+
protected InputTranslationModuleResult() {}
42+
43+
/**
44+
* Set the message of this {@link InputTranslationModuleResult} instance and return the same
45+
* instance.
46+
*
47+
* @param message Status message describing the translation operation outcome.
48+
* @return The same instance of this {@link InputTranslationModuleResult} class
49+
*/
50+
@Nonnull
51+
public InputTranslationModuleResult message(@Nonnull final String message) {
52+
this.message = message;
53+
return this;
54+
}
55+
56+
/**
57+
* Status message describing the translation operation outcome.
58+
*
59+
* @return message The message of this {@link InputTranslationModuleResult} instance.
60+
*/
61+
@Nonnull
62+
public String getMessage() {
63+
return message;
64+
}
65+
66+
/**
67+
* Set the message of this {@link InputTranslationModuleResult} instance.
68+
*
69+
* @param message Status message describing the translation operation outcome.
70+
*/
71+
public void setMessage(@Nonnull final String message) {
72+
this.message = message;
73+
}
74+
75+
/**
76+
* Set the data of this {@link InputTranslationModuleResult} instance and return the same
77+
* instance.
78+
*
79+
* @param data The data of this {@link InputTranslationModuleResult}
80+
* @return The same instance of this {@link InputTranslationModuleResult} class
81+
*/
82+
@Nonnull
83+
public InputTranslationModuleResult data(@Nullable final InputTranslationModuleResultData data) {
84+
this.data = data;
85+
return this;
86+
}
87+
88+
/**
89+
* Get data
90+
*
91+
* @return data The data of this {@link InputTranslationModuleResult} instance.
92+
*/
93+
@Nonnull
94+
public InputTranslationModuleResultData getData() {
95+
return data;
96+
}
97+
98+
/**
99+
* Set the data of this {@link InputTranslationModuleResult} instance.
100+
*
101+
* @param data The data of this {@link InputTranslationModuleResult}
102+
*/
103+
public void setData(@Nullable final InputTranslationModuleResultData data) {
104+
this.data = data;
105+
}
106+
107+
/**
108+
* Get the names of the unrecognizable properties of the {@link InputTranslationModuleResult}.
109+
*
110+
* @return The set of properties names
111+
*/
112+
@JsonIgnore
113+
@Nonnull
114+
public Set<String> getCustomFieldNames() {
115+
return cloudSdkCustomFields.keySet();
116+
}
117+
118+
/**
119+
* Get the value of an unrecognizable property of this {@link InputTranslationModuleResult}
120+
* instance.
121+
*
122+
* @deprecated Use {@link #toMap()} instead.
123+
* @param name The name of the property
124+
* @return The value of the property
125+
* @throws NoSuchElementException If no property with the given name could be found.
126+
*/
127+
@Nullable
128+
@Deprecated
129+
public Object getCustomField(@Nonnull final String name) throws NoSuchElementException {
130+
if (!cloudSdkCustomFields.containsKey(name)) {
131+
throw new NoSuchElementException(
132+
"InputTranslationModuleResult has no field with name '" + name + "'.");
133+
}
134+
return cloudSdkCustomFields.get(name);
135+
}
136+
137+
/**
138+
* Get the value of all properties of this {@link InputTranslationModuleResult} instance including
139+
* unrecognized properties.
140+
*
141+
* @return The map of all properties
142+
*/
143+
@JsonIgnore
144+
@Nonnull
145+
public Map<String, Object> toMap() {
146+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
147+
if (message != null) declaredFields.put("message", message);
148+
if (data != null) declaredFields.put("data", data);
149+
return declaredFields;
150+
}
151+
152+
/**
153+
* Set an unrecognizable property of this {@link InputTranslationModuleResult} instance. If the
154+
* map previously contained a mapping for the key, the old value is replaced by the specified
155+
* value.
156+
*
157+
* @param customFieldName The name of the property
158+
* @param customFieldValue The value of the property
159+
*/
160+
@JsonIgnore
161+
public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) {
162+
cloudSdkCustomFields.put(customFieldName, customFieldValue);
163+
}
164+
165+
@Override
166+
public boolean equals(@Nullable final java.lang.Object o) {
167+
if (this == o) {
168+
return true;
169+
}
170+
if (o == null || getClass() != o.getClass()) {
171+
return false;
172+
}
173+
final InputTranslationModuleResult inputTranslationModuleResult =
174+
(InputTranslationModuleResult) o;
175+
return Objects.equals(
176+
this.cloudSdkCustomFields, inputTranslationModuleResult.cloudSdkCustomFields)
177+
&& Objects.equals(this.message, inputTranslationModuleResult.message)
178+
&& Objects.equals(this.data, inputTranslationModuleResult.data);
179+
}
180+
181+
@Override
182+
public int hashCode() {
183+
return Objects.hash(message, data, cloudSdkCustomFields);
184+
}
185+
186+
@Override
187+
@Nonnull
188+
public String toString() {
189+
final StringBuilder sb = new StringBuilder();
190+
sb.append("class InputTranslationModuleResult {\n");
191+
sb.append(" message: ").append(toIndentedString(message)).append("\n");
192+
sb.append(" data: ").append(toIndentedString(data)).append("\n");
193+
cloudSdkCustomFields.forEach(
194+
(k, v) ->
195+
sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
196+
sb.append("}");
197+
return sb.toString();
198+
}
199+
200+
/**
201+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
202+
*/
203+
private String toIndentedString(final java.lang.Object o) {
204+
if (o == null) {
205+
return "null";
206+
}
207+
return o.toString().replace("\n", "\n ");
208+
}
209+
210+
/**
211+
* Create a type-safe, fluent-api builder object to construct a new {@link
212+
* InputTranslationModuleResult} instance with all required arguments.
213+
*/
214+
public static Builder create() {
215+
return (message) -> new InputTranslationModuleResult().message(message);
216+
}
217+
218+
/** Builder helper class. */
219+
public interface Builder {
220+
/**
221+
* Set the message of this {@link InputTranslationModuleResult} instance.
222+
*
223+
* @param message Status message describing the translation operation outcome.
224+
* @return The InputTranslationModuleResult instance.
225+
*/
226+
InputTranslationModuleResult message(@Nonnull final String message);
227+
}
228+
}

0 commit comments

Comments
 (0)