File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public ChatSession withSafetySettings(List<SafetySetting> safetySettings) {
92
92
ChatSession rootChat = rootChatSession .orElse (this );
93
93
ChatSession newChatSession =
94
94
new ChatSession (model .withSafetySettings (safetySettings ), Optional .of (rootChat ));
95
- newChatSession .setHistory ( history ) ;
95
+ newChatSession .history = history ;
96
96
return newChatSession ;
97
97
}
98
98
@@ -106,7 +106,7 @@ public ChatSession withSafetySettings(List<SafetySetting> safetySettings) {
106
106
public ChatSession withTools (List <Tool > tools ) {
107
107
ChatSession rootChat = rootChatSession .orElse (this );
108
108
ChatSession newChatSession = new ChatSession (model .withTools (tools ), Optional .of (rootChat ));
109
- newChatSession .setHistory ( history ) ;
109
+ newChatSession .history = history ;
110
110
return newChatSession ;
111
111
}
112
112
@@ -253,7 +253,7 @@ private Optional<ResponseStream<GenerateContentResponse>> getCurrentResponseStre
253
253
254
254
/** Set the history to a list of Content */
255
255
public void setHistory (List <Content > history ) {
256
- this .history = history ;
256
+ this .history = new ArrayList <>( history ) ;
257
257
}
258
258
259
259
/** Sets the current response of the root chat session (if exists) or the current chat session. */
You can’t perform that action at this time.
0 commit comments