|
| 1 | +/* |
| 2 | + * Internal Orchestration Service API |
| 3 | + * SAP AI Core - Orchestration Service API |
| 4 | + * |
| 5 | + * The version of the OpenAPI document: 0.0.1 |
| 6 | + * |
| 7 | + * |
| 8 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 9 | + * https://openapi-generator.tech |
| 10 | + * Do not edit the class manually. |
| 11 | + */ |
| 12 | + |
| 13 | +package com.sap.ai.sdk.orchestration.model; |
| 14 | + |
| 15 | +import com.fasterxml.jackson.annotation.JsonAnyGetter; |
| 16 | +import com.fasterxml.jackson.annotation.JsonAnySetter; |
| 17 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 18 | +import com.fasterxml.jackson.annotation.JsonIgnore; |
| 19 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 20 | +import com.fasterxml.jackson.annotation.JsonValue; |
| 21 | +import com.google.common.annotations.Beta; |
| 22 | +import java.util.LinkedHashMap; |
| 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 | +/** ChatCompletionTool */ |
| 31 | +@Beta // CHECKSTYLE:OFF |
| 32 | +public class ChatCompletionTool |
| 33 | +// CHECKSTYLE:ON |
| 34 | +{ |
| 35 | + /** The type of the tool. Currently, only `function` is supported. */ |
| 36 | + public enum TypeEnum { |
| 37 | + /** The FUNCTION option of this ChatCompletionTool */ |
| 38 | + FUNCTION("function"), |
| 39 | + |
| 40 | + /** The UNKNOWN_DEFAULT_OPEN_API option of this ChatCompletionTool */ |
| 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 ChatCompletionTool |
| 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 | + } |
| 88 | + |
| 89 | + @JsonProperty("type") |
| 90 | + private TypeEnum type; |
| 91 | + |
| 92 | + @JsonProperty("function") |
| 93 | + private FunctionObject function; |
| 94 | + |
| 95 | + @JsonAnySetter @JsonAnyGetter |
| 96 | + private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>(); |
| 97 | + |
| 98 | + /** Default constructor for ChatCompletionTool. */ |
| 99 | + protected ChatCompletionTool() {} |
| 100 | + |
| 101 | + /** |
| 102 | + * Set the type of this {@link ChatCompletionTool} instance and return the same instance. |
| 103 | + * |
| 104 | + * @param type The type of the tool. Currently, only `function` is supported. |
| 105 | + * @return The same instance of this {@link ChatCompletionTool} class |
| 106 | + */ |
| 107 | + @Nonnull |
| 108 | + public ChatCompletionTool type(@Nonnull final TypeEnum type) { |
| 109 | + this.type = type; |
| 110 | + return this; |
| 111 | + } |
| 112 | + |
| 113 | + /** |
| 114 | + * The type of the tool. Currently, only `function` is supported. |
| 115 | + * |
| 116 | + * @return type The type of this {@link ChatCompletionTool} instance. |
| 117 | + */ |
| 118 | + @Nonnull |
| 119 | + public TypeEnum getType() { |
| 120 | + return type; |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * Set the type of this {@link ChatCompletionTool} instance. |
| 125 | + * |
| 126 | + * @param type The type of the tool. Currently, only `function` is supported. |
| 127 | + */ |
| 128 | + public void setType(@Nonnull final TypeEnum type) { |
| 129 | + this.type = type; |
| 130 | + } |
| 131 | + |
| 132 | + /** |
| 133 | + * Set the function of this {@link ChatCompletionTool} instance and return the same instance. |
| 134 | + * |
| 135 | + * @param function The function of this {@link ChatCompletionTool} |
| 136 | + * @return The same instance of this {@link ChatCompletionTool} class |
| 137 | + */ |
| 138 | + @Nonnull |
| 139 | + public ChatCompletionTool function(@Nonnull final FunctionObject function) { |
| 140 | + this.function = function; |
| 141 | + return this; |
| 142 | + } |
| 143 | + |
| 144 | + /** |
| 145 | + * Get function |
| 146 | + * |
| 147 | + * @return function The function of this {@link ChatCompletionTool} instance. |
| 148 | + */ |
| 149 | + @Nonnull |
| 150 | + public FunctionObject getFunction() { |
| 151 | + return function; |
| 152 | + } |
| 153 | + |
| 154 | + /** |
| 155 | + * Set the function of this {@link ChatCompletionTool} instance. |
| 156 | + * |
| 157 | + * @param function The function of this {@link ChatCompletionTool} |
| 158 | + */ |
| 159 | + public void setFunction(@Nonnull final FunctionObject function) { |
| 160 | + this.function = function; |
| 161 | + } |
| 162 | + |
| 163 | + /** |
| 164 | + * Get the names of the unrecognizable properties of the {@link ChatCompletionTool}. |
| 165 | + * |
| 166 | + * @return The set of properties names |
| 167 | + */ |
| 168 | + @JsonIgnore |
| 169 | + @Nonnull |
| 170 | + public Set<String> getCustomFieldNames() { |
| 171 | + return cloudSdkCustomFields.keySet(); |
| 172 | + } |
| 173 | + |
| 174 | + /** |
| 175 | + * Get the value of an unrecognizable property of this {@link ChatCompletionTool} instance. |
| 176 | + * |
| 177 | + * @param name The name of the property |
| 178 | + * @return The value of the property |
| 179 | + * @throws NoSuchElementException If no property with the given name could be found. |
| 180 | + */ |
| 181 | + @Nullable |
| 182 | + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { |
| 183 | + if (!cloudSdkCustomFields.containsKey(name)) { |
| 184 | + throw new NoSuchElementException("ChatCompletionTool has no field with name '" + name + "'."); |
| 185 | + } |
| 186 | + return cloudSdkCustomFields.get(name); |
| 187 | + } |
| 188 | + |
| 189 | + /** |
| 190 | + * Set an unrecognizable property of this {@link ChatCompletionTool} instance. If the map |
| 191 | + * previously contained a mapping for the key, the old value is replaced by the specified value. |
| 192 | + * |
| 193 | + * @param customFieldName The name of the property |
| 194 | + * @param customFieldValue The value of the property |
| 195 | + */ |
| 196 | + @JsonIgnore |
| 197 | + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { |
| 198 | + cloudSdkCustomFields.put(customFieldName, customFieldValue); |
| 199 | + } |
| 200 | + |
| 201 | + @Override |
| 202 | + public boolean equals(@Nullable final java.lang.Object o) { |
| 203 | + if (this == o) { |
| 204 | + return true; |
| 205 | + } |
| 206 | + if (o == null || getClass() != o.getClass()) { |
| 207 | + return false; |
| 208 | + } |
| 209 | + final ChatCompletionTool chatCompletionTool = (ChatCompletionTool) o; |
| 210 | + return Objects.equals(this.cloudSdkCustomFields, chatCompletionTool.cloudSdkCustomFields) |
| 211 | + && Objects.equals(this.type, chatCompletionTool.type) |
| 212 | + && Objects.equals(this.function, chatCompletionTool.function); |
| 213 | + } |
| 214 | + |
| 215 | + @Override |
| 216 | + public int hashCode() { |
| 217 | + return Objects.hash(type, function, cloudSdkCustomFields); |
| 218 | + } |
| 219 | + |
| 220 | + @Override |
| 221 | + @Nonnull |
| 222 | + public String toString() { |
| 223 | + final StringBuilder sb = new StringBuilder(); |
| 224 | + sb.append("class ChatCompletionTool {\n"); |
| 225 | + sb.append(" type: ").append(toIndentedString(type)).append("\n"); |
| 226 | + sb.append(" function: ").append(toIndentedString(function)).append("\n"); |
| 227 | + cloudSdkCustomFields.forEach( |
| 228 | + (k, v) -> |
| 229 | + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); |
| 230 | + sb.append("}"); |
| 231 | + return sb.toString(); |
| 232 | + } |
| 233 | + |
| 234 | + /** |
| 235 | + * Convert the given object to string with each line indented by 4 spaces (except the first line). |
| 236 | + */ |
| 237 | + private String toIndentedString(final java.lang.Object o) { |
| 238 | + if (o == null) { |
| 239 | + return "null"; |
| 240 | + } |
| 241 | + return o.toString().replace("\n", "\n "); |
| 242 | + } |
| 243 | + |
| 244 | + /** |
| 245 | + * Create a type-safe, fluent-api builder object to construct a new {@link ChatCompletionTool} |
| 246 | + * instance with all required arguments. |
| 247 | + */ |
| 248 | + public static Builder create() { |
| 249 | + return (type) -> (function) -> new ChatCompletionTool().type(type).function(function); |
| 250 | + } |
| 251 | + |
| 252 | + /** Builder helper class. */ |
| 253 | + public interface Builder { |
| 254 | + /** |
| 255 | + * Set the type of this {@link ChatCompletionTool} instance. |
| 256 | + * |
| 257 | + * @param type The type of the tool. Currently, only `function` is supported. |
| 258 | + * @return The ChatCompletionTool builder. |
| 259 | + */ |
| 260 | + Builder1 type(@Nonnull final TypeEnum type); |
| 261 | + } |
| 262 | + |
| 263 | + /** Builder helper class. */ |
| 264 | + public interface Builder1 { |
| 265 | + /** |
| 266 | + * Set the function of this {@link ChatCompletionTool} instance. |
| 267 | + * |
| 268 | + * @param function The function of this {@link ChatCompletionTool} |
| 269 | + * @return The ChatCompletionTool instance. |
| 270 | + */ |
| 271 | + ChatCompletionTool function(@Nonnull final FunctionObject function); |
| 272 | + } |
| 273 | +} |
0 commit comments