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