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) {
9292 ChatSession rootChat = rootChatSession .orElse (this );
9393 ChatSession newChatSession =
9494 new ChatSession (model .withSafetySettings (safetySettings ), Optional .of (rootChat ));
95- newChatSession .setHistory ( history ) ;
95+ newChatSession .history = history ;
9696 return newChatSession ;
9797 }
9898
@@ -106,7 +106,7 @@ public ChatSession withSafetySettings(List<SafetySetting> safetySettings) {
106106 public ChatSession withTools (List <Tool > tools ) {
107107 ChatSession rootChat = rootChatSession .orElse (this );
108108 ChatSession newChatSession = new ChatSession (model .withTools (tools ), Optional .of (rootChat ));
109- newChatSession .setHistory ( history ) ;
109+ newChatSession .history = history ;
110110 return newChatSession ;
111111 }
112112
@@ -253,7 +253,7 @@ private Optional<ResponseStream<GenerateContentResponse>> getCurrentResponseStre
253253
254254 /** Set the history to a list of Content */
255255 public void setHistory (List <Content > history ) {
256- this .history = history ;
256+ this .history = new ArrayList <>( history ) ;
257257 }
258258
259259 /** 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