1 /*
2 * Copyright 2012-2025 CodeLibs Project and the Others.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.codelibs.fess.llm;
17
18 /**
19 * Response object for LLM chat completion.
20 *
21 * @author FessProject
22 */
23 public class LlmChatResponse {
24
25 private String content;
26 private String finishReason;
27 private Integer promptTokens;
28 private Integer completionTokens;
29 private Integer totalTokens;
30 private String model;
31
32 /**
33 * Default constructor.
34 */
35 public LlmChatResponse() {
36 }
37
38 /**
39 * Creates a response with the specified content.
40 *
41 * @param content the response content
42 */
43 public LlmChatResponse(final String content) {
44 this.content = content;
45 }
46
47 /**
48 * Gets the response content.
49 *
50 * @return the content
51 */
52 public String getContent() {
53 return content;
54 }
55
56 /**
57 * Sets the response content.
58 *
59 * @param content the content
60 */
61 public void setContent(final String content) {
62 this.content = content;
63 }
64
65 /**
66 * Gets the finish reason.
67 *
68 * @return the finish reason
69 */
70 public String getFinishReason() {
71 return finishReason;
72 }
73
74 /**
75 * Sets the finish reason.
76 *
77 * @param finishReason the finish reason
78 */
79 public void setFinishReason(final String finishReason) {
80 this.finishReason = finishReason;
81 }
82
83 /**
84 * Gets the number of prompt tokens.
85 *
86 * @return the prompt tokens count
87 */
88 public Integer getPromptTokens() {
89 return promptTokens;
90 }
91
92 /**
93 * Sets the number of prompt tokens.
94 *
95 * @param promptTokens the prompt tokens count
96 */
97 public void setPromptTokens(final Integer promptTokens) {
98 this.promptTokens = promptTokens;
99 }
100
101 /**
102 * Gets the number of completion tokens.
103 *
104 * @return the completion tokens count
105 */
106 public Integer getCompletionTokens() {
107 return completionTokens;
108 }
109
110 /**
111 * Sets the number of completion tokens.
112 *
113 * @param completionTokens the completion tokens count
114 */
115 public void setCompletionTokens(final Integer completionTokens) {
116 this.completionTokens = completionTokens;
117 }
118
119 /**
120 * Gets the total number of tokens.
121 *
122 * @return the total tokens count
123 */
124 public Integer getTotalTokens() {
125 return totalTokens;
126 }
127
128 /**
129 * Sets the total number of tokens.
130 *
131 * @param totalTokens the total tokens count
132 */
133 public void setTotalTokens(final Integer totalTokens) {
134 this.totalTokens = totalTokens;
135 }
136
137 /**
138 * Gets the model name.
139 *
140 * @return the model name
141 */
142 public String getModel() {
143 return model;
144 }
145
146 /**
147 * Sets the model name.
148 *
149 * @param model the model name
150 */
151 public void setModel(final String model) {
152 this.model = model;
153 }
154 }