Skip to content

Commit bc1a2a5

Browse files
committed
Update orchestration based on main
1 parent fe07f70 commit bc1a2a5

File tree

8 files changed

+979
-72
lines changed

8 files changed

+979
-72
lines changed
Lines changed: 354 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,354 @@
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.ArrayList;
19+
import java.util.LinkedHashMap;
20+
import java.util.List;
21+
import java.util.Map;
22+
import java.util.NoSuchElementException;
23+
import java.util.Objects;
24+
import java.util.Set;
25+
import javax.annotation.Nonnull;
26+
import javax.annotation.Nullable;
27+
28+
/** ChatCompletionTokenLogprob */
29+
// CHECKSTYLE:OFF
30+
public class ChatCompletionTokenLogprob
31+
// CHECKSTYLE:ON
32+
{
33+
@JsonProperty("token")
34+
private String token;
35+
36+
@JsonProperty("logprob")
37+
private Float logprob;
38+
39+
@JsonProperty("bytes")
40+
private List<Integer> bytes = new ArrayList<>();
41+
42+
@JsonProperty("top_logprobs")
43+
private List<ChatCompletionTokenLogprobTopLogprobsInner> topLogprobs = new ArrayList<>();
44+
45+
@JsonAnySetter @JsonAnyGetter
46+
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();
47+
48+
/** Default constructor for ChatCompletionTokenLogprob. */
49+
protected ChatCompletionTokenLogprob() {}
50+
51+
/**
52+
* Set the token of this {@link ChatCompletionTokenLogprob} instance and return the same instance.
53+
*
54+
* @param token The token.
55+
* @return The same instance of this {@link ChatCompletionTokenLogprob} class
56+
*/
57+
@Nonnull
58+
public ChatCompletionTokenLogprob token(@Nonnull final String token) {
59+
this.token = token;
60+
return this;
61+
}
62+
63+
/**
64+
* The token.
65+
*
66+
* @return token The token of this {@link ChatCompletionTokenLogprob} instance.
67+
*/
68+
@Nonnull
69+
public String getToken() {
70+
return token;
71+
}
72+
73+
/**
74+
* Set the token of this {@link ChatCompletionTokenLogprob} instance.
75+
*
76+
* @param token The token.
77+
*/
78+
public void setToken(@Nonnull final String token) {
79+
this.token = token;
80+
}
81+
82+
/**
83+
* Set the logprob of this {@link ChatCompletionTokenLogprob} instance and return the same
84+
* instance.
85+
*
86+
* @param logprob The log probability of this token.
87+
* @return The same instance of this {@link ChatCompletionTokenLogprob} class
88+
*/
89+
@Nonnull
90+
public ChatCompletionTokenLogprob logprob(@Nonnull final Float logprob) {
91+
this.logprob = logprob;
92+
return this;
93+
}
94+
95+
/**
96+
* The log probability of this token.
97+
*
98+
* @return logprob The logprob of this {@link ChatCompletionTokenLogprob} instance.
99+
*/
100+
@Nonnull
101+
public Float getLogprob() {
102+
return logprob;
103+
}
104+
105+
/**
106+
* Set the logprob of this {@link ChatCompletionTokenLogprob} instance.
107+
*
108+
* @param logprob The log probability of this token.
109+
*/
110+
public void setLogprob(@Nonnull final Float logprob) {
111+
this.logprob = logprob;
112+
}
113+
114+
/**
115+
* Set the bytes of this {@link ChatCompletionTokenLogprob} instance and return the same instance.
116+
*
117+
* @param bytes A list of integers representing the UTF-8 bytes representation of the token.
118+
* Useful in instances where characters are multi-byte.
119+
* @return The same instance of this {@link ChatCompletionTokenLogprob} class
120+
*/
121+
@Nonnull
122+
public ChatCompletionTokenLogprob bytes(@Nullable final List<Integer> bytes) {
123+
this.bytes = bytes;
124+
return this;
125+
}
126+
127+
/**
128+
* Add one bytes instance to this {@link ChatCompletionTokenLogprob}.
129+
*
130+
* @param bytesItem The bytes that should be added
131+
* @return The same instance of type {@link ChatCompletionTokenLogprob}
132+
*/
133+
@Nonnull
134+
public ChatCompletionTokenLogprob addBytesItem(@Nonnull final Integer bytesItem) {
135+
if (this.bytes == null) {
136+
this.bytes = new ArrayList<>();
137+
}
138+
this.bytes.add(bytesItem);
139+
return this;
140+
}
141+
142+
/**
143+
* A list of integers representing the UTF-8 bytes representation of the token. Useful in
144+
* instances where characters are multi-byte.
145+
*
146+
* @return bytes The bytes of this {@link ChatCompletionTokenLogprob} instance.
147+
*/
148+
@Nonnull
149+
public List<Integer> getBytes() {
150+
return bytes;
151+
}
152+
153+
/**
154+
* Set the bytes of this {@link ChatCompletionTokenLogprob} instance.
155+
*
156+
* @param bytes A list of integers representing the UTF-8 bytes representation of the token.
157+
* Useful in instances where characters are multi-byte.
158+
*/
159+
public void setBytes(@Nullable final List<Integer> bytes) {
160+
this.bytes = bytes;
161+
}
162+
163+
/**
164+
* Set the topLogprobs of this {@link ChatCompletionTokenLogprob} instance and return the same
165+
* instance.
166+
*
167+
* @param topLogprobs List of the most likely tokens and their log probability, at this token
168+
* position. In rare cases, there may be fewer than the number of requested
169+
* &#x60;top_logprobs&#x60;.
170+
* @return The same instance of this {@link ChatCompletionTokenLogprob} class
171+
*/
172+
@Nonnull
173+
public ChatCompletionTokenLogprob topLogprobs(
174+
@Nullable final List<ChatCompletionTokenLogprobTopLogprobsInner> topLogprobs) {
175+
this.topLogprobs = topLogprobs;
176+
return this;
177+
}
178+
179+
/**
180+
* Add one topLogprobs instance to this {@link ChatCompletionTokenLogprob}.
181+
*
182+
* @param topLogprobsItem The topLogprobs that should be added
183+
* @return The same instance of type {@link ChatCompletionTokenLogprob}
184+
*/
185+
@Nonnull
186+
public ChatCompletionTokenLogprob addTopLogprobsItem(
187+
@Nonnull final ChatCompletionTokenLogprobTopLogprobsInner topLogprobsItem) {
188+
if (this.topLogprobs == null) {
189+
this.topLogprobs = new ArrayList<>();
190+
}
191+
this.topLogprobs.add(topLogprobsItem);
192+
return this;
193+
}
194+
195+
/**
196+
* List of the most likely tokens and their log probability, at this token position. In rare
197+
* cases, there may be fewer than the number of requested &#x60;top_logprobs&#x60;.
198+
*
199+
* @return topLogprobs The topLogprobs of this {@link ChatCompletionTokenLogprob} instance.
200+
*/
201+
@Nonnull
202+
public List<ChatCompletionTokenLogprobTopLogprobsInner> getTopLogprobs() {
203+
return topLogprobs;
204+
}
205+
206+
/**
207+
* Set the topLogprobs of this {@link ChatCompletionTokenLogprob} instance.
208+
*
209+
* @param topLogprobs List of the most likely tokens and their log probability, at this token
210+
* position. In rare cases, there may be fewer than the number of requested
211+
* &#x60;top_logprobs&#x60;.
212+
*/
213+
public void setTopLogprobs(
214+
@Nullable final List<ChatCompletionTokenLogprobTopLogprobsInner> topLogprobs) {
215+
this.topLogprobs = topLogprobs;
216+
}
217+
218+
/**
219+
* Get the names of the unrecognizable properties of the {@link ChatCompletionTokenLogprob}.
220+
*
221+
* @return The set of properties names
222+
*/
223+
@JsonIgnore
224+
@Nonnull
225+
public Set<String> getCustomFieldNames() {
226+
return cloudSdkCustomFields.keySet();
227+
}
228+
229+
/**
230+
* Get the value of an unrecognizable property of this {@link ChatCompletionTokenLogprob}
231+
* instance.
232+
*
233+
* @deprecated Use {@link #toMap()} instead.
234+
* @param name The name of the property
235+
* @return The value of the property
236+
* @throws NoSuchElementException If no property with the given name could be found.
237+
*/
238+
@Nullable
239+
@Deprecated
240+
public Object getCustomField(@Nonnull final String name) throws NoSuchElementException {
241+
if (!cloudSdkCustomFields.containsKey(name)) {
242+
throw new NoSuchElementException(
243+
"ChatCompletionTokenLogprob has no field with name '" + name + "'.");
244+
}
245+
return cloudSdkCustomFields.get(name);
246+
}
247+
248+
/**
249+
* Get the value of all properties of this {@link ChatCompletionTokenLogprob} instance including
250+
* unrecognized properties.
251+
*
252+
* @return The map of all properties
253+
*/
254+
@JsonIgnore
255+
@Nonnull
256+
public Map<String, Object> toMap() {
257+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
258+
if (token != null) declaredFields.put("token", token);
259+
if (logprob != null) declaredFields.put("logprob", logprob);
260+
if (bytes != null) declaredFields.put("bytes", bytes);
261+
if (topLogprobs != null) declaredFields.put("topLogprobs", topLogprobs);
262+
return declaredFields;
263+
}
264+
265+
/**
266+
* Set an unrecognizable property of this {@link ChatCompletionTokenLogprob} instance. If the map
267+
* previously contained a mapping for the key, the old value is replaced by the specified value.
268+
*
269+
* @param customFieldName The name of the property
270+
* @param customFieldValue The value of the property
271+
*/
272+
@JsonIgnore
273+
public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) {
274+
cloudSdkCustomFields.put(customFieldName, customFieldValue);
275+
}
276+
277+
@Override
278+
public boolean equals(@Nullable final java.lang.Object o) {
279+
if (this == o) {
280+
return true;
281+
}
282+
if (o == null || getClass() != o.getClass()) {
283+
return false;
284+
}
285+
final ChatCompletionTokenLogprob chatCompletionTokenLogprob = (ChatCompletionTokenLogprob) o;
286+
return Objects.equals(
287+
this.cloudSdkCustomFields, chatCompletionTokenLogprob.cloudSdkCustomFields)
288+
&& Objects.equals(this.token, chatCompletionTokenLogprob.token)
289+
&& Objects.equals(this.logprob, chatCompletionTokenLogprob.logprob)
290+
&& Objects.equals(this.bytes, chatCompletionTokenLogprob.bytes)
291+
&& Objects.equals(this.topLogprobs, chatCompletionTokenLogprob.topLogprobs);
292+
}
293+
294+
@Override
295+
public int hashCode() {
296+
return Objects.hash(token, logprob, bytes, topLogprobs, cloudSdkCustomFields);
297+
}
298+
299+
@Override
300+
@Nonnull
301+
public String toString() {
302+
final StringBuilder sb = new StringBuilder();
303+
sb.append("class ChatCompletionTokenLogprob {\n");
304+
sb.append(" token: ").append(toIndentedString(token)).append("\n");
305+
sb.append(" logprob: ").append(toIndentedString(logprob)).append("\n");
306+
sb.append(" bytes: ").append(toIndentedString(bytes)).append("\n");
307+
sb.append(" topLogprobs: ").append(toIndentedString(topLogprobs)).append("\n");
308+
cloudSdkCustomFields.forEach(
309+
(k, v) ->
310+
sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n"));
311+
sb.append("}");
312+
return sb.toString();
313+
}
314+
315+
/**
316+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
317+
*/
318+
private String toIndentedString(final java.lang.Object o) {
319+
if (o == null) {
320+
return "null";
321+
}
322+
return o.toString().replace("\n", "\n ");
323+
}
324+
325+
/**
326+
* Create a type-safe, fluent-api builder object to construct a new {@link
327+
* ChatCompletionTokenLogprob} instance with all required arguments.
328+
*/
329+
public static Builder create() {
330+
return (token) -> (logprob) -> new ChatCompletionTokenLogprob().token(token).logprob(logprob);
331+
}
332+
333+
/** Builder helper class. */
334+
public interface Builder {
335+
/**
336+
* Set the token of this {@link ChatCompletionTokenLogprob} instance.
337+
*
338+
* @param token The token.
339+
* @return The ChatCompletionTokenLogprob builder.
340+
*/
341+
Builder1 token(@Nonnull final String token);
342+
}
343+
344+
/** Builder helper class. */
345+
public interface Builder1 {
346+
/**
347+
* Set the logprob of this {@link ChatCompletionTokenLogprob} instance.
348+
*
349+
* @param logprob The log probability of this token.
350+
* @return The ChatCompletionTokenLogprob instance.
351+
*/
352+
ChatCompletionTokenLogprob logprob(@Nonnull final Float logprob);
353+
}
354+
}

0 commit comments

Comments
 (0)