Skip to content

Commit 31f5e12

Browse files
BREAKING_CHANGE: [vertexai] remove GenerateContentConfig (#10576)
PiperOrigin-RevId: 617275853 Co-authored-by: Jaycee Li <jayceeli@google.com>
1 parent d514d9a commit 31f5e12

File tree

6 files changed

+20
-458
lines changed

6 files changed

+20
-458
lines changed

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

Lines changed: 4 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,7 @@ public ChatSession(GenerativeModel model) {
5353
*/
5454
@BetaApi
5555
public ResponseStream<GenerateContentResponse> sendMessageStream(String text) throws IOException {
56-
return sendMessageStream(text, GenerateContentConfig.newBuilder().build());
57-
}
58-
59-
/**
60-
* Sends a message to the model and returns a stream of responses.
61-
*
62-
* @param text the message to be sent.
63-
* @param config a {@link GenerateContentConfig} that contains all the configs for sending message
64-
* in a chat session.
65-
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
66-
* stream by stream() method.
67-
*/
68-
@BetaApi
69-
public ResponseStream<GenerateContentResponse> sendMessageStream(
70-
String text, GenerateContentConfig config) throws IOException {
71-
return sendMessageStream(ContentMaker.fromString(text), config);
56+
return sendMessageStream(ContentMaker.fromString(text));
7257
}
7358

7459
/**
@@ -81,25 +66,9 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
8166
@BetaApi
8267
public ResponseStream<GenerateContentResponse> sendMessageStream(Content content)
8368
throws IOException, IllegalArgumentException {
84-
return sendMessageStream(content, GenerateContentConfig.newBuilder().build());
85-
}
86-
87-
/**
88-
* Sends a message to the model and returns a stream of responses.
89-
*
90-
* @param content the content to be sent.
91-
* @param config a {@link GenerateContentConfig} that contains all the configs for sending message
92-
* in a chat session.
93-
* @return an iterable in which each element is a GenerateContentResponse. Can be converted to
94-
* stream by stream() method.
95-
*/
96-
@BetaApi
97-
public ResponseStream<GenerateContentResponse> sendMessageStream(
98-
Content content, GenerateContentConfig config) throws IOException {
9969
checkLastResponseAndEditHistory();
10070
history.add(content);
101-
ResponseStream<GenerateContentResponse> respStream =
102-
model.generateContentStream(history, config);
71+
ResponseStream<GenerateContentResponse> respStream = model.generateContentStream(history);
10372
currentResponseStream = respStream;
10473
currentResponse = null;
10574
return respStream;
@@ -113,21 +82,7 @@ public ResponseStream<GenerateContentResponse> sendMessageStream(
11382
*/
11483
@BetaApi
11584
public GenerateContentResponse sendMessage(String text) throws IOException {
116-
return sendMessage(text, GenerateContentConfig.newBuilder().build());
117-
}
118-
119-
/**
120-
* Sends a message to the model and returns a response.
121-
*
122-
* @param text the message to be sent.
123-
* @param config a {@link GenerateContentConfig} that contains all the configs for sending message
124-
* in a chat session.
125-
* @return a response.
126-
*/
127-
@BetaApi
128-
public GenerateContentResponse sendMessage(String text, GenerateContentConfig config)
129-
throws IOException {
130-
return sendMessage(ContentMaker.fromString(text), config);
85+
return sendMessage(ContentMaker.fromString(text));
13186
}
13287

13388
/**
@@ -138,23 +93,9 @@ public GenerateContentResponse sendMessage(String text, GenerateContentConfig co
13893
*/
13994
@BetaApi
14095
public GenerateContentResponse sendMessage(Content content) throws IOException {
141-
return sendMessage(content, GenerateContentConfig.newBuilder().build());
142-
}
143-
144-
/**
145-
* Sends a message to the model and returns a response.
146-
*
147-
* @param content the content to be sent.
148-
* @param config a {@link GenerateContentConfig} that contains all the configs for sending message
149-
* in a chat session.
150-
* @return a response.
151-
*/
152-
@BetaApi
153-
public GenerateContentResponse sendMessage(Content content, GenerateContentConfig config)
154-
throws IOException {
15596
checkLastResponseAndEditHistory();
15697
history.add(content);
157-
GenerateContentResponse response = model.generateContent(history, config);
98+
GenerateContentResponse response = model.generateContent(history);
15899
currentResponse = response;
159100
currentResponseStream = null;
160101
return response;

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

Lines changed: 0 additions & 122 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy