001package com.box.sdk;
002
003import com.box.sdk.internal.utils.JsonUtils;
004import com.eclipsesource.json.JsonObject;
005import com.eclipsesource.json.JsonValue;
006
007/** Represents the embeddings used by an AI agent. */
008public class BoxAIAgentEmbeddings extends BoxJSONObject {
009  /** The model used for the AI Agent for calculating embeddings. */
010  private String model;
011  /** The strategy used for the AI Agent for calculating embeddings. */
012  private BoxAIAgentEmbeddingsStrategy strategy;
013
014  /**
015   * Constructs an AI agent with default settings.
016   *
017   * @param model The model used for the AI Agent for calculating embeddings.
018   * @param strategy The strategy used for the AI Agent for calculating embeddings.
019   */
020  public BoxAIAgentEmbeddings(String model, BoxAIAgentEmbeddingsStrategy strategy) {
021    this.model = model;
022    this.strategy = strategy;
023  }
024
025  /**
026   * Constructs an AI agent with default settings.
027   *
028   * @param jsonObject JSON object representing the AI agent.
029   */
030  public BoxAIAgentEmbeddings(JsonObject jsonObject) {
031    super(jsonObject);
032  }
033
034  /**
035   * Gets the model used for the AI Agent for calculating embeddings.
036   *
037   * @return The model used for the AI Agent for calculating embeddings.
038   */
039  public String getModel() {
040    return model;
041  }
042
043  /**
044   * Sets the model used for the AI Agent for calculating embeddings.
045   *
046   * @param model The model used for the AI Agent for calculating embeddings.
047   */
048  public void setModel(String model) {
049    this.model = model;
050  }
051
052  /**
053   * Gets the strategy used for the AI Agent for calculating embeddings.
054   *
055   * @return The strategy used for the AI Agent for calculating embeddings.
056   */
057  public BoxAIAgentEmbeddingsStrategy getStrategy() {
058    return strategy;
059  }
060
061  /**
062   * Sets the strategy used for the AI Agent for calculating embeddings.
063   *
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    if (this.strategy != null) {
091      jsonObject.add("strategy", this.strategy.getJSONObject());
092    }
093    return jsonObject;
094  }
095}