001package com.box.sdkgen.schemas.airesponsefull; 002 003import com.box.sdkgen.schemas.aiagentinfo.AiAgentInfo; 004import com.box.sdkgen.schemas.aicitation.AiCitation; 005import com.box.sdkgen.schemas.airesponse.AiResponse; 006import com.fasterxml.jackson.annotation.JsonFilter; 007import com.fasterxml.jackson.annotation.JsonProperty; 008import java.time.OffsetDateTime; 009import java.util.List; 010import java.util.Objects; 011 012/** AI ask response. */ 013@JsonFilter("nullablePropertyFilter") 014public class AiResponseFull extends AiResponse { 015 016 /** The citations of the LLM's answer reference. */ 017 protected List<AiCitation> citations; 018 019 public AiResponseFull( 020 @JsonProperty("answer") String answer, @JsonProperty("created_at") OffsetDateTime createdAt) { 021 super(answer, createdAt); 022 } 023 024 protected AiResponseFull(Builder builder) { 025 super(builder); 026 this.citations = builder.citations; 027 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 028 } 029 030 public List<AiCitation> getCitations() { 031 return citations; 032 } 033 034 @Override 035 public boolean equals(Object o) { 036 if (this == o) { 037 return true; 038 } 039 if (o == null || getClass() != o.getClass()) { 040 return false; 041 } 042 AiResponseFull casted = (AiResponseFull) o; 043 return Objects.equals(answer, casted.answer) 044 && Objects.equals(createdAt, casted.createdAt) 045 && Objects.equals(completionReason, casted.completionReason) 046 && Objects.equals(aiAgentInfo, casted.aiAgentInfo) 047 && Objects.equals(citations, casted.citations); 048 } 049 050 @Override 051 public int hashCode() { 052 return Objects.hash(answer, createdAt, completionReason, aiAgentInfo, citations); 053 } 054 055 @Override 056 public String toString() { 057 return "AiResponseFull{" 058 + "answer='" 059 + answer 060 + '\'' 061 + ", " 062 + "createdAt='" 063 + createdAt 064 + '\'' 065 + ", " 066 + "completionReason='" 067 + completionReason 068 + '\'' 069 + ", " 070 + "aiAgentInfo='" 071 + aiAgentInfo 072 + '\'' 073 + ", " 074 + "citations='" 075 + citations 076 + '\'' 077 + "}"; 078 } 079 080 public static class Builder extends AiResponse.Builder { 081 082 protected List<AiCitation> citations; 083 084 public Builder(String answer, OffsetDateTime createdAt) { 085 super(answer, createdAt); 086 } 087 088 public Builder citations(List<AiCitation> citations) { 089 this.citations = citations; 090 return this; 091 } 092 093 @Override 094 public Builder completionReason(String completionReason) { 095 this.completionReason = completionReason; 096 return this; 097 } 098 099 @Override 100 public Builder aiAgentInfo(AiAgentInfo aiAgentInfo) { 101 this.aiAgentInfo = aiAgentInfo; 102 return this; 103 } 104 105 public AiResponseFull build() { 106 return new AiResponseFull(this); 107 } 108 } 109}