Skip to content

Commit 7cf463b

Browse files
copybara-service[bot]Zhenyi Qi
andauthored
docs: [vertexai] Mark generateContent variants with GenerationConfig and List<SafetySetting> as deprecated. (#10474)
PiperOrigin-RevId: 612859526 Co-authored-by: Zhenyi Qi <zhenyiqi@google.com>
1 parent bcec849 commit 7cf463b

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ChatSession.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
8080
* @param generationConfig the generation config.
8181
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
8282
* stream by stream() method.
83+
* @deprecated use {@link #sendMessageStream(String, GenerateContentConfig)} instead
8384
*/
8485
@BetaApi
86+
@Deprecated
8587
public ResponseStream<GenerateContentResponse> sendMessageStream(
8688
String text, GenerationConfig generationConfig) throws IOException {
8789
return sendMessageStream(text, generationConfig, null);
@@ -94,8 +96,10 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
9496
* @param safetySettings the safety settings.
9597
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
9698
* stream by stream() method.
99+
* @deprecated use {@link #sendMessageStream(String, GenerateContentConfig)} instead
97100
*/
98101
@BetaApi("safetySettings is a preview feature.")
102+
@Deprecated
99103
public ResponseStream<GenerateContentResponse> sendMessageStream(
100104
String text, List<SafetySetting> safetySettings) throws IOException {
101105
return sendMessageStream(text, null, safetySettings);
@@ -109,8 +113,10 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
109113
* @param safetySettings the safety settings.
110114
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
111115
* stream by stream() method.
116+
* @deprecated use {@link #sendMessageStream(String, GenerateContentConfig)} instead
112117
*/
113118
@BetaApi("safetySettings is a preview feature.")
119+
@Deprecated
114120
public ResponseStream<GenerateContentResponse> sendMessageStream(
115121
String text, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
116122
throws IOException {
@@ -166,8 +172,10 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
166172
* @param generationConfig the generation config.
167173
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
168174
* stream by stream() method.
175+
* @deprecated use {@link #sendMessageStream(Content, GenerateContentConfig)} instead
169176
*/
170177
@BetaApi
178+
@Deprecated
171179
public ResponseStream<GenerateContentResponse> sendMessageStream(
172180
Content content, GenerationConfig generationConfig)
173181
throws IOException, IllegalArgumentException {
@@ -181,8 +189,10 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
181189
* @param safetySettings the safety settings.
182190
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
183191
* stream by stream() method.
192+
* @deprecated use {@link #sendMessageStream(Content, GenerateContentConfig)} instead
184193
*/
185194
@BetaApi("safetySettings is a preview feature.")
195+
@Deprecated
186196
public ResponseStream<GenerateContentResponse> sendMessageStream(
187197
Content content, List<SafetySetting> safetySettings)
188198
throws IOException, IllegalArgumentException {
@@ -197,8 +207,10 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
197207
* @param safetySettings the safety settings.
198208
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
199209
* stream by stream() method.
210+
* @deprecated use {@link #sendMessageStream(Content, GenerateContentConfig)} instead
200211
*/
201212
@BetaApi("safetySettings is a preview feature.")
213+
@Deprecated
202214
public ResponseStream<GenerateContentResponse> sendMessageStream(
203215
Content content, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
204216
throws IOException {
@@ -243,8 +255,10 @@ public GenerateContentResponse sendMessage(String text, GenerateContentConfig co
243255
* @param text the message to be sent.
244256
* @param generationConfig the generation config.
245257
* @return a response.
258+
* @deprecated use {@link #sendMessage(Content, GenerateContentConfig)} instead
246259
*/
247260
@BetaApi
261+
@Deprecated
248262
public GenerateContentResponse sendMessage(String text, GenerationConfig generationConfig)
249263
throws IOException {
250264
return sendMessage(text, generationConfig, null);
@@ -256,8 +270,10 @@ public GenerateContentResponse sendMessage(String text, GenerationConfig generat
256270
* @param text the message to be sent.
257271
* @param safetySettings the safety settings.
258272
* @return a response.
273+
* @deprecated use {@link #sendMessage(String, GenerateContentConfig)} instead
259274
*/
260275
@BetaApi("safetySettings is a preview feature.")
276+
@Deprecated
261277
public GenerateContentResponse sendMessage(String text, List<SafetySetting> safetySettings)
262278
throws IOException {
263279
return sendMessage(text, null, safetySettings);
@@ -270,8 +286,10 @@ public GenerateContentResponse sendMessage(String text, List<SafetySetting> safe
270286
* @param generationConfig the generation config.
271287
* @param safetySettings the safety settings.
272288
* @return a response.
289+
* @deprecated use {@link #sendMessage(String, GenerateContentConfig)} instead
273290
*/
274291
@BetaApi("Both sendMessage and safetySettings are preview features.")
292+
@Deprecated
275293
public GenerateContentResponse sendMessage(
276294
String text, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
277295
throws IOException {
@@ -321,8 +339,10 @@ public GenerateContentResponse sendMessage(Content content, GenerateContentConfi
321339
* @param content the content to be sent.
322340
* @param generationConfig the generation config.
323341
* @return a response.
342+
* @deprecated use {@link #sendMessage(Content, GenerateContentConfig)} instead
324343
*/
325344
@BetaApi
345+
@Deprecated
326346
public GenerateContentResponse sendMessage(Content content, GenerationConfig generationConfig)
327347
throws IOException {
328348
return sendMessage(content, generationConfig, null);
@@ -334,8 +354,10 @@ public GenerateContentResponse sendMessage(Content content, GenerationConfig gen
334354
* @param content the content to be sent.
335355
* @param safetySettings the safety settings.
336356
* @return a response.
357+
* @deprecated use {@link #sendMessage(Content, GenerateContentConfig)} instead
337358
*/
338359
@BetaApi("Both sendMessage and safetySettings are preview features.")
360+
@Deprecated
339361
public GenerateContentResponse sendMessage(Content content, List<SafetySetting> safetySettings)
340362
throws IOException {
341363
return sendMessage(content, null, safetySettings);
@@ -348,8 +370,10 @@ public GenerateContentResponse sendMessage(Content content, List<SafetySetting>
348370
* @param generationConfig the generation config.
349371
* @param safetySettings the safety settings.
350372
* @return a response.
373+
* @deprecated use {@link #sendMessage(Content, GenerateContentConfig)} instead
351374
*/
352375
@BetaApi("Both sendMessage and safetySettings are preview features.")
376+
@Deprecated
353377
public GenerateContentResponse sendMessage(
354378
Content content, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
355379
throws IOException {

java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/GenerativeModel.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,10 @@ public GenerateContentResponse generateContent(String text, GenerateContentConfi
434434
* @return a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance that contains
435435
* response contents and other metadata
436436
* @throws IOException if an I/O error occurs while making the API call
437+
* @deprecated use {@link #generateContent(String, GenerateContentConfig)} instead
437438
*/
438439
@BetaApi
440+
@Deprecated
439441
public GenerateContentResponse generateContent(String text, GenerationConfig generationConfig)
440442
throws IOException {
441443
return generateContent(text, generationConfig, null);
@@ -450,8 +452,10 @@ public GenerateContentResponse generateContent(String text, GenerationConfig gen
450452
* @return a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance that contains
451453
* response contents and other metadata
452454
* @throws IOException if an I/O error occurs while making the API call
455+
* @deprecated use {@link #generateContent(String, GenerateContentConfig)} instead
453456
*/
454457
@BetaApi("Both generateContent and safetySettings are preview features.")
458+
@Deprecated
455459
public GenerateContentResponse generateContent(String text, List<SafetySetting> safetySettings)
456460
throws IOException {
457461
return generateContent(text, null, safetySettings);
@@ -468,8 +472,10 @@ public GenerateContentResponse generateContent(String text, List<SafetySetting>
468472
* @return a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance that contains
469473
* response contents and other metadata
470474
* @throws IOException if an I/O error occurs while making the API call
475+
* @deprecated use {@link #generateContent(String, GenerateContentConfig)} instead
471476
*/
472477
@BetaApi("Both generateContent and safetySettings are preview features.")
478+
@Deprecated
473479
public GenerateContentResponse generateContent(
474480
String text, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
475481
throws IOException {
@@ -503,8 +509,10 @@ public GenerateContentResponse generateContent(List<Content> contents) throws IO
503509
* @return a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance that contains
504510
* response contents and other metadata
505511
* @throws IOException if an I/O error occurs while making the API call
512+
* @deprecated use {@link #generateContent(List<Content>, GenerateContentConfig)} instead
506513
*/
507514
@BetaApi("generateContent is a preview feature.")
515+
@Deprecated
508516
public GenerateContentResponse generateContent(
509517
List<Content> contents, GenerationConfig generationConfig) throws IOException {
510518
return generateContent(contents, generationConfig, null);
@@ -520,8 +528,10 @@ public GenerateContentResponse generateContent(
520528
* @return a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance that contains
521529
* response contents and other metadata
522530
* @throws IOException if an I/O error occurs while making the API call
531+
* @deprecated use {@link #generateContent(List<Content>, GenerateContentConfig)} instead
523532
*/
524533
@BetaApi("Both generateContent and safetySettings are preview features")
534+
@Deprecated
525535
public GenerateContentResponse generateContent(
526536
List<Content> contents, List<SafetySetting> safetySettings) throws IOException {
527537
return generateContent(contents, null, safetySettings);
@@ -575,8 +585,10 @@ public GenerateContentResponse generateContent(
575585
* @return a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance that contains
576586
* response contents and other metadata
577587
* @throws IOException if an I/O error occurs while making the API call
588+
* @deprecated use {@link #generateContent(List<Content>, GenerateContentConfig)} instead
578589
*/
579590
@BetaApi("Both generateContent and safetySettings are preview features")
591+
@Deprecated
580592
public GenerateContentResponse generateContent(
581593
List<Content> contents, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
582594
throws IOException {
@@ -657,8 +669,10 @@ public GenerateContentResponse generateContent(Content content, GenerateContentC
657669
* @return a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance that contains
658670
* response contents and other metadata
659671
* @throws IOException if an I/O error occurs while making the API call
672+
* @deprecated use {@link #generateContent(Content, GenerateContentConfig)} instead
660673
*/
661674
@BetaApi("generateContent is a preview feature.")
675+
@Deprecated
662676
public GenerateContentResponse generateContent(Content content, GenerationConfig generationConfig)
663677
throws IOException {
664678
return generateContent(content, generationConfig, null);
@@ -673,8 +687,10 @@ public GenerateContentResponse generateContent(Content content, GenerationConfig
673687
* @return a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance that contains
674688
* response contents and other metadata
675689
* @throws IOException if an I/O error occurs while making the API call
690+
* @deprecated use {@link #generateContent(Content, GenerateContentConfig)} instead
676691
*/
677692
@BetaApi("generateContent is a preview feature.")
693+
@Deprecated
678694
public GenerateContentResponse generateContent(
679695
Content content, List<SafetySetting> safetySettings) throws IOException {
680696
return generateContent(content, null, safetySettings);
@@ -692,8 +708,10 @@ public GenerateContentResponse generateContent(
692708
* @return a {@link com.google.cloud.vertexai.api.GenerateContentResponse} instance that contains
693709
* response contents and other metadata
694710
* @throws IOException if an I/O error occurs while making the API call
711+
* @deprecated use {@link #generateContent(Content, GenerateContentConfig)} instead
695712
*/
696713
@BetaApi("Both generateContent and safetySettings are preview features.")
714+
@Deprecated
697715
public GenerateContentResponse generateContent(
698716
Content content, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
699717
throws IOException {
@@ -738,8 +756,10 @@ public ResponseStream<GenerateContentResponse> generateContentStream(
738756
* @return a {@link ResponseStream} that contains a streaming of {@link
739757
* com.google.cloud.vertexai.api.GenerateContentResponse}
740758
* @throws IOException if an I/O error occurs while making the API call
759+
* @deprecated use {@link #generateContentStream(String, GenerateContentConfig)} instead
741760
*/
742761
@BetaApi
762+
@Deprecated
743763
public ResponseStream<GenerateContentResponse> generateContentStream(
744764
String text, GenerationConfig generationConfig) throws IOException {
745765
return generateContentStream(text, generationConfig, null);
@@ -754,8 +774,10 @@ public ResponseStream<GenerateContentResponse> generateContentStream(
754774
* @return a {@link ResponseStream} that contains a streaming of {@link
755775
* com.google.cloud.vertexai.api.GenerateContentResponse}
756776
* @throws IOException if an I/O error occurs while making the API call
777+
* @deprecated use {@link #generateContentStream(String, GenerateContentConfig)} instead
757778
*/
758779
@BetaApi("safetySettings is a preview feature.")
780+
@Deprecated
759781
public ResponseStream<GenerateContentResponse> generateContentStream(
760782
String text, List<SafetySetting> safetySettings) throws IOException {
761783
return generateContentStream(text, null, safetySettings);
@@ -773,8 +795,10 @@ public ResponseStream<GenerateContentResponse> generateContentStream(
773795
* @return a {@link ResponseStream} that contains a streaming of {@link
774796
* com.google.cloud.vertexai.api.GenerateContentResponse}
775797
* @throws IOException if an I/O error occurs while making the API call
798+
* @deprecated use {@link #generateContentStream(String, GenerateContentConfig)} instead
776799
*/
777800
@BetaApi("safetySettings is a preview feature.")
801+
@Deprecated
778802
public ResponseStream<GenerateContentResponse> generateContentStream(
779803
String text, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
780804
throws IOException {
@@ -824,8 +848,10 @@ public ResponseStream<GenerateContentResponse> generateContentStream(
824848
* @return a {@link ResponseStream} that contains a streaming of {@link
825849
* com.google.cloud.vertexai.api.GenerateContentResponse}
826850
* @throws IOException if an I/O error occurs while making the API call
851+
* @deprecated use {@link #generateContentStream(Content, GenerateContentConfig)} instead
827852
*/
828853
@BetaApi
854+
@Deprecated
829855
public ResponseStream<GenerateContentResponse> generateContentStream(
830856
Content content, GenerationConfig generationConfig) throws IOException {
831857
return generateContentStream(content, generationConfig, null);
@@ -841,8 +867,10 @@ public ResponseStream<GenerateContentResponse> generateContentStream(
841867
* @return a {@link ResponseStream} that contains a streaming of {@link
842868
* com.google.cloud.vertexai.api.GenerateContentResponse}
843869
* @throws IOException if an I/O error occurs while making the API call
870+
* @deprecated use {@link #generateContentStream(Content, GenerateContentConfig)} instead
844871
*/
845872
@BetaApi("safetySettings is a preview feature.")
873+
@Deprecated
846874
public ResponseStream<GenerateContentResponse> generateContentStream(
847875
Content content, List<SafetySetting> safetySettings) throws IOException {
848876
return generateContentStream(content, null, safetySettings);
@@ -860,8 +888,10 @@ public ResponseStream<GenerateContentResponse> generateContentStream(
860888
* @return a {@link ResponseStream} that contains a streaming of {@link
861889
* com.google.cloud.vertexai.api.GenerateContentResponse}
862890
* @throws IOException if an I/O error occurs while making the API call
891+
* @deprecated use {@link #generateContentStream(Content, GenerateContentConfig)} instead
863892
*/
864893
@BetaApi("safetySettings is a preview feature.")
894+
@Deprecated
865895
public ResponseStream<GenerateContentResponse> generateContentStream(
866896
Content content, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
867897
throws IOException {
@@ -893,8 +923,10 @@ public ResponseStream<GenerateContentResponse> generateContentStream(List<Conten
893923
* @return a {@link ResponseStream} that contains a streaming of {@link
894924
* com.google.cloud.vertexai.api.GenerateContentResponse}
895925
* @throws IOException if an I/O error occurs while making the API call
926+
* @deprecated use {@link #generateContentStream(List<Content>, GenerateContentConfig)} instead
896927
*/
897928
@BetaApi
929+
@Deprecated
898930
public ResponseStream<GenerateContentResponse> generateContentStream(
899931
List<Content> contents, GenerationConfig generationConfig) throws IOException {
900932
return generateContentStream(contents, generationConfig, null);
@@ -911,8 +943,10 @@ public ResponseStream<GenerateContentResponse> generateContentStream(
911943
* @return a {@link ResponseStream} that contains a streaming of {@link
912944
* com.google.cloud.vertexai.api.GenerateContentResponse}
913945
* @throws IOException if an I/O error occurs while making the API call
946+
* @deprecated use {@link #generateContentStream(List<Content>, GenerateContentConfig)} instead
914947
*/
915948
@BetaApi("safetySettings is a preview feature.")
949+
@Deprecated
916950
public ResponseStream<GenerateContentResponse> generateContentStream(
917951
List<Content> contents, List<SafetySetting> safetySettings) throws IOException {
918952
return generateContentStream(contents, null, safetySettings);
@@ -931,8 +965,10 @@ public ResponseStream<GenerateContentResponse> generateContentStream(
931965
* @return a {@link ResponseStream} that contains a streaming of {@link
932966
* com.google.cloud.vertexai.api.GenerateContentResponse}
933967
* @throws IOException if an I/O error occurs while making the API call
968+
* @deprecated use {@link #generateContentStream(List<Content>, GenerateContentConfig)} instead
934969
*/
935970
@BetaApi("safetySettings is a preview feature.")
971+
@Deprecated
936972
public ResponseStream<GenerateContentResponse> generateContentStream(
937973
List<Content> contents, GenerationConfig generationConfig, List<SafetySetting> safetySettings)
938974
throws IOException {

0 commit comments

Comments
 (0)