14
14
* limitations under the License.
15
15
*/
16
16
17
- package com .google .cloud .vertexai .generativeai . preview ;
17
+ package com .google .cloud .vertexai .generativeai ;
18
18
19
- import static com .google .cloud .vertexai .generativeai .preview . ResponseHandler .aggregateStreamIntoResponse ;
20
- import static com .google .cloud .vertexai .generativeai .preview . ResponseHandler .getContent ;
21
- import static com .google .cloud .vertexai .generativeai .preview . ResponseHandler .getFinishReason ;
19
+ import static com .google .cloud .vertexai .generativeai .ResponseHandler .aggregateStreamIntoResponse ;
20
+ import static com .google .cloud .vertexai .generativeai .ResponseHandler .getContent ;
21
+ import static com .google .cloud .vertexai .generativeai .ResponseHandler .getFinishReason ;
22
22
23
+ import com .google .api .core .BetaApi ;
23
24
import com .google .cloud .vertexai .api .Candidate .FinishReason ;
24
25
import com .google .cloud .vertexai .api .Content ;
25
26
import com .google .cloud .vertexai .api .GenerateContentResponse ;
@@ -51,6 +52,7 @@ public ChatSession(GenerativeModel model) {
51
52
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
52
53
* stream by stream() method.
53
54
*/
55
+ @ BetaApi
54
56
public ResponseStream <GenerateContentResponse > sendMessageStream (String text ) throws IOException {
55
57
return sendMessageStream (text , null , null );
56
58
}
@@ -63,6 +65,7 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(String text) th
63
65
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
64
66
* stream by stream() method.
65
67
*/
68
+ @ BetaApi
66
69
public ResponseStream <GenerateContentResponse > sendMessageStream (
67
70
String text , GenerationConfig generationConfig ) throws IOException {
68
71
return sendMessageStream (text , generationConfig , null );
@@ -76,6 +79,7 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
76
79
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
77
80
* stream by stream() method.
78
81
*/
82
+ @ BetaApi
79
83
public ResponseStream <GenerateContentResponse > sendMessageStream (
80
84
String text , List <SafetySetting > safetySettings ) throws IOException {
81
85
return sendMessageStream (text , null , safetySettings );
@@ -90,6 +94,7 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
90
94
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
91
95
* stream by stream() method.
92
96
*/
97
+ @ BetaApi
93
98
public ResponseStream <GenerateContentResponse > sendMessageStream (
94
99
String text , GenerationConfig generationConfig , List <SafetySetting > safetySettings )
95
100
throws IOException {
@@ -111,6 +116,7 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
111
116
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
112
117
* stream by stream() method.
113
118
*/
119
+ @ BetaApi
114
120
public ResponseStream <GenerateContentResponse > sendMessageStream (Content content )
115
121
throws IOException , IllegalArgumentException {
116
122
return sendMessageStream (content , null , null );
@@ -124,6 +130,7 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(Content content
124
130
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
125
131
* stream by stream() method.
126
132
*/
133
+ @ BetaApi
127
134
public ResponseStream <GenerateContentResponse > sendMessageStream (
128
135
Content content , GenerationConfig generationConfig )
129
136
throws IOException , IllegalArgumentException {
@@ -138,6 +145,7 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
138
145
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
139
146
* stream by stream() method.
140
147
*/
148
+ @ BetaApi
141
149
public ResponseStream <GenerateContentResponse > sendMessageStream (
142
150
Content content , List <SafetySetting > safetySettings )
143
151
throws IOException , IllegalArgumentException {
@@ -153,6 +161,7 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
153
161
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
154
162
* stream by stream() method.
155
163
*/
164
+ @ BetaApi
156
165
public ResponseStream <GenerateContentResponse > sendMessageStream (
157
166
Content content , GenerationConfig generationConfig , List <SafetySetting > safetySettings )
158
167
throws IOException {
@@ -172,6 +181,7 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
172
181
* @param text the message to be sent.
173
182
* @return a response.
174
183
*/
184
+ @ BetaApi
175
185
public GenerateContentResponse sendMessage (String text ) throws IOException {
176
186
return sendMessage (text , null , null );
177
187
}
@@ -183,6 +193,7 @@ public GenerateContentResponse sendMessage(String text) throws IOException {
183
193
* @param generationConfig the generation config.
184
194
* @return a response.
185
195
*/
196
+ @ BetaApi
186
197
public GenerateContentResponse sendMessage (String text , GenerationConfig generationConfig )
187
198
throws IOException {
188
199
return sendMessage (text , generationConfig , null );
@@ -195,6 +206,7 @@ public GenerateContentResponse sendMessage(String text, GenerationConfig generat
195
206
* @param safetySettings the safety settings.
196
207
* @return a response.
197
208
*/
209
+ @ BetaApi
198
210
public GenerateContentResponse sendMessage (String text , List <SafetySetting > safetySettings )
199
211
throws IOException {
200
212
return sendMessage (text , null , safetySettings );
@@ -208,6 +220,7 @@ public GenerateContentResponse sendMessage(String text, List<SafetySetting> safe
208
220
* @param safetySettings the safety settings.
209
221
* @return a response.
210
222
*/
223
+ @ BetaApi
211
224
public GenerateContentResponse sendMessage (
212
225
String text , GenerationConfig generationConfig , List <SafetySetting > safetySettings )
213
226
throws IOException {
@@ -227,6 +240,7 @@ public GenerateContentResponse sendMessage(
227
240
* @param content the content to be sent.
228
241
* @return a response.
229
242
*/
243
+ @ BetaApi
230
244
public GenerateContentResponse sendMessage (Content content ) throws IOException {
231
245
return sendMessage (content , null , null );
232
246
}
@@ -238,6 +252,7 @@ public GenerateContentResponse sendMessage(Content content) throws IOException {
238
252
* @param generationConfig the generation config.
239
253
* @return a response.
240
254
*/
255
+ @ BetaApi
241
256
public GenerateContentResponse sendMessage (Content content , GenerationConfig generationConfig )
242
257
throws IOException {
243
258
return sendMessage (content , generationConfig , null );
@@ -250,6 +265,7 @@ public GenerateContentResponse sendMessage(Content content, GenerationConfig gen
250
265
* @param safetySettings the safety settings.
251
266
* @return a response.
252
267
*/
268
+ @ BetaApi
253
269
public GenerateContentResponse sendMessage (Content content , List <SafetySetting > safetySettings )
254
270
throws IOException {
255
271
return sendMessage (content , null , safetySettings );
@@ -263,6 +279,7 @@ public GenerateContentResponse sendMessage(Content content, List<SafetySetting>
263
279
* @param safetySettings the safety settings.
264
280
* @return a response.
265
281
*/
282
+ @ BetaApi
266
283
public GenerateContentResponse sendMessage (
267
284
Content content , GenerationConfig generationConfig , List <SafetySetting > safetySettings )
268
285
throws IOException {
@@ -326,6 +343,7 @@ private void checkLastResponseAndEditHistory() throws IllegalStateException {
326
343
*
327
344
* @return an unmodifiable history of the conversation.
328
345
*/
346
+ @ BetaApi
329
347
public List <Content > getHistory () {
330
348
try {
331
349
checkLastResponseAndEditHistory ();
@@ -343,6 +361,7 @@ public List<Content> getHistory() {
343
361
}
344
362
345
363
/** Set the history to a list of Content */
364
+ @ BetaApi
346
365
public void setHistory (List <Content > history ) {
347
366
this .history = history ;
348
367
}
0 commit comments