NAME
Google::Ai::Generativelanguage::V1alpha - Client library for Google Cloud Services
SYNOPSIS
use Google::Ai::Generativelanguage::V1alpha;
use Google::Auth;
my $auth = Google::Auth->default();
# 1. High-performance gRPC Transport (Default)
my $grpc_client = Google::Ai::Generativelanguage::V1alpha->new(
credentials => $auth,
transport => 'grpc', # Optional: 'grpc' is default
);
# 2. HTTP/REST Transport
my $rest_client = Google::Ai::Generativelanguage::V1alpha->new(
credentials => $auth,
transport => 'rest',
);
# Execute service methods
my $res = $grpc_client->some_method( %params );
DESCRIPTION
Google::Ai::Generativelanguage::V1alpha is an auto-generated client library for Google Cloud Services.
It provides a unified client interface supporting both high-performance HTTP/2 gRPC and HTTP/REST transports, with automatic Google Cloud Application Default Credentials (ADC) resolution and typed Protocol Buffers message handling.
SOURCE
Generated from the following Protocol Buffers schemas:
googleapis/google/ai/generativelanguage/v1alpha/cache_service.protogoogleapis/google/ai/generativelanguage/v1alpha/cached_content.protogoogleapis/google/ai/generativelanguage/v1alpha/citation.protogoogleapis/google/ai/generativelanguage/v1alpha/content.protogoogleapis/google/ai/generativelanguage/v1alpha/discuss_service.protogoogleapis/google/ai/generativelanguage/v1alpha/file.protogoogleapis/google/ai/generativelanguage/v1alpha/file_service.protogoogleapis/google/ai/generativelanguage/v1alpha/generative_service.protogoogleapis/google/ai/generativelanguage/v1alpha/model.protogoogleapis/google/ai/generativelanguage/v1alpha/model_service.protogoogleapis/google/ai/generativelanguage/v1alpha/permission.protogoogleapis/google/ai/generativelanguage/v1alpha/permission_service.protogoogleapis/google/ai/generativelanguage/v1alpha/prediction_service.protogoogleapis/google/ai/generativelanguage/v1alpha/retriever.protogoogleapis/google/ai/generativelanguage/v1alpha/retriever_service.protogoogleapis/google/ai/generativelanguage/v1alpha/safety.protogoogleapis/google/ai/generativelanguage/v1alpha/text_service.protogoogleapis/google/ai/generativelanguage/v1alpha/tuned_model.proto
CONSTRUCTOR
new
my $client = Google::Ai::Generativelanguage::V1alpha->new(
credentials => $auth, # Optional: Google::Auth object (defaults to ADC)
transport => 'grpc', # Optional: 'grpc' (default) or 'rest'
);
ATTRIBUTES
credentials
Returns or accepts the Google::Auth credentials object.
transport
Returns or accepts the active transport object (Google::gRPC::Client or Google::Cloud::REST::Client).
METHODS
METHODS
The following RPC methods are available in this client:
list_cached_contents
my $response = $client->list_cached_contents( page_size => $page_size, page_token => $page_token, );Calls the RPC method
ListCachedContentsongoogle.ai.generativelanguage.v1alpha.CacheService.Request: Google::Ai::Generativelanguage::V1alpha::CacheService::ListCachedContentsRequest
Returns: Google::Ai::Generativelanguage::V1alpha::CacheService::ListCachedContentsResponse
Parameters:
page_size-int32page_token-string
create_cached_content
my $response = $client->create_cached_content( cached_content => $cached_content, );Calls the RPC method
CreateCachedContentongoogle.ai.generativelanguage.v1alpha.CacheService.Request: Google::Ai::Generativelanguage::V1alpha::CacheService::CreateCachedContentRequest
Returns: Google::Ai::Generativelanguage::V1alpha::CachedContent::CachedContent
Parameters:
get_cached_content
my $response = $client->get_cached_content( name => $name, );Calls the RPC method
GetCachedContentongoogle.ai.generativelanguage.v1alpha.CacheService.Request: Google::Ai::Generativelanguage::V1alpha::CacheService::GetCachedContentRequest
Returns: Google::Ai::Generativelanguage::V1alpha::CachedContent::CachedContent
Parameters:
name-string
update_cached_content
my $response = $client->update_cached_content( cached_content => $cached_content, update_mask => $update_mask, );Calls the RPC method
UpdateCachedContentongoogle.ai.generativelanguage.v1alpha.CacheService.Request: Google::Ai::Generativelanguage::V1alpha::CacheService::UpdateCachedContentRequest
Returns: Google::Ai::Generativelanguage::V1alpha::CachedContent::CachedContent
Parameters:
cached_content- Google::Ai::Generativelanguage::V1alpha::CachedContent::CachedContentupdate_mask- Google::Protobuf::FieldMask::FieldMask
delete_cached_content
my $response = $client->delete_cached_content( name => $name, );Calls the RPC method
DeleteCachedContentongoogle.ai.generativelanguage.v1alpha.CacheService.Request: Google::Ai::Generativelanguage::V1alpha::CacheService::DeleteCachedContentRequest
Returns: Google::Protobuf::Empty::Empty
Parameters:
name-string
generate_message
my $response = $client->generate_message( model => $model, prompt => $prompt, temperature => $temperature, candidate_count => $candidate_count, top_p => $top_p, top_k => $top_k, );Calls the RPC method
GenerateMessageongoogle.ai.generativelanguage.v1alpha.DiscussService.Request: Google::Ai::Generativelanguage::V1alpha::DiscussService::GenerateMessageRequest
Returns: Google::Ai::Generativelanguage::V1alpha::DiscussService::GenerateMessageResponse
Parameters:
model-stringprompt- Google::Ai::Generativelanguage::V1alpha::DiscussService::MessagePrompttemperature-floatcandidate_count-int32top_p-floattop_k-int32
count_message_tokens
my $response = $client->count_message_tokens( model => $model, prompt => $prompt, );Calls the RPC method
CountMessageTokensongoogle.ai.generativelanguage.v1alpha.DiscussService.Request: Google::Ai::Generativelanguage::V1alpha::DiscussService::CountMessageTokensRequest
Returns: Google::Ai::Generativelanguage::V1alpha::DiscussService::CountMessageTokensResponse
Parameters:
model-stringprompt- Google::Ai::Generativelanguage::V1alpha::DiscussService::MessagePrompt
create_file
my $response = $client->create_file( file => $file, );Calls the RPC method
CreateFileongoogle.ai.generativelanguage.v1alpha.FileService.Request: Google::Ai::Generativelanguage::V1alpha::FileService::CreateFileRequest
Returns: Google::Ai::Generativelanguage::V1alpha::FileService::CreateFileResponse
Parameters:
list_files
my $response = $client->list_files( page_size => $page_size, page_token => $page_token, );Calls the RPC method
ListFilesongoogle.ai.generativelanguage.v1alpha.FileService.Request: Google::Ai::Generativelanguage::V1alpha::FileService::ListFilesRequest
Returns: Google::Ai::Generativelanguage::V1alpha::FileService::ListFilesResponse
Parameters:
page_size-int32page_token-string
get_file
my $response = $client->get_file( name => $name, );Calls the RPC method
GetFileongoogle.ai.generativelanguage.v1alpha.FileService.Request: Google::Ai::Generativelanguage::V1alpha::FileService::GetFileRequest
Returns: Google::Ai::Generativelanguage::V1alpha::File::File
Parameters:
name-string
delete_file
my $response = $client->delete_file( name => $name, );Calls the RPC method
DeleteFileongoogle.ai.generativelanguage.v1alpha.FileService.Request: Google::Ai::Generativelanguage::V1alpha::FileService::DeleteFileRequest
Returns: Google::Protobuf::Empty::Empty
Parameters:
name-string
generate_content
my $response = $client->generate_content( model => $model, system_instruction => $system_instruction, contents => [ ... ], tools => [ ... ], tool_config => $tool_config, safety_settings => [ ... ], generation_config => $generation_config, cached_content => $cached_content, );Calls the RPC method
GenerateContentongoogle.ai.generativelanguage.v1alpha.GenerativeService.Request: Google::Ai::Generativelanguage::V1alpha::GenerativeService::GenerateContentRequest
Returns: Google::Ai::Generativelanguage::V1alpha::GenerativeService::GenerateContentResponse
Parameters:
model-stringsystem_instruction- Google::Ai::Generativelanguage::V1alpha::Content::Contentcontents- ArrayRef of Google::Ai::Generativelanguage::V1alpha::Content::Contenttools- ArrayRef of Google::Ai::Generativelanguage::V1alpha::Content::Tooltool_config- Google::Ai::Generativelanguage::V1alpha::Content::ToolConfigsafety_settings- ArrayRef of Google::Ai::Generativelanguage::V1alpha::Safety::SafetySettinggeneration_config- Google::Ai::Generativelanguage::V1alpha::GenerativeService::GenerationConfigcached_content-string
generate_answer
my $response = $client->generate_answer( model => $model, contents => [ ... ], answer_style => $answer_style, safety_settings => [ ... ], temperature => $temperature, );Calls the RPC method
GenerateAnswerongoogle.ai.generativelanguage.v1alpha.GenerativeService.Request: Google::Ai::Generativelanguage::V1alpha::GenerativeService::GenerateAnswerRequest
Returns: Google::Ai::Generativelanguage::V1alpha::GenerativeService::GenerateAnswerResponse
Parameters:
model-stringcontents- ArrayRef of Google::Ai::Generativelanguage::V1alpha::Content::Contentanswer_style- Google::Ai::Generativelanguage::V1alpha::GenerativeService::AnswerStylesafety_settings- ArrayRef of Google::Ai::Generativelanguage::V1alpha::Safety::SafetySettingtemperature-float
stream_generate_content
my $response = $client->stream_generate_content( model => $model, system_instruction => $system_instruction, contents => [ ... ], tools => [ ... ], tool_config => $tool_config, safety_settings => [ ... ], generation_config => $generation_config, cached_content => $cached_content, );Calls the RPC method
StreamGenerateContentongoogle.ai.generativelanguage.v1alpha.GenerativeService.Request: Google::Ai::Generativelanguage::V1alpha::GenerativeService::GenerateContentRequest
Returns: Google::Ai::Generativelanguage::V1alpha::GenerativeService::GenerateContentResponse
Parameters:
model-stringsystem_instruction- Google::Ai::Generativelanguage::V1alpha::Content::Contentcontents- ArrayRef of Google::Ai::Generativelanguage::V1alpha::Content::Contenttools- ArrayRef of Google::Ai::Generativelanguage::V1alpha::Content::Tooltool_config- Google::Ai::Generativelanguage::V1alpha::Content::ToolConfigsafety_settings- ArrayRef of Google::Ai::Generativelanguage::V1alpha::Safety::SafetySettinggeneration_config- Google::Ai::Generativelanguage::V1alpha::GenerativeService::GenerationConfigcached_content-string
embed_content
my $response = $client->embed_content( model => $model, content => $content, task_type => $task_type, title => $title, output_dimensionality => $output_dimensionality, );Calls the RPC method
EmbedContentongoogle.ai.generativelanguage.v1alpha.GenerativeService.Request: Google::Ai::Generativelanguage::V1alpha::GenerativeService::EmbedContentRequest
Returns: Google::Ai::Generativelanguage::V1alpha::GenerativeService::EmbedContentResponse
Parameters:
model-stringcontent- Google::Ai::Generativelanguage::V1alpha::Content::Contenttask_type- Google::Ai::Generativelanguage::V1alpha::GenerativeService::TaskTypetitle-stringoutput_dimensionality-int32
batch_embed_contents
my $response = $client->batch_embed_contents( model => $model, requests => [ ... ], );Calls the RPC method
BatchEmbedContentsongoogle.ai.generativelanguage.v1alpha.GenerativeService.Request: Google::Ai::Generativelanguage::V1alpha::GenerativeService::BatchEmbedContentsRequest
Returns: Google::Ai::Generativelanguage::V1alpha::GenerativeService::BatchEmbedContentsResponse
Parameters:
model-stringrequests- ArrayRef of Google::Ai::Generativelanguage::V1alpha::GenerativeService::EmbedContentRequest
count_tokens
my $response = $client->count_tokens( model => $model, contents => [ ... ], generate_content_request => $generate_content_request, );Calls the RPC method
CountTokensongoogle.ai.generativelanguage.v1alpha.GenerativeService.Request: Google::Ai::Generativelanguage::V1alpha::GenerativeService::CountTokensRequest
Returns: Google::Ai::Generativelanguage::V1alpha::GenerativeService::CountTokensResponse
Parameters:
model-stringcontents- ArrayRef of Google::Ai::Generativelanguage::V1alpha::Content::Contentgenerate_content_request- Google::Ai::Generativelanguage::V1alpha::GenerativeService::GenerateContentRequest
bidi_generate_content
my $response = $client->bidi_generate_content();Calls the RPC method
BidiGenerateContentongoogle.ai.generativelanguage.v1alpha.GenerativeService.Request: Google::Ai::Generativelanguage::V1alpha::GenerativeService::BidiGenerateContentClientMessage
Returns: Google::Ai::Generativelanguage::V1alpha::GenerativeService::BidiGenerateContentServerMessage
get_model
my $response = $client->get_model( name => $name, );Calls the RPC method
GetModelongoogle.ai.generativelanguage.v1alpha.ModelService.Request: Google::Ai::Generativelanguage::V1alpha::ModelService::GetModelRequest
Returns: Google::Ai::Generativelanguage::V1alpha::Model::Model
Parameters:
name-string
list_models
my $response = $client->list_models( page_size => $page_size, page_token => $page_token, );Calls the RPC method
ListModelsongoogle.ai.generativelanguage.v1alpha.ModelService.Request: Google::Ai::Generativelanguage::V1alpha::ModelService::ListModelsRequest
Returns: Google::Ai::Generativelanguage::V1alpha::ModelService::ListModelsResponse
Parameters:
page_size-int32page_token-string
get_tuned_model
my $response = $client->get_tuned_model( name => $name, );Calls the RPC method
GetTunedModelongoogle.ai.generativelanguage.v1alpha.ModelService.Request: Google::Ai::Generativelanguage::V1alpha::ModelService::GetTunedModelRequest
Returns: Google::Ai::Generativelanguage::V1alpha::TunedModel::TunedModel
Parameters:
name-string
list_tuned_models
my $response = $client->list_tuned_models( page_size => $page_size, page_token => $page_token, filter => $filter, );Calls the RPC method
ListTunedModelsongoogle.ai.generativelanguage.v1alpha.ModelService.Request: Google::Ai::Generativelanguage::V1alpha::ModelService::ListTunedModelsRequest
Returns: Google::Ai::Generativelanguage::V1alpha::ModelService::ListTunedModelsResponse
Parameters:
page_size-int32page_token-stringfilter-string
create_tuned_model
my $response = $client->create_tuned_model( tuned_model_id => $tuned_model_id, tuned_model => $tuned_model, );Calls the RPC method
CreateTunedModelongoogle.ai.generativelanguage.v1alpha.ModelService.Request: Google::Ai::Generativelanguage::V1alpha::ModelService::CreateTunedModelRequest
Returns: Google::Longrunning::Operations::Operation
Parameters:
tuned_model_id-stringtuned_model- Google::Ai::Generativelanguage::V1alpha::TunedModel::TunedModel
update_tuned_model
my $response = $client->update_tuned_model( tuned_model => $tuned_model, update_mask => $update_mask, );Calls the RPC method
UpdateTunedModelongoogle.ai.generativelanguage.v1alpha.ModelService.Request: Google::Ai::Generativelanguage::V1alpha::ModelService::UpdateTunedModelRequest
Returns: Google::Ai::Generativelanguage::V1alpha::TunedModel::TunedModel
Parameters:
tuned_model- Google::Ai::Generativelanguage::V1alpha::TunedModel::TunedModelupdate_mask- Google::Protobuf::FieldMask::FieldMask
delete_tuned_model
my $response = $client->delete_tuned_model( name => $name, );Calls the RPC method
DeleteTunedModelongoogle.ai.generativelanguage.v1alpha.ModelService.Request: Google::Ai::Generativelanguage::V1alpha::ModelService::DeleteTunedModelRequest
Returns: Google::Protobuf::Empty::Empty
Parameters:
name-string
create_permission
my $response = $client->create_permission( parent => $parent, permission => $permission, );Calls the RPC method
CreatePermissionongoogle.ai.generativelanguage.v1alpha.PermissionService.Request: Google::Ai::Generativelanguage::V1alpha::PermissionService::CreatePermissionRequest
Returns: Google::Ai::Generativelanguage::V1alpha::Permission::Permission
Parameters:
parent-stringpermission- Google::Ai::Generativelanguage::V1alpha::Permission::Permission
transfer_ownership
my $response = $client->transfer_ownership( name => $name, email_address => $email_address, );Calls the RPC method
TransferOwnershipongoogle.ai.generativelanguage.v1alpha.PermissionService.Request: Google::Ai::Generativelanguage::V1alpha::PermissionService::TransferOwnershipRequest
Returns: Google::Ai::Generativelanguage::V1alpha::PermissionService::TransferOwnershipResponse
Parameters:
name-stringemail_address-string
predict
my $response = $client->predict( model => $model, instances => [ ... ], parameters => $parameters, );Calls the RPC method
Predictongoogle.ai.generativelanguage.v1alpha.PredictionService.Request: Google::Ai::Generativelanguage::V1alpha::PredictionService::PredictRequest
Returns: Google::Ai::Generativelanguage::V1alpha::PredictionService::PredictResponse
Parameters:
model-stringinstances- ArrayRef of Google::Protobuf::Value::Valueparameters- Google::Protobuf::Value::Value
create_corpus
my $response = $client->create_corpus( corpus => $corpus, );Calls the RPC method
CreateCorpusongoogle.ai.generativelanguage.v1alpha.RetrieverService.Request: Google::Ai::Generativelanguage::V1alpha::RetrieverService::CreateCorpusRequest
Returns: Google::Ai::Generativelanguage::V1alpha::Retriever::Corpus
Parameters:
get_corpus
my $response = $client->get_corpus( name => $name, );Calls the RPC method
GetCorpusongoogle.ai.generativelanguage.v1alpha.RetrieverService.Request: Google::Ai::Generativelanguage::V1alpha::RetrieverService::GetCorpusRequest
Returns: Google::Ai::Generativelanguage::V1alpha::Retriever::Corpus
Parameters:
name-string
generate_text
my $response = $client->generate_text( model => $model, prompt => $prompt, temperature => $temperature, candidate_count => $candidate_count, max_output_tokens => $max_output_tokens, top_p => $top_p, top_k => $top_k, safety_settings => [ ... ], stop_sequences => [ ... ], );Calls the RPC method
GenerateTextongoogle.ai.generativelanguage.v1alpha.TextService.Request: Google::Ai::Generativelanguage::V1alpha::TextService::GenerateTextRequest
Returns: Google::Ai::Generativelanguage::V1alpha::TextService::GenerateTextResponse
Parameters:
model-stringprompt- Google::Ai::Generativelanguage::V1alpha::TextService::TextPrompttemperature-floatcandidate_count-int32max_output_tokens-int32top_p-floattop_k-int32safety_settings- ArrayRef of Google::Ai::Generativelanguage::V1alpha::Safety::SafetySettingstop_sequences- ArrayRef ofstring
embed_text
my $response = $client->embed_text( model => $model, text => $text, );Calls the RPC method
EmbedTextongoogle.ai.generativelanguage.v1alpha.TextService.Request: Google::Ai::Generativelanguage::V1alpha::TextService::EmbedTextRequest
Returns: Google::Ai::Generativelanguage::V1alpha::TextService::EmbedTextResponse
Parameters:
model-stringtext-string
batch_embed_text
my $response = $client->batch_embed_text( model => $model, texts => [ ... ], requests => [ ... ], );Calls the RPC method
BatchEmbedTextongoogle.ai.generativelanguage.v1alpha.TextService.Request: Google::Ai::Generativelanguage::V1alpha::TextService::BatchEmbedTextRequest
Returns: Google::Ai::Generativelanguage::V1alpha::TextService::BatchEmbedTextResponse
Parameters:
model-stringtexts- ArrayRef ofstringrequests- ArrayRef of Google::Ai::Generativelanguage::V1alpha::TextService::EmbedTextRequest
count_text_tokens
my $response = $client->count_text_tokens( model => $model, prompt => $prompt, );Calls the RPC method
CountTextTokensongoogle.ai.generativelanguage.v1alpha.TextService.Request: Google::Ai::Generativelanguage::V1alpha::TextService::CountTextTokensRequest
Returns: Google::Ai::Generativelanguage::V1alpha::TextService::CountTextTokensResponse
Parameters:
model-stringprompt- Google::Ai::Generativelanguage::V1alpha::TextService::TextPrompt
LICENSE AND COPYRIGHT
Copyright (C) 2026 Google LLC
This program is released under the Apache 2.0 license.