Class ChatKitResponseOutputText.Annotation
-
- All Implemented Interfaces:
public final class ChatKitResponseOutputText.AnnotationAnnotation object describing a cited source.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceChatKitResponseOutputText.Annotation.VisitorAn interface that defines how to map each variant of Annotation to a value of type T.
public final classChatKitResponseOutputText.Annotation.FileAnnotation that references an uploaded file.
public final classChatKitResponseOutputText.Annotation.UrlAnnotation that references a URL.
-
Method Summary
Modifier and Type Method Description final Optional<ChatKitResponseOutputText.Annotation.File>file()Annotation that references an uploaded file. final Optional<ChatKitResponseOutputText.Annotation.Url>url()Annotation that references a URL. final BooleanisFile()final BooleanisUrl()final ChatKitResponseOutputText.Annotation.FileasFile()Annotation that references an uploaded file. final ChatKitResponseOutputText.Annotation.UrlasUrl()Annotation that references a URL. final Optional<JsonValue>_json()final <T extends Any> Taccept(ChatKitResponseOutputText.Annotation.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ChatKitResponseOutputText.Annotationvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ChatKitResponseOutputText.AnnotationofFile(ChatKitResponseOutputText.Annotation.File file)Annotation that references an uploaded file. final static ChatKitResponseOutputText.AnnotationofUrl(ChatKitResponseOutputText.Annotation.Url url)Annotation that references a URL. -
-
Method Detail
-
file
final Optional<ChatKitResponseOutputText.Annotation.File> file()
Annotation that references an uploaded file.
-
url
final Optional<ChatKitResponseOutputText.Annotation.Url> url()
Annotation that references a URL.
-
asFile
final ChatKitResponseOutputText.Annotation.File asFile()
Annotation that references an uploaded file.
-
asUrl
final ChatKitResponseOutputText.Annotation.Url asUrl()
Annotation that references a URL.
-
accept
final <T extends Any> T accept(ChatKitResponseOutputText.Annotation.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 = annotation.accept(new Annotation.Visitor<Optional<String>>() { @Override public Optional<String> visitFile(File file) { return Optional.of(file.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ChatKitResponseOutputText.Annotation 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.
-
ofFile
final static ChatKitResponseOutputText.Annotation ofFile(ChatKitResponseOutputText.Annotation.File file)
Annotation that references an uploaded file.
-
ofUrl
final static ChatKitResponseOutputText.Annotation ofUrl(ChatKitResponseOutputText.Annotation.Url url)
Annotation that references a URL.
-
-
-
-