CountTokensRequest class

Request to count tokens.

Constructors

CountTokensRequest({List<Content>? contents, GenerateContentRequest? generateContentRequest, Content? systemInstruction})
Creates a CountTokensRequest.
const
CountTokensRequest.fromJson(Map<String, dynamic> json)
Creates a CountTokensRequest from JSON.
factory

Properties

contents List<Content>?
The content to count tokens for. This field is ignored when generateContentRequest is set.
final
generateContentRequest GenerateContentRequest?
The overall input given to the model. This includes the prompt as well as other model steering information like system instructions and/or function declarations. contents and generateContentRequest are mutually exclusive.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
systemInstruction Content?
System instruction for the model (Vertex AI). Used when counting tokens for Vertex AI API.
final

Methods

copyWith({Object? contents = unsetCopyWithValue, Object? generateContentRequest = unsetCopyWithValue, Object? systemInstruction = unsetCopyWithValue}) CountTokensRequest
Creates a copy with replaced values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts to JSON.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited