Skip to content

Commit cf84668

Browse files
committed
Add deprecated with* methods to FunctionCallingOptions
Add backwards compatibility methods from FunctionCallingOptionsBuilder to the Builder interface in FunctionCallingOptions. This allows users to gradually migrate from the old builder style (with* methods) to the new style while maintaining the same functionality. Each deprecated method is marked for removal in 1.0.0-M5 and includes proper Javadoc directing users to the new method names. The methods are implemented as default methods that delegate to their new counterparts.
1 parent 8ad9062 commit cf84668

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

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

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,86 @@ interface Builder extends ChatOptions.Builder {
172172
@Override
173173
Builder topP(Double topP);
174174

175+
/**
176+
* @deprecated Use {@link #model(String)} instead.
177+
*/
178+
@Deprecated(forRemoval = true, since = "1.0.0-M5")
179+
default Builder withModel(String model) {
180+
return model(model);
181+
}
182+
183+
/**
184+
* @deprecated Use {@link #frequencyPenalty(Double)} instead.
185+
*/
186+
@Deprecated(forRemoval = true, since = "1.0.0-M5")
187+
default Builder withFrequencyPenalty(Double frequencyPenalty) {
188+
return frequencyPenalty(frequencyPenalty);
189+
}
190+
191+
/**
192+
* @deprecated Use {@link #maxTokens(Integer)} instead.
193+
*/
194+
@Deprecated(forRemoval = true, since = "1.0.0-M5")
195+
default Builder withMaxTokens(Integer maxTokens) {
196+
return maxTokens(maxTokens);
197+
}
198+
199+
/**
200+
* @deprecated Use {@link #presencePenalty(Double)} instead.
201+
*/
202+
@Deprecated(forRemoval = true, since = "1.0.0-M5")
203+
default Builder withPresencePenalty(Double presencePenalty) {
204+
return presencePenalty(presencePenalty);
205+
}
206+
207+
/**
208+
* @deprecated Use {@link #stopSequences(List)} instead.
209+
*/
210+
@Deprecated(forRemoval = true, since = "1.0.0-M5")
211+
default Builder withStopSequences(List<String> stopSequences) {
212+
return stopSequences(stopSequences);
213+
}
214+
215+
/**
216+
* @deprecated Use {@link #temperature(Double)} instead.
217+
*/
218+
@Deprecated(forRemoval = true, since = "1.0.0-M5")
219+
default Builder withTemperature(Double temperature) {
220+
return temperature(temperature);
221+
}
222+
223+
/**
224+
* @deprecated Use {@link #functionCallbacks(List)} instead.
225+
*/
226+
@Deprecated(forRemoval = true, since = "1.0.0-M5")
227+
default Builder withFunctionCallbacks(List<FunctionCallback> functionCallbacks) {
228+
return functionCallbacks(functionCallbacks);
229+
}
230+
231+
/**
232+
* @deprecated Use {@link #functionCallbacks(FunctionCallback...)} instead.
233+
*/
234+
@Deprecated(forRemoval = true, since = "1.0.0-M5")
235+
default Builder withFunctionCallbacks(FunctionCallback... functionCallbacks) {
236+
return functionCallbacks(functionCallbacks);
237+
}
238+
239+
/**
240+
* @deprecated Use {@link #functions(Set)} instead.
241+
*/
242+
@Deprecated(forRemoval = true, since = "1.0.0-M5")
243+
default Builder withFunctions(Set<String> functions) {
244+
return functions(functions);
245+
}
246+
247+
/**
248+
* @deprecated Use {@link #function(String)} instead.
249+
*/
250+
@Deprecated(forRemoval = true, since = "1.0.0-M5")
251+
default Builder withFunction(String function) {
252+
return function(function);
253+
}
254+
175255
}
176256

177257
}

0 commit comments

Comments
 (0)