• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

box / box-java-sdk / #4045

30 Oct 2024 02:24PM CUT coverage: 71.747%. First build
#4045

Pull #1269

github

web-flow
Merge df232c9fd into 1b6384d9c
Pull Request #1269: docs: Add docs for getVersionById

8045 of 11213 relevant lines covered (71.75%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/box/sdk/BoxAIAgentLLMEndpointParamsGoogle.java
1
package com.box.sdk;
2

3
import com.box.sdk.internal.utils.JsonUtils;
4
import com.eclipsesource.json.JsonObject;
5

6
/**
7
 * Represents the AI LLM endpoint params Google object.
8
 */
9
public class BoxAIAgentLLMEndpointParamsGoogle extends BoxAIAgentLLMEndpointParams {
10

11
    /**
12
     * The type of the LLM endpoint parameters.
13
     */
14
    public static final String TYPE = "google_params";
15

16
    /**
17
     * The temperature is used for sampling during response generation, which occurs when top-P and top-K are applied.
18
     * Temperature controls the degree of randomness in token selection.
19
     */
20
    private Double temperature;
21
    /**
22
     * Top-K changes how the model selects tokens for output.
23
     * A top-K of 1 means the next selected token is the most probable among all tokens in the model's vocabulary
24
     * (also called greedy decoding), while a top-K of 3 means that the next token is selected from among the three
25
     * most probable tokens by using temperature.
26
     */
27
    private Integer topK;
28
    /**
29
     * Top-P changes how the model selects tokens for output.
30
     * Tokens are selected from the most (see top-K) to least probable until the sum of their probabilities equals the
31
     * top-P value.
32
     */
33
    private Double topP;
34

35
    /**
36
     * Constructs an AI agent with default settings.
37
     * @param temperature The temperature is used for sampling during response generation, which occurs when top-P and top-K are applied.
38
     *                    Temperature controls the degree of randomness in token selection.
39
     * @param topK Top-K changes how the model selects tokens for output.
40
     *             A top-K of 1 means the next selected token is the most probable among all tokens in the model's vocabulary
41
     *             (also called greedy decoding), while a top-K of 3 means that the next token is selected from among the three
42
     *             most probable tokens by using temperature.
43
     * @param topP Top-P changes how the model selects tokens for output.
44
     *             Tokens are selected from the most (see top-K) to least probable until the sum of their probabilities equals the
45
     *             top-P value.
46
     */
47
    public BoxAIAgentLLMEndpointParamsGoogle(Double temperature, Integer topK, Double topP) {
48
        super(TYPE);
×
49
        this.temperature = temperature;
×
50
        this.topK = topK;
×
51
        this.topP = topP;
×
52
    }
×
53

54
    /**
55
     * Constructs an AI agent with default settings.
56
     * @param jsonObject JSON object representing the AI agent.
57
     */
58
    public BoxAIAgentLLMEndpointParamsGoogle(JsonObject jsonObject) {
59
        super(jsonObject);
×
60
    }
×
61

62
    /**
63
     * Gets the temperature used for sampling during response generation, which occurs when top-P and top-K are applied.
64
     * @return The temperature used for sampling during response generation, which occurs when top-P and top-K are applied.
65
     */
66
    public Double getTemperature() {
67
        return temperature;
×
68
    }
69

70
    /**
71
     * Sets the temperature used for sampling during response generation, which occurs when top-P and top-K are applied.
72
     * @param temperature The temperature used for sampling during response generation, which occurs when top-P and top-K are applied.
73
     */
74
    public void setTemperature(Double temperature) {
75
        this.temperature = temperature;
×
76
    }
×
77

78
    /**
79
     * Gets the top-K value.
80
     * @return The top-K value.
81
     */
82
    public Integer getTopK() {
83
        return topK;
×
84
    }
85

86
    /**
87
     * Sets the top-K value.
88
     * @param topK The top-K value.
89
     */
90
    public void setTopK(Integer topK) {
91
        this.topK = topK;
×
92
    }
×
93

94
    /**
95
     * Gets the top-P value.
96
     * @return The top-P value.
97
     */
98
    public Double getTopP() {
99
        return topP;
×
100
    }
101

102
    /**
103
     * Sets the top-P value.
104
     * @param topP The top-P value.
105
     */
106
    public void setTopP(Double topP) {
107
        this.topP = topP;
×
108
    }
×
109

110
    @Override
111
    void parseJSONMember(JsonObject.Member member) {
112
        super.parseJSONMember(member);
×
113
        String memberName = member.getName();
×
114
        switch (memberName) {
×
115
            case "temperature":
116
                this.temperature = member.getValue().asDouble();
×
117
                break;
×
118
            case "top_k":
119
                this.topK = member.getValue().asInt();
×
120
                break;
×
121
            case "top_p":
122
                this.topP = member.getValue().asDouble();
×
123
                break;
×
124
            default:
125
                break;
126
        }
127
    }
×
128

129
    public JsonObject getJSONObject() {
130
        JsonObject jsonObject = new JsonObject();
×
131
        JsonUtils.addIfNotNull(jsonObject, "type", this.getType());
×
132
        JsonUtils.addIfNotNull(jsonObject, "temperature", this.temperature);
×
133
        JsonUtils.addIfNotNull(jsonObject, "top_k", this.topK);
×
134
        JsonUtils.addIfNotNull(jsonObject, "top_p", this.topP);
×
135
        return jsonObject;
×
136
    }
137
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc