Package com.openai.models.beta.threads
Class ThreadCreateAndRunParams.Thread.Message.Attachment.Tool
-
- All Implemented Interfaces:
public final class ThreadCreateAndRunParams.Thread.Message.Attachment.Tool
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceThreadCreateAndRunParams.Thread.Message.Attachment.Tool.VisitorAn interface that defines how to map each variant of Tool to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<CodeInterpreterTool>codeInterpreter()final Optional<JsonValue>fileSearch()final BooleanisCodeInterpreter()final BooleanisFileSearch()final CodeInterpreterToolasCodeInterpreter()final JsonValueasFileSearch()final Optional<JsonValue>_json()final <T extends Any> Taccept(ThreadCreateAndRunParams.Thread.Message.Attachment.Tool.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ThreadCreateAndRunParams.Thread.Message.Attachment.Toolvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ThreadCreateAndRunParams.Thread.Message.Attachment.ToolofCodeInterpreter(CodeInterpreterTool codeInterpreter)final static ThreadCreateAndRunParams.Thread.Message.Attachment.ToolofFileSearch()-
-
Method Detail
-
codeInterpreter
final Optional<CodeInterpreterTool> codeInterpreter()
-
fileSearch
final Optional<JsonValue> fileSearch()
-
isCodeInterpreter
final Boolean isCodeInterpreter()
-
isFileSearch
final Boolean isFileSearch()
-
asCodeInterpreter
final CodeInterpreterTool asCodeInterpreter()
-
asFileSearch
final JsonValue asFileSearch()
-
accept
final <T extends Any> T accept(ThreadCreateAndRunParams.Thread.Message.Attachment.Tool.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 = tool.accept(new Tool.Visitor<Optional<String>>() { @Override public Optional<String> visitCodeInterpreter(CodeInterpreterTool codeInterpreter) { return Optional.of(codeInterpreter.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ThreadCreateAndRunParams.Thread.Message.Attachment.Tool 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 ThreadCreateAndRunParams.Thread.Message.Attachment.Tool ofCodeInterpreter(CodeInterpreterTool codeInterpreter)
-
ofFileSearch
final static ThreadCreateAndRunParams.Thread.Message.Attachment.Tool ofFileSearch()
-
-
-
-