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.
This commit is contained in:
Mark Pollack
2024-12-21 19:38:01 -05:00
parent 8ad90621c4
commit cf846688af

View File

@@ -172,6 +172,86 @@ public interface FunctionCallingOptions extends ChatOptions {
@Override
Builder topP(Double topP);
/**
* @deprecated Use {@link #model(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withModel(String model) {
return model(model);
}
/**
* @deprecated Use {@link #frequencyPenalty(Double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withFrequencyPenalty(Double frequencyPenalty) {
return frequencyPenalty(frequencyPenalty);
}
/**
* @deprecated Use {@link #maxTokens(Integer)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withMaxTokens(Integer maxTokens) {
return maxTokens(maxTokens);
}
/**
* @deprecated Use {@link #presencePenalty(Double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withPresencePenalty(Double presencePenalty) {
return presencePenalty(presencePenalty);
}
/**
* @deprecated Use {@link #stopSequences(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withStopSequences(List<String> stopSequences) {
return stopSequences(stopSequences);
}
/**
* @deprecated Use {@link #temperature(Double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withTemperature(Double temperature) {
return temperature(temperature);
}
/**
* @deprecated Use {@link #functionCallbacks(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withFunctionCallbacks(List<FunctionCallback> functionCallbacks) {
return functionCallbacks(functionCallbacks);
}
/**
* @deprecated Use {@link #functionCallbacks(FunctionCallback...)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withFunctionCallbacks(FunctionCallback... functionCallbacks) {
return functionCallbacks(functionCallbacks);
}
/**
* @deprecated Use {@link #functions(Set)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withFunctions(Set<String> functions) {
return functions(functions);
}
/**
* @deprecated Use {@link #function(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withFunction(String function) {
return function(function);
}
}
}