Class: Google::Apis::AiplatformV1beta1::GoogleCloudAiplatformV1beta1ModalityTokenCount

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/aiplatform_v1beta1/classes.rb,
lib/google/apis/aiplatform_v1beta1/representations.rb,
lib/google/apis/aiplatform_v1beta1/representations.rb

Overview

Represents a breakdown of token usage by modality. This message is used in CountTokensResponse and GenerateContentResponse.UsageMetadata to provide a detailed view of how many tokens are used by each modality (e.g., text, image, video) in a request. This is particularly useful for multimodal models, allowing you to track and manage token consumption for billing and quota purposes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleCloudAiplatformV1beta1ModalityTokenCount

Returns a new instance of GoogleCloudAiplatformV1beta1ModalityTokenCount.



27066
27067
27068
# File 'lib/google/apis/aiplatform_v1beta1/classes.rb', line 27066

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#modalityString

The modality that this token count applies to. Corresponds to the JSON property modality

Returns:

  • (String)


27059
27060
27061
# File 'lib/google/apis/aiplatform_v1beta1/classes.rb', line 27059

def modality
  @modality
end

#token_countFixnum

The number of tokens counted for this modality. Corresponds to the JSON property tokenCount

Returns:

  • (Fixnum)


27064
27065
27066
# File 'lib/google/apis/aiplatform_v1beta1/classes.rb', line 27064

def token_count
  @token_count
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



27071
27072
27073
27074
# File 'lib/google/apis/aiplatform_v1beta1/classes.rb', line 27071

def update!(**args)
  @modality = args[:modality] if args.key?(:modality)
  @token_count = args[:token_count] if args.key?(:token_count)
end