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

box / box-java-sdk / #3996

06 Sep 2024 01:11PM UTC coverage: 71.703% (-0.7%) from 72.441%
#3996

push

github

web-flow
feat: Support AI Agent (#1265)

248 of 452 new or added lines in 14 files covered. (54.87%)

3 existing lines in 3 files now uncovered.

7921 of 11047 relevant lines covered (71.7%)

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 int 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, int topK, double topP) {
NEW
48
        super(TYPE);
×
NEW
49
        this.temperature = temperature;
×
NEW
50
        this.topK = topK;
×
NEW
51
        this.topP = topP;
×
NEW
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) {
NEW
59
        super(jsonObject);
×
NEW
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() {
NEW
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) {
NEW
75
        this.temperature = temperature;
×
NEW
76
    }
×
77

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

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

94
    /**
95
     * Gets the top-P value.
96
     * @return The top-P value.
97
     */
98
    public double getTopP() {
NEW
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) {
NEW
107
        this.topP = topP;
×
NEW
108
    }
×
109

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

129
    public JsonObject getJSONObject() {
NEW
130
        JsonObject jsonObject = new JsonObject();
×
NEW
131
        JsonUtils.addIfNotNull(jsonObject, "type", this.getType());
×
NEW
132
        JsonUtils.addIfNotNull(jsonObject, "temperature", this.temperature);
×
NEW
133
        JsonUtils.addIfNotNull(jsonObject, "top_k", this.topK);
×
NEW
134
        JsonUtils.addIfNotNull(jsonObject, "top_p", this.topP);
×
NEW
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

© 2026 Coveralls, Inc