001package com.box.sdkgen.schemas.aillmendpointparamsgoogle;
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 Google object. */
014@JsonFilter("nullablePropertyFilter")
015public class AiLlmEndpointParamsGoogle extends SerializableObject {
016
017  /** The type of the AI LLM endpoint params object for Google. This parameter is **required**. */
018  @JsonDeserialize(
019      using =
020          AiLlmEndpointParamsGoogleTypeField.AiLlmEndpointParamsGoogleTypeFieldDeserializer.class)
021  @JsonSerialize(
022      using = AiLlmEndpointParamsGoogleTypeField.AiLlmEndpointParamsGoogleTypeFieldSerializer.class)
023  protected EnumWrapper<AiLlmEndpointParamsGoogleTypeField> type;
024
025  /**
026   * The temperature is used for sampling during response generation, which occurs when `top-P` and
027   * `top-K` are applied. Temperature controls the degree of randomness in the token selection.
028   */
029  @Nullable protected Double temperature;
030
031  /**
032   * `Top-P` changes how the model selects tokens for output. Tokens are selected from the most (see
033   * `top-K`) to least probable until the sum of their probabilities equals the `top-P` value.
034   */
035  @JsonProperty("top_p")
036  @Nullable
037  protected Double topP;
038
039  /**
040   * `Top-K` changes how the model selects tokens for output. A low `top-K` means the next selected
041   * token is the most probable among all tokens in the model's vocabulary (also called greedy
042   * decoding), while a high `top-K` means that the next token is selected from among the three most
043   * probable tokens by using temperature.
044   */
045  @JsonProperty("top_k")
046  @Nullable
047  protected Double topK;
048
049  public AiLlmEndpointParamsGoogle() {
050    super();
051    this.type =
052        new EnumWrapper<AiLlmEndpointParamsGoogleTypeField>(
053            AiLlmEndpointParamsGoogleTypeField.GOOGLE_PARAMS);
054  }
055
056  protected AiLlmEndpointParamsGoogle(Builder builder) {
057    super();
058    this.type = builder.type;
059    this.temperature = builder.temperature;
060    this.topP = builder.topP;
061    this.topK = builder.topK;
062    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
063  }
064
065  public EnumWrapper<AiLlmEndpointParamsGoogleTypeField> getType() {
066    return type;
067  }
068
069  public Double getTemperature() {
070    return temperature;
071  }
072
073  public Double getTopP() {
074    return topP;
075  }
076
077  public Double getTopK() {
078    return topK;
079  }
080
081  @Override
082  public boolean equals(Object o) {
083    if (this == o) {
084      return true;
085    }
086    if (o == null || getClass() != o.getClass()) {
087      return false;
088    }
089    AiLlmEndpointParamsGoogle casted = (AiLlmEndpointParamsGoogle) o;
090    return Objects.equals(type, casted.type)
091        && Objects.equals(temperature, casted.temperature)
092        && Objects.equals(topP, casted.topP)
093        && Objects.equals(topK, casted.topK);
094  }
095
096  @Override
097  public int hashCode() {
098    return Objects.hash(type, temperature, topP, topK);
099  }
100
101  @Override
102  public String toString() {
103    return "AiLlmEndpointParamsGoogle{"
104        + "type='"
105        + type
106        + '\''
107        + ", "
108        + "temperature='"
109        + temperature
110        + '\''
111        + ", "
112        + "topP='"
113        + topP
114        + '\''
115        + ", "
116        + "topK='"
117        + topK
118        + '\''
119        + "}";
120  }
121
122  public static class Builder extends NullableFieldTracker {
123
124    protected EnumWrapper<AiLlmEndpointParamsGoogleTypeField> type;
125
126    protected Double temperature;
127
128    protected Double topP;
129
130    protected Double topK;
131
132    public Builder() {
133      super();
134    }
135
136    public Builder type(AiLlmEndpointParamsGoogleTypeField type) {
137      this.type = new EnumWrapper<AiLlmEndpointParamsGoogleTypeField>(type);
138      return this;
139    }
140
141    public Builder type(EnumWrapper<AiLlmEndpointParamsGoogleTypeField> type) {
142      this.type = type;
143      return this;
144    }
145
146    public Builder temperature(Double temperature) {
147      this.temperature = temperature;
148      this.markNullableFieldAsSet("temperature");
149      return this;
150    }
151
152    public Builder topP(Double topP) {
153      this.topP = topP;
154      this.markNullableFieldAsSet("top_p");
155      return this;
156    }
157
158    public Builder topK(Double topK) {
159      this.topK = topK;
160      this.markNullableFieldAsSet("top_k");
161      return this;
162    }
163
164    public AiLlmEndpointParamsGoogle build() {
165      if (this.type == null) {
166        this.type =
167            new EnumWrapper<AiLlmEndpointParamsGoogleTypeField>(
168                AiLlmEndpointParamsGoogleTypeField.GOOGLE_PARAMS);
169      }
170      return new AiLlmEndpointParamsGoogle(this);
171    }
172  }
173}