Class ToolCall
-
- All Implemented Interfaces:
public final class ToolCallDetails of the Code Interpreter tool call the run step was involved in.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceToolCall.VisitorAn interface that defines how to map each variant of ToolCall to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<CodeInterpreterToolCall>codeInterpreter()Details of the Code Interpreter tool call the run step was involved in. final Optional<FileSearchToolCall>fileSearch()final Optional<FunctionToolCall>function()final BooleanisCodeInterpreter()final BooleanisFileSearch()final BooleanisFunction()final CodeInterpreterToolCallasCodeInterpreter()Details of the Code Interpreter tool call the run step was involved in. final FileSearchToolCallasFileSearch()final FunctionToolCallasFunction()final Optional<JsonValue>_json()final <T extends Any> Taccept(ToolCall.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ToolCallvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ToolCallofCodeInterpreter(CodeInterpreterToolCall codeInterpreter)Details of the Code Interpreter tool call the run step was involved in. final static ToolCallofFileSearch(FileSearchToolCall fileSearch)final static ToolCallofFunction(FunctionToolCall function)-
-
Method Detail
-
codeInterpreter
final Optional<CodeInterpreterToolCall> codeInterpreter()
Details of the Code Interpreter tool call the run step was involved in.
-
fileSearch
final Optional<FileSearchToolCall> fileSearch()
-
function
final Optional<FunctionToolCall> function()
-
isCodeInterpreter
final Boolean isCodeInterpreter()
-
isFileSearch
final Boolean isFileSearch()
-
isFunction
final Boolean isFunction()
-
asCodeInterpreter
final CodeInterpreterToolCall asCodeInterpreter()
Details of the Code Interpreter tool call the run step was involved in.
-
asFileSearch
final FileSearchToolCall asFileSearch()
-
asFunction
final FunctionToolCall asFunction()
-
accept
final <T extends Any> T accept(ToolCall.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 = toolCall.accept(new ToolCall.Visitor<Optional<String>>() { @Override public Optional<String> visitCodeInterpreter(CodeInterpreterToolCall codeInterpreter) { return Optional.of(codeInterpreter.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ToolCall 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.
-
ofCodeInterpreter
final static ToolCall ofCodeInterpreter(CodeInterpreterToolCall codeInterpreter)
Details of the Code Interpreter tool call the run step was involved in.
-
ofFileSearch
final static ToolCall ofFileSearch(FileSearchToolCall fileSearch)
-
ofFunction
final static ToolCall ofFunction(FunctionToolCall function)
-
-
-
-