Skip to content

Commit 51ffa8f

Browse files
committed
Update orchestration based on main
1 parent 2291834 commit 51ffa8f

22 files changed

+2566
-431
lines changed
Lines changed: 369 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,369 @@
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.JsonCreator;
17+
import com.fasterxml.jackson.annotation.JsonIgnore;
18+
import com.fasterxml.jackson.annotation.JsonProperty;
19+
import com.fasterxml.jackson.annotation.JsonValue;
20+
import java.util.ArrayList;
21+
import java.util.LinkedHashMap;
22+
import java.util.List;
23+
import java.util.Map;
24+
import java.util.NoSuchElementException;
25+
import java.util.Objects;
26+
import java.util.Set;
27+
import javax.annotation.Nonnull;
28+
import javax.annotation.Nullable;
29+
30+
/** AssistantChatMessage */
31+
// CHECKSTYLE:OFF
32+
public class AssistantChatMessage implements ChatMessage
33+
// CHECKSTYLE:ON
34+
{
35+
/** Gets or Sets role */
36+
public enum RoleEnum {
37+
/** The ASSISTANT option of this AssistantChatMessage */
38+
ASSISTANT("assistant"),
39+
40+
/** The UNKNOWN_DEFAULT_OPEN_API option of this AssistantChatMessage */
41+
UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");
42+
43+
private String value;
44+
45+
RoleEnum(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 AssistantChatMessage
76+
*/
77+
@JsonCreator
78+
@Nonnull
79+
public static RoleEnum fromValue(@Nonnull final String value) {
80+
for (RoleEnum b : RoleEnum.values()) {
81+
if (b.value.equals(value)) {
82+
return b;
83+
}
84+
}
85+
return UNKNOWN_DEFAULT_OPEN_API;
86+
}
87+
}
88+
89+
@JsonProperty("role")
90+
private RoleEnum role;
91+
92+
@JsonProperty("content")
93+
private ChatMessageContent content;
94+
95+
@JsonProperty("refusal")
96+
private String refusal;
97+
98+
@JsonProperty("tool_calls")
99+
private List<MessageToolCall> toolCalls = new ArrayList<>();
100+
101+
@JsonAnySetter @JsonAnyGetter
102+
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
103+
104+
/** Default constructor for AssistantChatMessage. */
105+
protected AssistantChatMessage() {}
106+
107+
/**
108+
* Set the role of this {@link AssistantChatMessage} instance and return the same instance.
109+
*
110+
* @param role The role of this {@link AssistantChatMessage}
111+
* @return The same instance of this {@link AssistantChatMessage} class
112+
*/
113+
@Nonnull
114+
public AssistantChatMessage role(@Nonnull final RoleEnum role) {
115+
this.role = role;
116+
return this;
117+
}
118+
119+
/**
120+
* Get role
121+
*
122+
* @return role The role of this {@link AssistantChatMessage} instance.
123+
*/
124+
@Nonnull
125+
public RoleEnum getRole() {
126+
return role;
127+
}
128+
129+
/**
130+
* Set the role of this {@link AssistantChatMessage} instance.
131+
*
132+
* @param role The role of this {@link AssistantChatMessage}
133+
*/
134+
public void setRole(@Nonnull final RoleEnum role) {
135+
this.role = role;
136+
}
137+
138+
/**
139+
* Set the content of this {@link AssistantChatMessage} instance and return the same instance.
140+
*
141+
* @param content The content of this {@link AssistantChatMessage}
142+
* @return The same instance of this {@link AssistantChatMessage} class
143+
*/
144+
@Nonnull
145+
public AssistantChatMessage content(@Nullable final ChatMessageContent content) {
146+
this.content = content;
147+
return this;
148+
}
149+
150+
/**
151+
* Get content
152+
*
153+
* @return content The content of this {@link AssistantChatMessage} instance.
154+
*/
155+
@Nonnull
156+
public ChatMessageContent getContent() {
157+
return content;
158+
}
159+
160+
/**
161+
* Set the content of this {@link AssistantChatMessage} instance.
162+
*
163+
* @param content The content of this {@link AssistantChatMessage}
164+
*/
165+
public void setContent(@Nullable final ChatMessageContent content) {
166+
this.content = content;
167+
}
168+
169+
/**
170+
* Set the refusal of this {@link AssistantChatMessage} instance and return the same instance.
171+
*
172+
* @param refusal The refusal of this {@link AssistantChatMessage}
173+
* @return The same instance of this {@link AssistantChatMessage} class
174+
*/
175+
@Nonnull
176+
public AssistantChatMessage refusal(@Nullable final String refusal) {
177+
this.refusal = refusal;
178+
return this;
179+
}
180+
181+
/**
182+
* Get refusal
183+
*
184+
* @return refusal The refusal of this {@link AssistantChatMessage} instance.
185+
*/
186+
@Nonnull
187+
public String getRefusal() {
188+
return refusal;
189+
}
190+
191+
/**
192+
* Set the refusal of this {@link AssistantChatMessage} instance.
193+
*
194+
* @param refusal The refusal of this {@link AssistantChatMessage}
195+
*/
196+
public void setRefusal(@Nullable final String refusal) {
197+
this.refusal = refusal;
198+
}
199+
200+
/**
201+
* Set the toolCalls of this {@link AssistantChatMessage} instance and return the same instance.
202+
*
203+
* @param toolCalls The tool calls generated by the model, such as function calls.
204+
* @return The same instance of this {@link AssistantChatMessage} class
205+
*/
206+
@Nonnull
207+
public AssistantChatMessage toolCalls(@Nullable final List<MessageToolCall> toolCalls) {
208+
this.toolCalls = toolCalls;
209+
return this;
210+
}
211+
212+
/**
213+
* Add one toolCalls instance to this {@link AssistantChatMessage}.
214+
*
215+
* @param toolCallsItem The toolCalls that should be added
216+
* @return The same instance of type {@link AssistantChatMessage}
217+
*/
218+
@Nonnull
219+
public AssistantChatMessage addToolCallsItem(@Nonnull final MessageToolCall toolCallsItem) {
220+
if (this.toolCalls == null) {
221+
this.toolCalls = new ArrayList<>();
222+
}
223+
this.toolCalls.add(toolCallsItem);
224+
return this;
225+
}
226+
227+
/**
228+
* The tool calls generated by the model, such as function calls.
229+
*
230+
* @return toolCalls The toolCalls of this {@link AssistantChatMessage} instance.
231+
*/
232+
@Nonnull
233+
public List<MessageToolCall> getToolCalls() {
234+
return toolCalls;
235+
}
236+
237+
/**
238+
* Set the toolCalls of this {@link AssistantChatMessage} instance.
239+
*
240+
* @param toolCalls The tool calls generated by the model, such as function calls.
241+
*/
242+
public void setToolCalls(@Nullable final List<MessageToolCall> toolCalls) {
243+
this.toolCalls = toolCalls;
244+
}
245+
246+
/**
247+
* Get the names of the unrecognizable properties of the {@link AssistantChatMessage}.
248+
*
249+
* @return The set of properties names
250+
*/
251+
@JsonIgnore
252+
@Nonnull
253+
public Set<String> getCustomFieldNames() {
254+
return cloudSdkCustomFields.keySet();
255+
}
256+
257+
/**
258+
* Get the value of an unrecognizable property of this {@link AssistantChatMessage} instance.
259+
*
260+
* @deprecated Use {@link #toMap()} instead.
261+
* @param name The name of the property
262+
* @return The value of the property
263+
* @throws NoSuchElementException If no property with the given name could be found.
264+
*/
265+
@Nullable
266+
@Deprecated
267+
public Object getCustomField(@Nonnull final String name) throws NoSuchElementException {
268+
if (!cloudSdkCustomFields.containsKey(name)) {
269+
throw new NoSuchElementException(
270+
"AssistantChatMessage has no field with name '" + name + "'.");
271+
}
272+
return cloudSdkCustomFields.get(name);
273+
}
274+
275+
/**
276+
* Get the value of all properties of this {@link AssistantChatMessage} instance including
277+
* unrecognized properties.
278+
*
279+
* @return The map of all properties
280+
*/
281+
@JsonIgnore
282+
@Nonnull
283+
public Map<String, Object> toMap() {
284+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
285+
if (role != null) declaredFields.put("role", role);
286+
if (content != null) declaredFields.put("content", content);
287+
if (refusal != null) declaredFields.put("refusal", refusal);
288+
if (toolCalls != null) declaredFields.put("toolCalls", toolCalls);
289+
return declaredFields;
290+
}
291+
292+
/**
293+
* Set an unrecognizable property of this {@link AssistantChatMessage} instance. If the map
294+
* previously contained a mapping for the key, the old value is replaced by the specified value.
295+
*
296+
* @param customFieldName The name of the property
297+
* @param customFieldValue The value of the property
298+
*/
299+
@JsonIgnore
300+
public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) {
301+
cloudSdkCustomFields.put(customFieldName, customFieldValue);
302+
}
303+
304+
@Override
305+
public boolean equals(@Nullable final java.lang.Object o) {
306+
if (this == o) {
307+
return true;
308+
}
309+
if (o == null || getClass() != o.getClass()) {
310+
return false;
311+
}
312+
final AssistantChatMessage assistantChatMessage = (AssistantChatMessage) o;
313+
return Objects.equals(this.cloudSdkCustomFields, assistantChatMessage.cloudSdkCustomFields)
314+
&& Objects.equals(this.role, assistantChatMessage.role)
315+
&& Objects.equals(this.content, assistantChatMessage.content)
316+
&& Objects.equals(this.refusal, assistantChatMessage.refusal)
317+
&& Objects.equals(this.toolCalls, assistantChatMessage.toolCalls);
318+
}
319+
320+
@Override
321+
public int hashCode() {
322+
return Objects.hash(role, content, refusal, toolCalls, cloudSdkCustomFields);
323+
}
324+
325+
@Override
326+
@Nonnull
327+
public String toString() {
328+
final StringBuilder sb = new StringBuilder();
329+
sb.append("class AssistantChatMessage {\n");
330+
sb.append(" role: ").append(toIndentedString(role)).append("\n");
331+
sb.append(" content: ").append(toIndentedString(content)).append("\n");
332+
sb.append(" refusal: ").append(toIndentedString(refusal)).append("\n");
333+
sb.append(" toolCalls: ").append(toIndentedString(toolCalls)).append("\n");
334+
cloudSdkCustomFields.forEach(
335+
(k, v) ->
336+
sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
337+
sb.append("}");
338+
return sb.toString();
339+
}
340+
341+
/**
342+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
343+
*/
344+
private String toIndentedString(final java.lang.Object o) {
345+
if (o == null) {
346+
return "null";
347+
}
348+
return o.toString().replace("\n", "\n ");
349+
}
350+
351+
/**
352+
* Create a type-safe, fluent-api builder object to construct a new {@link AssistantChatMessage}
353+
* instance with all required arguments.
354+
*/
355+
public static Builder create() {
356+
return (role) -> new AssistantChatMessage().role(role);
357+
}
358+
359+
/** Builder helper class. */
360+
public interface Builder {
361+
/**
362+
* Set the role of this {@link AssistantChatMessage} instance.
363+
*
364+
* @param role The role of this {@link AssistantChatMessage}
365+
* @return The AssistantChatMessage instance.
366+
*/
367+
AssistantChatMessage role(@Nonnull final RoleEnum role);
368+
}
369+
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
/** ChatMessage */
1818
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
1919
@JsonSubTypes({
20-
@JsonSubTypes.Type(value = MultiChatMessage.class),
21-
@JsonSubTypes.Type(value = SingleChatMessage.class),
20+
@JsonSubTypes.Type(value = AssistantChatMessage.class),
21+
@JsonSubTypes.Type(value = DeveloperChatMessage.class),
22+
@JsonSubTypes.Type(value = SystemChatMessage.class),
23+
@JsonSubTypes.Type(value = ToolChatMessage.class),
24+
@JsonSubTypes.Type(value = UserChatMessage.class),
2225
})
2326
public interface ChatMessage {}

0 commit comments

Comments
 (0)