001package com.box.sdk; 002 003import com.eclipsesource.json.JsonObject; 004import java.util.Date; 005 006 007/** 008 * Represents an entry of the history of prompts and answers previously passed to the LLM. 009 * This provides additional context to the LLM in generating the response. 010 */ 011@BoxResourceType("file_version") 012public class BoxAIDialogueEntry extends BoxJSONObject { 013 private String prompt; 014 private String answer; 015 private Date createdAt; 016 017 /** 018 * 019 * @param prompt The prompt previously provided by the client and answered by the LLM. 020 * @param answer The answer previously provided by the LLM. 021 * @param createdAt The ISO date formatted timestamp of when the previous answer to the prompt was created. 022 */ 023 public BoxAIDialogueEntry(String prompt, String answer, Date createdAt) { 024 super(); 025 this.prompt = prompt; 026 this.answer = answer; 027 this.createdAt = createdAt; 028 } 029 030 /** 031 * 032 * @param prompt The prompt previously provided by the client and answered by the LLM. 033 * @param answer The answer previously provided by the LLM. 034 */ 035 public BoxAIDialogueEntry(String prompt, String answer) { 036 super(); 037 this.prompt = prompt; 038 this.answer = answer; 039 } 040 041 /** 042 * Get the answer previously provided by the LLM. 043 * @return the answer previously provided by the LLM. 044 */ 045 public String getAnswer() { 046 return answer; 047 } 048 049 /** 050 * Set the answer previously provided by the LLM. 051 * @param answer the answer previously provided by the LLM. 052 */ 053 public void setAnswer(String answer) { 054 this.answer = answer; 055 } 056 057 /** 058 * Get the prompt previously provided by the client and answered by the LLM. 059 * 060 * @return the prompt previously provided by the client and answered by the LLM. 061 */ 062 public String getPrompt() { 063 return prompt; 064 } 065 066 /** 067 * Set the prompt previously provided by the client and answered by the LLM. 068 * 069 * @param prompt the prompt previously provided by the client and answered by the LLM. 070 */ 071 public void setPrompt(String prompt) { 072 this.prompt = prompt; 073 } 074 075 /** 076 * Get The ISO date formatted timestamp of when the previous answer to the prompt was created. 077 * @return The ISO date formatted timestamp of when the previous answer to the prompt was created. 078 */ 079 public Date getCreatedAt() { 080 return createdAt; 081 } 082 083 /** 084 * Set The ISO date formatted timestamp of when the previous answer to the prompt was created. 085 * @param createdAt The ISO date formatted timestamp of when the previous answer to the prompt was created. 086 */ 087 public void setCreatedAt(Date createdAt) { 088 this.createdAt = createdAt; 089 } 090 091 /** 092 * Gets a JSON object representing this class. 093 * 094 * @return the JSON object representing this class. 095 */ 096 public JsonObject getJSONObject() { 097 JsonObject itemJSON = new JsonObject() 098 .add("id", this.prompt) 099 .add("type", this.answer); 100 101 if (this.createdAt != null) { 102 itemJSON.add("content", this.createdAt.toString()); 103 } 104 105 return itemJSON; 106 } 107}