Class ChatCompletionCreateParams.FunctionCall
-
- All Implemented Interfaces:
@Deprecated(message = "deprecated") public final class ChatCompletionCreateParams.FunctionCall
Deprecated in favor of
tool_choice.Controls which (if any) function is called by the model.
nonemeans the model will not call a function and instead generates a message.automeans the model can pick between generating a message or calling a function.Specifying a particular function via
{"name": "my_function"}forces the model to call that function.noneis the default when no functions are present.autois the default if functions are present.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceChatCompletionCreateParams.FunctionCall.VisitorAn interface that defines how to map each variant of FunctionCall to a value of type T.
public final classChatCompletionCreateParams.FunctionCall.FunctionCallModenonemeans the model will not call a function and instead generates a message.automeans the model can pick between generating a message or calling a function.
-
Method Summary
Modifier and Type Method Description final Optional<ChatCompletionCreateParams.FunctionCall.FunctionCallMode>mode()nonemeans the model will not call a function and instead generates a message.final Optional<ChatCompletionFunctionCallOption>functionCallOption()Specifying a particular function via {"name": "my_function"}forces the model to call that function.final BooleanisMode()final BooleanisFunctionCallOption()final ChatCompletionCreateParams.FunctionCall.FunctionCallModeasMode()nonemeans the model will not call a function and instead generates a message.final ChatCompletionFunctionCallOptionasFunctionCallOption()Specifying a particular function via {"name": "my_function"}forces the model to call that function.final Optional<JsonValue>_json()final <T extends Any> Taccept(ChatCompletionCreateParams.FunctionCall.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ChatCompletionCreateParams.FunctionCallvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ChatCompletionCreateParams.FunctionCallofMode(ChatCompletionCreateParams.FunctionCall.FunctionCallMode mode)nonemeans the model will not call a function and instead generates a message.final static ChatCompletionCreateParams.FunctionCallofFunctionCallOption(ChatCompletionFunctionCallOption functionCallOption)Specifying a particular function via {"name": "my_function"}forces the model to call that function.-
-
Method Detail
-
mode
final Optional<ChatCompletionCreateParams.FunctionCall.FunctionCallMode> mode()
nonemeans the model will not call a function and instead generates a message.automeans the model can pick between generating a message or calling a function.
-
functionCallOption
final Optional<ChatCompletionFunctionCallOption> functionCallOption()
Specifying a particular function via
{"name": "my_function"}forces the model to call that function.
-
isFunctionCallOption
final Boolean isFunctionCallOption()
-
asMode
final ChatCompletionCreateParams.FunctionCall.FunctionCallMode asMode()
nonemeans the model will not call a function and instead generates a message.automeans the model can pick between generating a message or calling a function.
-
asFunctionCallOption
final ChatCompletionFunctionCallOption asFunctionCallOption()
Specifying a particular function via
{"name": "my_function"}forces the model to call that function.
-
accept
final <T extends Any> T accept(ChatCompletionCreateParams.FunctionCall.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.openai.core.JsonValue; import java.util.Optional; Optional<String> result = functionCall.accept(new FunctionCall.Visitor<Optional<String>>() { @Override public Optional<String> visitMode(FunctionCallMode mode) { return Optional.of(mode.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ChatCompletionCreateParams.FunctionCall validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofMode
final static ChatCompletionCreateParams.FunctionCall ofMode(ChatCompletionCreateParams.FunctionCall.FunctionCallMode mode)
nonemeans the model will not call a function and instead generates a message.automeans the model can pick between generating a message or calling a function.
-
ofFunctionCallOption
final static ChatCompletionCreateParams.FunctionCall ofFunctionCallOption(ChatCompletionFunctionCallOption functionCallOption)
Specifying a particular function via
{"name": "my_function"}forces the model to call that function.
-
-
-
-