Class Transcription.Usage
-
- All Implemented Interfaces:
public final class Transcription.UsageToken usage statistics for the request.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceTranscription.Usage.VisitorAn interface that defines how to map each variant of Usage to a value of type T.
public final classTranscription.Usage.TokensUsage statistics for models billed by token usage.
public final classTranscription.Usage.DurationUsage statistics for models billed by audio input duration.
-
Method Summary
Modifier and Type Method Description final Optional<Transcription.Usage.Tokens>tokens()Usage statistics for models billed by token usage. final Optional<Transcription.Usage.Duration>duration()Usage statistics for models billed by audio input duration. final BooleanisTokens()final BooleanisDuration()final Transcription.Usage.TokensasTokens()Usage statistics for models billed by token usage. final Transcription.Usage.DurationasDuration()Usage statistics for models billed by audio input duration. final Optional<JsonValue>_json()final <T extends Any> Taccept(Transcription.Usage.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final Transcription.Usagevalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static Transcription.UsageofTokens(Transcription.Usage.Tokens tokens)Usage statistics for models billed by token usage. final static Transcription.UsageofDuration(Transcription.Usage.Duration duration)Usage statistics for models billed by audio input duration. -
-
Method Detail
-
tokens
final Optional<Transcription.Usage.Tokens> tokens()
Usage statistics for models billed by token usage.
-
duration
final Optional<Transcription.Usage.Duration> duration()
Usage statistics for models billed by audio input duration.
-
isDuration
final Boolean isDuration()
-
asTokens
final Transcription.Usage.Tokens asTokens()
Usage statistics for models billed by token usage.
-
asDuration
final Transcription.Usage.Duration asDuration()
Usage statistics for models billed by audio input duration.
-
accept
final <T extends Any> T accept(Transcription.Usage.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 = usage.accept(new Usage.Visitor<Optional<String>>() { @Override public Optional<String> visitTokens(Tokens tokens) { return Optional.of(tokens.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final Transcription.Usage 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.
-
ofTokens
final static Transcription.Usage ofTokens(Transcription.Usage.Tokens tokens)
Usage statistics for models billed by token usage.
-
ofDuration
final static Transcription.Usage ofDuration(Transcription.Usage.Duration duration)
Usage statistics for models billed by audio input duration.
-
-
-
-