Class ResponseOutputText.Annotation
-
- All Implemented Interfaces:
public final class ResponseOutputText.AnnotationAn annotation that applies to a span of output text.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceResponseOutputText.Annotation.VisitorAn interface that defines how to map each variant of Annotation to a value of type T.
public final classResponseOutputText.Annotation.FileCitationA citation to a file.
public final classResponseOutputText.Annotation.UrlCitationA citation for a web resource used to generate a model response.
public final classResponseOutputText.Annotation.ContainerFileCitationA citation for a container file used to generate a model response.
public final classResponseOutputText.Annotation.FilePathA path to a file.
-
Method Summary
-
-
Method Detail
-
fileCitation
final Optional<ResponseOutputText.Annotation.FileCitation> fileCitation()
A citation to a file.
-
urlCitation
final Optional<ResponseOutputText.Annotation.UrlCitation> urlCitation()
A citation for a web resource used to generate a model response.
-
containerFileCitation
final Optional<ResponseOutputText.Annotation.ContainerFileCitation> containerFileCitation()
A citation for a container file used to generate a model response.
-
filePath
final Optional<ResponseOutputText.Annotation.FilePath> filePath()
A path to a file.
-
isFileCitation
final Boolean isFileCitation()
-
isUrlCitation
final Boolean isUrlCitation()
-
isContainerFileCitation
final Boolean isContainerFileCitation()
-
isFilePath
final Boolean isFilePath()
-
asFileCitation
final ResponseOutputText.Annotation.FileCitation asFileCitation()
A citation to a file.
-
asUrlCitation
final ResponseOutputText.Annotation.UrlCitation asUrlCitation()
A citation for a web resource used to generate a model response.
-
asContainerFileCitation
final ResponseOutputText.Annotation.ContainerFileCitation asContainerFileCitation()
A citation for a container file used to generate a model response.
-
asFilePath
final ResponseOutputText.Annotation.FilePath asFilePath()
A path to a file.
-
accept
final <T extends Any> T accept(ResponseOutputText.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> visitFileCitation(FileCitation fileCitation) { return Optional.of(fileCitation.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ResponseOutputText.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.
-
ofFileCitation
final static ResponseOutputText.Annotation ofFileCitation(ResponseOutputText.Annotation.FileCitation fileCitation)
A citation to a file.
-
ofUrlCitation
final static ResponseOutputText.Annotation ofUrlCitation(ResponseOutputText.Annotation.UrlCitation urlCitation)
A citation for a web resource used to generate a model response.
-
ofContainerFileCitation
final static ResponseOutputText.Annotation ofContainerFileCitation(ResponseOutputText.Annotation.ContainerFileCitation containerFileCitation)
A citation for a container file used to generate a model response.
-
ofFilePath
final static ResponseOutputText.Annotation ofFilePath(ResponseOutputText.Annotation.FilePath filePath)
A path to a file.
-
-
-
-