@@ -58,7 +58,7 @@ public static class Builder implements ObjectBuilder<AnthropicGenerative> {
5858 private Integer maxTokens ;
5959 private Float temperature ;
6060 private String baseUrl ;
61- private final List <String > stopSequences = new ArrayList <>() ;
61+ private List <String > stopSequences ;
6262
6363 /** Base URL of the generative provider. */
6464 public Builder baseUrl (String baseUrl ) {
@@ -101,6 +101,9 @@ public Builder stopSequences(String... stopSequences) {
101101 * Set tokens which should signal the model to stop generating further output.
102102 */
103103 public Builder stopSequences (List <String > stopSequences ) {
104+ if (this .stopSequences == null ) {
105+ this .stopSequences = new ArrayList <>();
106+ }
104107 this .stopSequences .addAll (stopSequences );
105108 return this ;
106109 }
@@ -199,9 +202,9 @@ public static class Builder implements ObjectBuilder<AnthropicGenerative.Provide
199202 private String model ;
200203 private Integer maxTokens ;
201204 private Float temperature ;
202- private final List <String > stopSequences = new ArrayList <>() ;
203- private final List <String > images = new ArrayList <>() ;
204- private final List <String > imageProperties = new ArrayList <>() ;
205+ private List <String > stopSequences ;
206+ private List <String > images ;
207+ private List <String > imageProperties ;
205208
206209 /** Base URL of the generative provider. */
207210 public Builder baseUrl (String baseUrl ) {
@@ -244,6 +247,9 @@ public Builder stopSequences(String... stopSequences) {
244247 * Set tokens which should signal the model to stop generating further output.
245248 */
246249 public Builder stopSequences (List <String > stopSequences ) {
250+ if (this .stopSequences == null ) {
251+ this .stopSequences = new ArrayList <>();
252+ }
247253 this .stopSequences .addAll (stopSequences );
248254 return this ;
249255 }
@@ -253,6 +259,9 @@ public Builder images(String... images) {
253259 }
254260
255261 public Builder images (List <String > images ) {
262+ if (this .images == null ) {
263+ this .images = new ArrayList <>();
264+ }
256265 this .images .addAll (images );
257266 return this ;
258267 }
@@ -262,6 +271,9 @@ public Builder imageProperties(String... imageProperties) {
262271 }
263272
264273 public Builder imageProperties (List <String > imageProperties ) {
274+ if (this .imageProperties == null ) {
275+ this .imageProperties = new ArrayList <>();
276+ }
265277 this .imageProperties .addAll (imageProperties );
266278 return this ;
267279 }
0 commit comments