001package com.box.sdkgen.schemas.aiextract;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.schemas.aiagentextract.AiAgentExtract;
006import com.box.sdkgen.schemas.aiagentreference.AiAgentReference;
007import com.box.sdkgen.schemas.aiextractagent.AiExtractAgent;
008import com.box.sdkgen.schemas.aiitembase.AiItemBase;
009import com.fasterxml.jackson.annotation.JsonFilter;
010import com.fasterxml.jackson.annotation.JsonProperty;
011import java.util.List;
012import java.util.Objects;
013
014/** AI metadata freeform extraction request object. */
015@JsonFilter("nullablePropertyFilter")
016public class AiExtract extends SerializableObject {
017
018  /**
019   * The prompt provided to a Large Language Model (LLM) in the request. The prompt can be up to
020   * 10000 characters long and it can be an XML or a JSON schema.
021   */
022  protected final String prompt;
023
024  /** The items that LLM will process. Currently, you can use files only. */
025  protected final List<AiItemBase> items;
026
027  @JsonProperty("ai_agent")
028  protected AiExtractAgent aiAgent;
029
030  public AiExtract(
031      @JsonProperty("prompt") String prompt, @JsonProperty("items") List<AiItemBase> items) {
032    super();
033    this.prompt = prompt;
034    this.items = items;
035  }
036
037  protected AiExtract(Builder builder) {
038    super();
039    this.prompt = builder.prompt;
040    this.items = builder.items;
041    this.aiAgent = builder.aiAgent;
042    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
043  }
044
045  public String getPrompt() {
046    return prompt;
047  }
048
049  public List<AiItemBase> getItems() {
050    return items;
051  }
052
053  public AiExtractAgent getAiAgent() {
054    return aiAgent;
055  }
056
057  @Override
058  public boolean equals(Object o) {
059    if (this == o) {
060      return true;
061    }
062    if (o == null || getClass() != o.getClass()) {
063      return false;
064    }
065    AiExtract casted = (AiExtract) o;
066    return Objects.equals(prompt, casted.prompt)
067        && Objects.equals(items, casted.items)
068        && Objects.equals(aiAgent, casted.aiAgent);
069  }
070
071  @Override
072  public int hashCode() {
073    return Objects.hash(prompt, items, aiAgent);
074  }
075
076  @Override
077  public String toString() {
078    return "AiExtract{"
079        + "prompt='"
080        + prompt
081        + '\''
082        + ", "
083        + "items='"
084        + items
085        + '\''
086        + ", "
087        + "aiAgent='"
088        + aiAgent
089        + '\''
090        + "}";
091  }
092
093  public static class Builder extends NullableFieldTracker {
094
095    protected final String prompt;
096
097    protected final List<AiItemBase> items;
098
099    protected AiExtractAgent aiAgent;
100
101    public Builder(String prompt, List<AiItemBase> items) {
102      super();
103      this.prompt = prompt;
104      this.items = items;
105    }
106
107    public Builder aiAgent(AiAgentReference aiAgent) {
108      this.aiAgent = new AiExtractAgent(aiAgent);
109      return this;
110    }
111
112    public Builder aiAgent(AiAgentExtract aiAgent) {
113      this.aiAgent = new AiExtractAgent(aiAgent);
114      return this;
115    }
116
117    public Builder aiAgent(AiExtractAgent aiAgent) {
118      this.aiAgent = aiAgent;
119      return this;
120    }
121
122    public AiExtract build() {
123      return new AiExtract(this);
124    }
125  }
126}