Package com.google.genai.types
Class CountTokensResponse
-
- All Implemented Interfaces:
public abstract class CountTokensResponse extends JsonSerializable
Response for counting tokens.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public abstract classCountTokensResponse.BuilderBuilder for CountTokensResponse.
-
Field Summary
Fields Modifier and Type Field Description public final static StringMAX_READ_LENGTH_PROPERTY
-
Constructor Summary
Constructors Constructor Description CountTokensResponse()
-
Method Summary
Modifier and Type Method Description abstract Optional<HttpResponse>sdkHttpResponse()Used to retain the full HTTP response. abstract Optional<Integer>totalTokens()Total number of tokens. abstract Optional<Integer>cachedContentTokenCount()Number of tokens in the cached part of the prompt (the cached content). static CountTokensResponse.Builderbuilder()Instantiates a builder for CountTokensResponse. abstract CountTokensResponse.BuildertoBuilder()Creates a builder with the same values as this instance. static CountTokensResponsefromJson(String jsonString)Deserializes a JSON string to a CountTokensResponse object. -
Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
sdkHttpResponse
abstract Optional<HttpResponse> sdkHttpResponse()
Used to retain the full HTTP response.
-
totalTokens
abstract Optional<Integer> totalTokens()
Total number of tokens.
-
cachedContentTokenCount
abstract Optional<Integer> cachedContentTokenCount()
Number of tokens in the cached part of the prompt (the cached content).
-
builder
static CountTokensResponse.Builder builder()
Instantiates a builder for CountTokensResponse.
-
toBuilder
abstract CountTokensResponse.Builder toBuilder()
Creates a builder with the same values as this instance.
-
fromJson
static CountTokensResponse fromJson(String jsonString)
Deserializes a JSON string to a CountTokensResponse object.
-
-
-
-