Skip to content

Commit

Permalink
Add deprecated with* methods to FunctionCallingOptions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Mark Pollack committed Dec 22, 2024
1 parent 8ad9062 commit cf84668
Showing 1 changed file with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,86 @@ interface Builder extends ChatOptions.Builder {
@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);
}

}

}

0 comments on commit cf84668

Please sign in to comment.