Skip to content

Commit 3938cc8

Browse files
youngmoneeemarkpollack
authored andcommitted
Remove setters from options interface
* Add test code
1 parent 7396597 commit 3938cc8

File tree

14 files changed

+114
-43
lines changed

14 files changed

+114
-43
lines changed

models/spring-ai-azure-openai/src/main/java/org/springframework/ai/azure/openai/AzureOpenAiChatOptions.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ public Float getTemperature() {
312312
return this.temperature;
313313
}
314314

315-
@Override
316315
public void setTemperature(Float temperature) {
317316
this.temperature = temperature;
318317
}
@@ -322,7 +321,6 @@ public Float getTopP() {
322321
return this.topP;
323322
}
324323

325-
@Override
326324
public void setTopP(Float topP) {
327325
this.topP = topP;
328326
}
@@ -333,7 +331,6 @@ public Integer getTopK() {
333331
throw new UnsupportedOperationException("Unimplemented method 'getTopK'");
334332
}
335333

336-
@Override
337334
@JsonIgnore
338335
public void setTopK(Integer topK) {
339336
throw new UnsupportedOperationException("Unimplemented method 'setTopK'");
@@ -344,7 +341,6 @@ public List<FunctionCallback> getFunctionCallbacks() {
344341
return this.functionCallbacks;
345342
}
346343

347-
@Override
348344
public void setFunctionCallbacks(List<FunctionCallback> functionCallbacks) {
349345
this.functionCallbacks = functionCallbacks;
350346
}
@@ -354,7 +350,6 @@ public Set<String> getFunctions() {
354350
return this.functions;
355351
}
356352

357-
@Override
358353
public void setFunctions(Set<String> functions) {
359354
this.functions = functions;
360355
}

models/spring-ai-bedrock/src/main/java/org/springframework/ai/bedrock/anthropic/AnthropicChatOptions.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ public Float getTemperature() {
119119
return this.temperature;
120120
}
121121

122-
@Override
123122
public void setTemperature(Float temperature) {
124123
this.temperature = temperature;
125124
}
@@ -137,7 +136,6 @@ public Integer getTopK() {
137136
return this.topK;
138137
}
139138

140-
@Override
141139
public void setTopK(Integer topK) {
142140
this.topK = topK;
143141
}
@@ -147,7 +145,6 @@ public Float getTopP() {
147145
return this.topP;
148146
}
149147

150-
@Override
151148
public void setTopP(Float topP) {
152149
this.topP = topP;
153150
}

models/spring-ai-bedrock/src/main/java/org/springframework/ai/bedrock/cohere/BedrockCohereChatOptions.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ public Float getTemperature() {
144144
return this.temperature;
145145
}
146146

147-
@Override
148147
public void setTemperature(Float temperature) {
149148
this.temperature = temperature;
150149
}
@@ -154,7 +153,6 @@ public Float getTopP() {
154153
return this.topP;
155154
}
156155

157-
@Override
158156
public void setTopP(Float topP) {
159157
this.topP = topP;
160158
}
@@ -164,7 +162,6 @@ public Integer getTopK() {
164162
return this.topK;
165163
}
166164

167-
@Override
168165
public void setTopK(Integer topK) {
169166
this.topK = topK;
170167
}

models/spring-ai-bedrock/src/main/java/org/springframework/ai/bedrock/llama2/BedrockLlama2ChatOptions.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ public Integer getTopK() {
105105
throw new UnsupportedOperationException("Unsupported option: 'TopK'");
106106
}
107107

108-
@Override
109108
@JsonIgnore
110109
public void setTopK(Integer topK) {
111110
throw new UnsupportedOperationException("Unsupported option: 'TopK'");

models/spring-ai-bedrock/src/main/java/org/springframework/ai/bedrock/titan/BedrockTitanChatOptions.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ public Integer getTopK() {
125125
throw new UnsupportedOperationException("Bedrock Titian Chat does not support the 'TopK' option.");
126126
}
127127

128-
@Override
129128
public void setTopK(Integer topK) {
130129
throw new UnsupportedOperationException("Bedrock Titian Chat does not support the 'TopK' option.'");
131130
}

models/spring-ai-mistral-ai/src/main/java/org/springframework/ai/mistralai/MistralAiChatOptions.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ public Float getTemperature() {
264264
return this.temperature;
265265
}
266266

267-
@Override
268267
public void setTemperature(Float temperature) {
269268
this.temperature = temperature;
270269
}
@@ -274,7 +273,6 @@ public Float getTopP() {
274273
return this.topP;
275274
}
276275

277-
@Override
278276
public void setTopP(Float topP) {
279277
this.topP = topP;
280278
}
@@ -285,7 +283,6 @@ public Integer getTopK() {
285283
throw new UnsupportedOperationException("Unsupported option: 'TopK'");
286284
}
287285

288-
@Override
289286
@JsonIgnore
290287
public void setTopK(Integer topK) {
291288
throw new UnsupportedOperationException("Unsupported option: 'TopK'");

models/spring-ai-openai/src/main/java/org/springframework/ai/openai/OpenAiChatOptions.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ public Float getTemperature() {
333333
return this.temperature;
334334
}
335335

336-
@Override
337336
public void setTemperature(Float temperature) {
338337
this.temperature = temperature;
339338
}
@@ -343,7 +342,6 @@ public Float getTopP() {
343342
return this.topP;
344343
}
345344

346-
@Override
347345
public void setTopP(Float topP) {
348346
this.topP = topP;
349347
}
@@ -387,7 +385,6 @@ public Set<String> getFunctions() {
387385
return functions;
388386
}
389387

390-
@Override
391388
public void setFunctions(Set<String> functionNames) {
392389
this.functions = functionNames;
393390
}
@@ -515,7 +512,6 @@ public Integer getTopK() {
515512
throw new UnsupportedOperationException("Unimplemented method 'getTopK'");
516513
}
517514

518-
@Override
519515
@JsonIgnore
520516
public void setTopK(Integer topK) {
521517
throw new UnsupportedOperationException("Unimplemented method 'setTopK'");

models/spring-ai-vertex-ai-gemini/src/main/java/org/springframework/ai/vertexai/gemini/VertexAiGeminiChatOptions.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ public Float getTemperature() {
190190
return this.temperature;
191191
}
192192

193-
@Override
194193
public void setTemperature(Float temperature) {
195194
this.temperature = temperature;
196195
}
@@ -200,7 +199,6 @@ public Float getTopP() {
200199
return this.topP;
201200
}
202201

203-
@Override
204202
public void setTopP(Float topP) {
205203
this.topP = topP;
206204
}
@@ -215,7 +213,6 @@ public void setTopK(Float topK) {
215213
this.topK = topK;
216214
}
217215

218-
@Override
219216
@JsonIgnore
220217
public void setTopK(Integer topK) {
221218
this.topK = (topK != null) ? topK.floatValue() : null;

models/spring-ai-vertex-ai-palm2/src/main/java/org/springframework/ai/vertexai/palm2/VertexAiPaLm2ChatOptions.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ public Float getTemperature() {
9898
return this.temperature;
9999
}
100100

101-
@Override
102101
public void setTemperature(Float temperature) {
103102
this.temperature = temperature;
104103
}
@@ -116,7 +115,6 @@ public Float getTopP() {
116115
return this.topP;
117116
}
118117

119-
@Override
120118
public void setTopP(Float topP) {
121119
this.topP = topP;
122120
}
@@ -126,7 +124,6 @@ public Integer getTopK() {
126124
return this.topK;
127125
}
128126

129-
@Override
130127
public void setTopK(Integer topK) {
131128
this.topK = topK;
132129
}

spring-ai-core/src/main/java/org/springframework/ai/chat/prompt/ChatOptions.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,8 @@ public interface ChatOptions extends ModelOptions {
2525

2626
Float getTemperature();
2727

28-
void setTemperature(Float temperature);
29-
3028
Float getTopP();
3129

32-
void setTopP(Float topP);
33-
3430
Integer getTopK();
3531

36-
void setTopK(Integer topK);
37-
3832
}

spring-ai-core/src/main/java/org/springframework/ai/chat/prompt/ChatOptionsBuilder.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public Float getTemperature() {
3131
return temperature;
3232
}
3333

34-
@Override
3534
public void setTemperature(Float temperature) {
3635
this.temperature = temperature;
3736
}
@@ -41,7 +40,6 @@ public Float getTopP() {
4140
return topP;
4241
}
4342

44-
@Override
4543
public void setTopP(Float topP) {
4644
this.topP = topP;
4745
}
@@ -51,7 +49,6 @@ public Integer getTopK() {
5149
return topK;
5250
}
5351

54-
@Override
5552
public void setTopK(Integer topK) {
5653
this.topK = topK;
5754
}
@@ -86,4 +83,4 @@ public ChatOptions build() {
8683
return options;
8784
}
8885

89-
}
86+
}

spring-ai-core/src/main/java/org/springframework/ai/model/function/FunctionCallingOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ public static FunctionCallingOptionsBuilder builder() {
6363
return new FunctionCallingOptionsBuilder();
6464
}
6565

66-
}
66+
}

spring-ai-core/src/main/java/org/springframework/ai/model/function/FunctionCallingOptionsBuilder.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ public List<FunctionCallback> getFunctionCallbacks() {
9898
return this.functionCallbacks;
9999
}
100100

101-
@Override
102101
public void setFunctionCallbacks(List<FunctionCallback> functionCallbacks) {
103102
Assert.notNull(functionCallbacks, "FunctionCallbacks must not be null");
104103
this.functionCallbacks = functionCallbacks;
@@ -109,7 +108,6 @@ public Set<String> getFunctions() {
109108
return this.functions;
110109
}
111110

112-
@Override
113111
public void setFunctions(Set<String> functions) {
114112
Assert.notNull(functions, "Functions must not be null");
115113
this.functions = functions;
@@ -120,7 +118,6 @@ public Float getTemperature() {
120118
return this.temperature;
121119
}
122120

123-
@Override
124121
public void setTemperature(Float temperature) {
125122
this.temperature = temperature;
126123
}
@@ -130,7 +127,6 @@ public Float getTopP() {
130127
return this.topP;
131128
}
132129

133-
@Override
134130
public void setTopP(Float topP) {
135131
this.topP = topP;
136132
}
@@ -140,11 +136,10 @@ public Integer getTopK() {
140136
return this.topK;
141137
}
142138

143-
@Override
144139
public void setTopK(Integer topK) {
145140
this.topK = topK;
146141
}
147142

148143
}
149144

150-
}
145+
}

0 commit comments

Comments
 (0)