001package com.box.sdkgen.schemas.aillmendpointparamsibm; 002 003import com.box.sdkgen.internal.Nullable; 004import com.box.sdkgen.internal.NullableFieldTracker; 005import com.box.sdkgen.internal.SerializableObject; 006import com.box.sdkgen.serialization.json.EnumWrapper; 007import com.fasterxml.jackson.annotation.JsonFilter; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 010import com.fasterxml.jackson.databind.annotation.JsonSerialize; 011import java.util.Objects; 012 013/** AI LLM endpoint params IBM object. */ 014@JsonFilter("nullablePropertyFilter") 015public class AiLlmEndpointParamsIbm extends SerializableObject { 016 017 /** The type of the AI LLM endpoint params object for IBM. This parameter is **required**. */ 018 @JsonDeserialize( 019 using = AiLlmEndpointParamsIbmTypeField.AiLlmEndpointParamsIbmTypeFieldDeserializer.class) 020 @JsonSerialize( 021 using = AiLlmEndpointParamsIbmTypeField.AiLlmEndpointParamsIbmTypeFieldSerializer.class) 022 protected EnumWrapper<AiLlmEndpointParamsIbmTypeField> type; 023 024 /** 025 * What sampling temperature to use, between 0 and 1. Higher values like 0.8 will make the output 026 * more random, while lower values like 0.2 will make it more focused and deterministic. We 027 * generally recommend altering this or `top_p` but not both. 028 */ 029 @Nullable protected Double temperature; 030 031 /** 032 * An alternative to sampling with temperature, called nucleus sampling, where the model considers 033 * the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens 034 * comprising the top 10% probability mass are considered. We generally recommend altering this or 035 * temperature but not both. 036 */ 037 @JsonProperty("top_p") 038 @Nullable 039 protected Double topP; 040 041 /** 042 * `Top-K` changes how the model selects tokens for output. A low `top-K` means the next selected 043 * token is the most probable among all tokens in the model's vocabulary (also called greedy 044 * decoding), while a high `top-K` means that the next token is selected from among the three most 045 * probable tokens by using temperature. 046 */ 047 @JsonProperty("top_k") 048 @Nullable 049 protected Double topK; 050 051 public AiLlmEndpointParamsIbm() { 052 super(); 053 this.type = 054 new EnumWrapper<AiLlmEndpointParamsIbmTypeField>( 055 AiLlmEndpointParamsIbmTypeField.IBM_PARAMS); 056 } 057 058 protected AiLlmEndpointParamsIbm(Builder builder) { 059 super(); 060 this.type = builder.type; 061 this.temperature = builder.temperature; 062 this.topP = builder.topP; 063 this.topK = builder.topK; 064 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 065 } 066 067 public EnumWrapper<AiLlmEndpointParamsIbmTypeField> getType() { 068 return type; 069 } 070 071 public Double getTemperature() { 072 return temperature; 073 } 074 075 public Double getTopP() { 076 return topP; 077 } 078 079 public Double getTopK() { 080 return topK; 081 } 082 083 @Override 084 public boolean equals(Object o) { 085 if (this == o) { 086 return true; 087 } 088 if (o == null || getClass() != o.getClass()) { 089 return false; 090 } 091 AiLlmEndpointParamsIbm casted = (AiLlmEndpointParamsIbm) o; 092 return Objects.equals(type, casted.type) 093 && Objects.equals(temperature, casted.temperature) 094 && Objects.equals(topP, casted.topP) 095 && Objects.equals(topK, casted.topK); 096 } 097 098 @Override 099 public int hashCode() { 100 return Objects.hash(type, temperature, topP, topK); 101 } 102 103 @Override 104 public String toString() { 105 return "AiLlmEndpointParamsIbm{" 106 + "type='" 107 + type 108 + '\'' 109 + ", " 110 + "temperature='" 111 + temperature 112 + '\'' 113 + ", " 114 + "topP='" 115 + topP 116 + '\'' 117 + ", " 118 + "topK='" 119 + topK 120 + '\'' 121 + "}"; 122 } 123 124 public static class Builder extends NullableFieldTracker { 125 126 protected EnumWrapper<AiLlmEndpointParamsIbmTypeField> type; 127 128 protected Double temperature; 129 130 protected Double topP; 131 132 protected Double topK; 133 134 public Builder() { 135 super(); 136 } 137 138 public Builder type(AiLlmEndpointParamsIbmTypeField type) { 139 this.type = new EnumWrapper<AiLlmEndpointParamsIbmTypeField>(type); 140 return this; 141 } 142 143 public Builder type(EnumWrapper<AiLlmEndpointParamsIbmTypeField> type) { 144 this.type = type; 145 return this; 146 } 147 148 public Builder temperature(Double temperature) { 149 this.temperature = temperature; 150 this.markNullableFieldAsSet("temperature"); 151 return this; 152 } 153 154 public Builder topP(Double topP) { 155 this.topP = topP; 156 this.markNullableFieldAsSet("top_p"); 157 return this; 158 } 159 160 public Builder topK(Double topK) { 161 this.topK = topK; 162 this.markNullableFieldAsSet("top_k"); 163 return this; 164 } 165 166 public AiLlmEndpointParamsIbm build() { 167 if (this.type == null) { 168 this.type = 169 new EnumWrapper<AiLlmEndpointParamsIbmTypeField>( 170 AiLlmEndpointParamsIbmTypeField.IBM_PARAMS); 171 } 172 return new AiLlmEndpointParamsIbm(this); 173 } 174 } 175}