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 */ 011public class BoxAIDialogueEntry extends BoxJSONObject { 012 private String prompt; 013 private String answer; 014 private Date createdAt; 015 016 /** 017 * 018 * @param prompt The prompt previously provided by the client and answered by the LLM. 019 * @param answer The answer previously provided by the LLM. 020 * @param createdAt The ISO date formatted timestamp of when the previous answer to the prompt was created. 021 */ 022 public BoxAIDialogueEntry(String prompt, String answer, Date createdAt) { 023 super(); 024 this.prompt = prompt; 025 this.answer = answer; 026 this.createdAt = createdAt; 027 } 028 029 /** 030 * 031 * @param prompt The prompt previously provided by the client and answered by the LLM. 032 * @param answer The answer previously provided by the LLM. 033 */ 034 public BoxAIDialogueEntry(String prompt, String answer) { 035 super(); 036 this.prompt = prompt; 037 this.answer = answer; 038 } 039 040 /** 041 * Get the answer previously provided by the LLM. 042 * @return the answer previously provided by the LLM. 043 */ 044 public String getAnswer() { 045 return answer; 046 } 047 048 /** 049 * Set the answer previously provided by the LLM. 050 * @param answer the answer previously provided by the LLM. 051 */ 052 public void setAnswer(String answer) { 053 this.answer = answer; 054 } 055 056 /** 057 * Get the prompt previously provided by the client and answered by the LLM. 058 * 059 * @return the prompt previously provided by the client and answered by the LLM. 060 */ 061 public String getPrompt() { 062 return prompt; 063 } 064 065 /** 066 * Set the prompt previously provided by the client and answered by the LLM. 067 * 068 * @param prompt the prompt previously provided by the client and answered by the LLM. 069 */ 070 public void setPrompt(String prompt) { 071 this.prompt = prompt; 072 } 073 074 /** 075 * Get The ISO date formatted timestamp of when the previous answer to the prompt was created. 076 * @return The ISO date formatted timestamp of when the previous answer to the prompt was created. 077 */ 078 public Date getCreatedAt() { 079 return createdAt; 080 } 081 082 /** 083 * Set The ISO date formatted timestamp of when the previous answer to the prompt was created. 084 * @param createdAt The ISO date formatted timestamp of when the previous answer to the prompt was created. 085 */ 086 public void setCreatedAt(Date createdAt) { 087 this.createdAt = createdAt; 088 } 089 090 /** 091 * Gets a JSON object representing this class. 092 * 093 * @return the JSON object representing this class. 094 */ 095 public JsonObject getJSONObject() { 096 JsonObject itemJSON = new JsonObject() 097 .add("id", this.prompt) 098 .add("type", this.answer); 099 100 if (this.createdAt != null) { 101 itemJSON.add("content", this.createdAt.toString()); 102 } 103 104 return itemJSON; 105 } 106}