001package com.box.sdk;
002
003import com.box.sdk.internal.utils.JsonUtils;
004import com.eclipsesource.json.JsonObject;
005import com.eclipsesource.json.JsonValue;
006
007/**
008 * Represents the embeddings used by an AI agent.
009 */
010public class BoxAIAgentEmbeddings extends BoxJSONObject {
011    /**
012     * The model used for the AI Agent for calculating embeddings.
013     */
014    private String model;
015    /**
016     * The strategy used for the AI Agent for calculating embeddings.
017     */
018    private BoxAIAgentEmbeddingsStrategy strategy;
019
020    /**
021     * Constructs an AI agent with default settings.
022     * @param model The model used for the AI Agent for calculating embeddings.
023     * @param strategy The strategy used for the AI Agent for calculating embeddings.
024     */
025    public BoxAIAgentEmbeddings(String model, BoxAIAgentEmbeddingsStrategy strategy) {
026        this.model = model;
027        this.strategy = strategy;
028    }
029
030    /**
031     * Constructs an AI agent with default settings.
032     * @param jsonObject JSON object representing the AI agent.
033     */
034    public BoxAIAgentEmbeddings(JsonObject jsonObject) {
035        super(jsonObject);
036    }
037
038    /**
039     * Gets the model used for the AI Agent for calculating embeddings.
040     * @return The model used for the AI Agent for calculating embeddings.
041     */
042    public String getModel() {
043        return model;
044    }
045
046    /**
047     * Sets the model used for the AI Agent for calculating embeddings.
048     * @param model The model used for the AI Agent for calculating embeddings.
049     */
050    public void setModel(String model) {
051        this.model = model;
052    }
053
054    /**
055     * Gets the strategy used for the AI Agent for calculating embeddings.
056     * @return The strategy used for the AI Agent for calculating embeddings.
057     */
058    public BoxAIAgentEmbeddingsStrategy getStrategy() {
059        return strategy;
060    }
061
062    /**
063     * Sets the strategy used for the AI Agent for calculating embeddings.
064     * @param strategy The strategy used for the AI Agent for calculating embeddings.
065     */
066    public void setStrategy(BoxAIAgentEmbeddingsStrategy strategy) {
067        this.strategy = strategy;
068    }
069
070    @Override
071    void parseJSONMember(JsonObject.Member member) {
072        super.parseJSONMember(member);
073        String memberName = member.getName();
074        JsonValue value = member.getValue();
075        switch (memberName) {
076            case "model":
077                this.model = member.getValue().asString();
078                break;
079            case "strategy":
080                this.strategy = new BoxAIAgentEmbeddingsStrategy(value.asObject());
081                break;
082            default:
083                break;
084        }
085    }
086
087    public JsonObject getJSONObject() {
088        JsonObject jsonObject = new JsonObject();
089        JsonUtils.addIfNotNull(jsonObject, "model", this.model);
090        JsonUtils.addIfNotNull(jsonObject, "strategy", this.strategy.getJSONObject());
091        return jsonObject;
092    }
093}