Skip to content

Commit d39beff

Browse files
committed
Merge remote-tracking branch 'origin/chat-message-convenience' into chat-message-convenience
# Conflicts: # orchestration/src/main/java/com/sap/ai/sdk/orchestration/Message.java
2 parents 7ff4123 + 5854a2d commit d39beff

30 files changed

+527
-527
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import com.sap.ai.sdk.orchestration.client.model.ChatMessage;
44
import javax.annotation.Nonnull;
55

6-
/** Represents a chat message to the orchestration service. */
6+
/** Interface representing convenience wrappers of chat message to the orchestration service. */
77
public sealed interface Message permits UserMessage, AssistantMessage, SystemMessage {
88

99
/**

orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/AzureContentSafety.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
public class AzureContentSafety
3131
// CHECKSTYLE:ON
3232
{
33+
@JsonAnySetter @JsonAnyGetter
34+
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
35+
3336
@JsonProperty("Hate")
3437
private AzureThreshold hate;
3538

@@ -42,12 +45,14 @@ public class AzureContentSafety
4245
@JsonProperty("Violence")
4346
private AzureThreshold violence;
4447

45-
@JsonAnySetter @JsonAnyGetter
46-
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
47-
4848
/** Default constructor for AzureContentSafety. */
4949
protected AzureContentSafety() {}
5050

51+
/** Create a new {@link AzureContentSafety} instance. No arguments are required. */
52+
public static AzureContentSafety create() {
53+
return new AzureContentSafety();
54+
}
55+
5156
/**
5257
* Set the hate of this {@link AzureContentSafety} instance and return the same instance.
5358
*
@@ -256,9 +261,4 @@ private String toIndentedString(final java.lang.Object o) {
256261
}
257262
return o.toString().replace("\n", "\n ");
258263
}
259-
260-
/** Create a new {@link AzureContentSafety} instance. No arguments are required. */
261-
public static AzureContentSafety create() {
262-
return new AzureContentSafety();
263-
}
264264
}

orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/AzureContentSafetyFilterConfig.java

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -32,72 +32,26 @@
3232
public class AzureContentSafetyFilterConfig implements FilterConfig
3333
// CHECKSTYLE:ON
3434
{
35-
/** String represents name of the filter provider */
36-
public enum TypeEnum {
37-
/** The AZURE_CONTENT_SAFETY option of this AzureContentSafetyFilterConfig */
38-
AZURE_CONTENT_SAFETY("azure_content_safety"),
39-
40-
/** The UNKNOWN_DEFAULT_OPEN_API option of this AzureContentSafetyFilterConfig */
41-
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");
42-
43-
private String value;
44-
45-
TypeEnum(String value) {
46-
this.value = value;
47-
}
48-
49-
/**
50-
* Get the value of the enum
51-
*
52-
* @return The enum value
53-
*/
54-
@JsonValue
55-
@Nonnull
56-
public String getValue() {
57-
return value;
58-
}
59-
60-
/**
61-
* Get the String value of the enum value.
62-
*
63-
* @return The enum value as String
64-
*/
65-
@Override
66-
@Nonnull
67-
public String toString() {
68-
return String.valueOf(value);
69-
}
70-
71-
/**
72-
* Get the enum value from a String value
73-
*
74-
* @param value The String value
75-
* @return The enum value of type AzureContentSafetyFilterConfig
76-
*/
77-
@JsonCreator
78-
@Nonnull
79-
public static TypeEnum fromValue(@Nonnull final String value) {
80-
for (TypeEnum b : TypeEnum.values()) {
81-
if (b.value.equals(value)) {
82-
return b;
83-
}
84-
}
85-
return UNKNOWN_DEFAULT_OPEN_API;
86-
}
87-
}
35+
@JsonAnySetter @JsonAnyGetter
36+
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
8837

8938
@JsonProperty("type")
9039
private TypeEnum type;
9140

9241
@JsonProperty("config")
9342
private AzureContentSafety config;
9443

95-
@JsonAnySetter @JsonAnyGetter
96-
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
97-
9844
/** Default constructor for AzureContentSafetyFilterConfig. */
9945
protected AzureContentSafetyFilterConfig() {}
10046

47+
/**
48+
* Create a type-safe, fluent-api builder object to construct a new {@link
49+
* AzureContentSafetyFilterConfig} instance with all required arguments.
50+
*/
51+
public static Builder create() {
52+
return (type) -> new AzureContentSafetyFilterConfig().type(type);
53+
}
54+
10155
/**
10256
* Set the type of this {@link AzureContentSafetyFilterConfig} instance and return the same
10357
* instance.
@@ -248,12 +202,58 @@ private String toIndentedString(final java.lang.Object o) {
248202
return o.toString().replace("\n", "\n ");
249203
}
250204

251-
/**
252-
* Create a type-safe, fluent-api builder object to construct a new {@link
253-
* AzureContentSafetyFilterConfig} instance with all required arguments.
254-
*/
255-
public static Builder create() {
256-
return (type) -> new AzureContentSafetyFilterConfig().type(type);
205+
/** String represents name of the filter provider */
206+
public enum TypeEnum {
207+
/** The AZURE_CONTENT_SAFETY option of this AzureContentSafetyFilterConfig */
208+
AZURE_CONTENT_SAFETY("azure_content_safety"),
209+
210+
/** The UNKNOWN_DEFAULT_OPEN_API option of this AzureContentSafetyFilterConfig */
211+
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");
212+
213+
private String value;
214+
215+
TypeEnum(String value) {
216+
this.value = value;
217+
}
218+
219+
/**
220+
* Get the enum value from a String value
221+
*
222+
* @param value The String value
223+
* @return The enum value of type AzureContentSafetyFilterConfig
224+
*/
225+
@JsonCreator
226+
@Nonnull
227+
public static TypeEnum fromValue(@Nonnull final String value) {
228+
for (TypeEnum b : TypeEnum.values()) {
229+
if (b.value.equals(value)) {
230+
return b;
231+
}
232+
}
233+
return UNKNOWN_DEFAULT_OPEN_API;
234+
}
235+
236+
/**
237+
* Get the value of the enum
238+
*
239+
* @return The enum value
240+
*/
241+
@JsonValue
242+
@Nonnull
243+
public String getValue() {
244+
return value;
245+
}
246+
247+
/**
248+
* Get the String value of the enum value.
249+
*
250+
* @return The enum value as String
251+
*/
252+
@Override
253+
@Nonnull
254+
public String toString() {
255+
return String.valueOf(value);
256+
}
257257
}
258258

259259
/** Builder helper class. */

orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/AzureThreshold.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,22 @@ public enum AzureThreshold {
3737
this.value = value;
3838
}
3939

40+
/**
41+
* Converts the given value to its enum representation.
42+
*
43+
* @param value The input value.
44+
* @return The enum representation of the given value.
45+
*/
46+
@JsonCreator
47+
public static AzureThreshold fromValue(@Nonnull final Integer value) {
48+
for (final AzureThreshold b : AzureThreshold.values()) {
49+
if (b.value.equals(value)) {
50+
return b;
51+
}
52+
}
53+
return NUMBER_unknown_default_open_api;
54+
}
55+
4056
/**
4157
* @return The enum value.
4258
*/
@@ -53,20 +69,4 @@ public Integer getValue() {
5369
public String toString() {
5470
return String.valueOf(value);
5571
}
56-
57-
/**
58-
* Converts the given value to its enum representation.
59-
*
60-
* @param value The input value.
61-
* @return The enum representation of the given value.
62-
*/
63-
@JsonCreator
64-
public static AzureThreshold fromValue(@Nonnull final Integer value) {
65-
for (final AzureThreshold b : AzureThreshold.values()) {
66-
if (b.value.equals(value)) {
67-
return b;
68-
}
69-
}
70-
return NUMBER_unknown_default_open_api;
71-
}
7272
}

orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/ChatDelta.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,26 @@
3030
public class ChatDelta
3131
// CHECKSTYLE:ON
3232
{
33+
@JsonAnySetter @JsonAnyGetter
34+
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
35+
3336
@JsonProperty("role")
3437
private String role;
3538

3639
@JsonProperty("content")
3740
private String content = "";
3841

39-
@JsonAnySetter @JsonAnyGetter
40-
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
41-
4242
/** Default constructor for ChatDelta. */
4343
protected ChatDelta() {}
4444

45+
/**
46+
* Create a type-safe, fluent-api builder object to construct a new {@link ChatDelta} instance
47+
* with all required arguments.
48+
*/
49+
public static Builder create() {
50+
return (content) -> new ChatDelta().content(content);
51+
}
52+
4553
/**
4654
* Set the role of this {@link ChatDelta} instance and return the same instance.
4755
*
@@ -185,14 +193,6 @@ private String toIndentedString(final java.lang.Object o) {
185193
return o.toString().replace("\n", "\n ");
186194
}
187195

188-
/**
189-
* Create a type-safe, fluent-api builder object to construct a new {@link ChatDelta} instance
190-
* with all required arguments.
191-
*/
192-
public static Builder create() {
193-
return (content) -> new ChatDelta().content(content);
194-
}
195-
196196
/** Builder helper class. */
197197
public interface Builder {
198198
/**

orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/ChatMessage.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,26 @@
3030
public class ChatMessage
3131
// CHECKSTYLE:ON
3232
{
33+
@JsonAnySetter @JsonAnyGetter
34+
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
35+
3336
@JsonProperty("role")
3437
private String role;
3538

3639
@JsonProperty("content")
3740
private String content;
3841

39-
@JsonAnySetter @JsonAnyGetter
40-
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
41-
4242
/** Default constructor for ChatMessage. */
4343
protected ChatMessage() {}
4444

45+
/**
46+
* Create a type-safe, fluent-api builder object to construct a new {@link ChatMessage} instance
47+
* with all required arguments.
48+
*/
49+
public static Builder create() {
50+
return (role) -> (content) -> new ChatMessage().role(role).content(content);
51+
}
52+
4553
/**
4654
* Set the role of this {@link ChatMessage} instance and return the same instance.
4755
*
@@ -185,14 +193,6 @@ private String toIndentedString(final java.lang.Object o) {
185193
return o.toString().replace("\n", "\n ");
186194
}
187195

188-
/**
189-
* Create a type-safe, fluent-api builder object to construct a new {@link ChatMessage} instance
190-
* with all required arguments.
191-
*/
192-
public static Builder create() {
193-
return (role) -> (content) -> new ChatMessage().role(role).content(content);
194-
}
195-
196196
/** Builder helper class. */
197197
public interface Builder {
198198
/**

orchestration/src/main/java/com/sap/ai/sdk/orchestration/client/model/CompletionPostRequest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
public class CompletionPostRequest
3434
// CHECKSTYLE:ON
3535
{
36+
@JsonAnySetter @JsonAnyGetter
37+
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
38+
3639
@JsonProperty("orchestration_config")
3740
private OrchestrationConfig orchestrationConfig;
3841

@@ -42,12 +45,18 @@ public class CompletionPostRequest
4245
@JsonProperty("messages_history")
4346
private List<ChatMessage> messagesHistory;
4447

45-
@JsonAnySetter @JsonAnyGetter
46-
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
47-
4848
/** Default constructor for CompletionPostRequest. */
4949
protected CompletionPostRequest() {}
5050

51+
/**
52+
* Create a type-safe, fluent-api builder object to construct a new {@link CompletionPostRequest}
53+
* instance with all required arguments.
54+
*/
55+
public static Builder create() {
56+
return (orchestrationConfig) ->
57+
new CompletionPostRequest().orchestrationConfig(orchestrationConfig);
58+
}
59+
5160
/**
5261
* Set the orchestrationConfig of this {@link CompletionPostRequest} instance and return the same
5362
* instance.
@@ -268,15 +277,6 @@ private String toIndentedString(final java.lang.Object o) {
268277
return o.toString().replace("\n", "\n ");
269278
}
270279

271-
/**
272-
* Create a type-safe, fluent-api builder object to construct a new {@link CompletionPostRequest}
273-
* instance with all required arguments.
274-
*/
275-
public static Builder create() {
276-
return (orchestrationConfig) ->
277-
new CompletionPostRequest().orchestrationConfig(orchestrationConfig);
278-
}
279-
280280
/** Builder helper class. */
281281
public interface Builder {
282282
/**

0 commit comments

Comments
 (0)