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