Class ChatCompletionMessageToolCall
-
- All Implemented Interfaces:
public final class ChatCompletionMessageToolCallA call to a function tool created by the model.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceChatCompletionMessageToolCall.VisitorAn interface that defines how to map each variant of ChatCompletionMessageToolCall to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<ChatCompletionMessageFunctionToolCall>function()A call to a function tool created by the model. final Optional<ChatCompletionMessageCustomToolCall>custom()A call to a custom tool created by the model. final BooleanisFunction()final BooleanisCustom()final ChatCompletionMessageFunctionToolCallasFunction()A call to a function tool created by the model. final ChatCompletionMessageCustomToolCallasCustom()A call to a custom tool created by the model. final Optional<JsonValue>_json()final <T extends Any> Taccept(ChatCompletionMessageToolCall.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ChatCompletionMessageToolCallvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ChatCompletionMessageToolCallofFunction(ChatCompletionMessageFunctionToolCall function)A call to a function tool created by the model. final static ChatCompletionMessageToolCallofCustom(ChatCompletionMessageCustomToolCall custom)A call to a custom tool created by the model. -
-
Method Detail
-
function
final Optional<ChatCompletionMessageFunctionToolCall> function()
A call to a function tool created by the model.
-
custom
final Optional<ChatCompletionMessageCustomToolCall> custom()
A call to a custom tool created by the model.
-
isFunction
final Boolean isFunction()
-
asFunction
final ChatCompletionMessageFunctionToolCall asFunction()
A call to a function tool created by the model.
-
asCustom
final ChatCompletionMessageCustomToolCall asCustom()
A call to a custom tool created by the model.
-
accept
final <T extends Any> T accept(ChatCompletionMessageToolCall.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 = chatCompletionMessageToolCall.accept(new ChatCompletionMessageToolCall.Visitor<Optional<String>>() { @Override public Optional<String> visitFunction(ChatCompletionMessageFunctionToolCall function) { return Optional.of(function.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ChatCompletionMessageToolCall 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.
-
ofFunction
final static ChatCompletionMessageToolCall ofFunction(ChatCompletionMessageFunctionToolCall function)
A call to a function tool created by the model.
-
ofCustom
final static ChatCompletionMessageToolCall ofCustom(ChatCompletionMessageCustomToolCall custom)
A call to a custom tool created by the model.
-
-
-
-