NAME
Google::Ai::Generativelanguage::V1beta - Client library for Google Cloud Services
SYNOPSIS
use Google::Ai::Generativelanguage::V1beta;
use Google::Auth;
my $auth = Google::Auth->default();
# 1. High-performance gRPC Transport (Default)
my $grpc_client = Google::Ai::Generativelanguage::V1beta->new(
credentials => $auth,
transport => 'grpc', # Optional: 'grpc' is default
);
# 2. HTTP/REST Transport
my $rest_client = Google::Ai::Generativelanguage::V1beta->new(
credentials => $auth,
transport => 'rest',
);
# Execute service methods
my $res = $grpc_client->some_method( %params );
DESCRIPTION
Google::Ai::Generativelanguage::V1beta 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/v1beta/cache_service.protogoogleapis/google/ai/generativelanguage/v1beta/cached_content.protogoogleapis/google/ai/generativelanguage/v1beta/citation.protogoogleapis/google/ai/generativelanguage/v1beta/content.protogoogleapis/google/ai/generativelanguage/v1beta/discuss_service.protogoogleapis/google/ai/generativelanguage/v1beta/file.protogoogleapis/google/ai/generativelanguage/v1beta/file_service.protogoogleapis/google/ai/generativelanguage/v1beta/generative_service.protogoogleapis/google/ai/generativelanguage/v1beta/model.protogoogleapis/google/ai/generativelanguage/v1beta/model_service.protogoogleapis/google/ai/generativelanguage/v1beta/permission.protogoogleapis/google/ai/generativelanguage/v1beta/permission_service.protogoogleapis/google/ai/generativelanguage/v1beta/prediction_service.protogoogleapis/google/ai/generativelanguage/v1beta/retriever.protogoogleapis/google/ai/generativelanguage/v1beta/retriever_service.protogoogleapis/google/ai/generativelanguage/v1beta/safety.protogoogleapis/google/ai/generativelanguage/v1beta/text_service.protogoogleapis/google/ai/generativelanguage/v1beta/tuned_model.proto
CONSTRUCTOR
new
my $client = Google::Ai::Generativelanguage::V1beta->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.v1beta.CacheService.Request: Google::Ai::Generativelanguage::V1beta::CacheService::ListCachedContentsRequest
Returns: Google::Ai::Generativelanguage::V1beta::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.v1beta.CacheService.Request: Google::Ai::Generativelanguage::V1beta::CacheService::CreateCachedContentRequest
Returns: Google::Ai::Generativelanguage::V1beta::CachedContent::CachedContent
Parameters:
cached_content- Google::Ai::Generativelanguage::V1beta::CachedContent::CachedContent
get_cached_content
my $response = $client->get_cached_content( name => $name, );Calls the RPC method
GetCachedContentongoogle.ai.generativelanguage.v1beta.CacheService.Request: Google::Ai::Generativelanguage::V1beta::CacheService::GetCachedContentRequest
Returns: Google::Ai::Generativelanguage::V1beta::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.v1beta.CacheService.Request: Google::Ai::Generativelanguage::V1beta::CacheService::UpdateCachedContentRequest
Returns: Google::Ai::Generativelanguage::V1beta::CachedContent::CachedContent
Parameters:
cached_content- Google::Ai::Generativelanguage::V1beta::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.v1beta.CacheService.Request: Google::Ai::Generativelanguage::V1beta::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.v1beta.DiscussService.Request: Google::Ai::Generativelanguage::V1beta::DiscussService::GenerateMessageRequest
Returns: Google::Ai::Generativelanguage::V1beta::DiscussService::GenerateMessageResponse
Parameters:
model-stringprompt- Google::Ai::Generativelanguage::V1beta::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.v1beta.DiscussService.Request: Google::Ai::Generativelanguage::V1beta::DiscussService::CountMessageTokensRequest
Returns: Google::Ai::Generativelanguage::V1beta::DiscussService::CountMessageTokensResponse
Parameters:
model-stringprompt- Google::Ai::Generativelanguage::V1beta::DiscussService::MessagePrompt
create_file
my $response = $client->create_file( file => $file, );Calls the RPC method
CreateFileongoogle.ai.generativelanguage.v1beta.FileService.Request: Google::Ai::Generativelanguage::V1beta::FileService::CreateFileRequest
Returns: Google::Ai::Generativelanguage::V1beta::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.v1beta.FileService.Request: Google::Ai::Generativelanguage::V1beta::FileService::ListFilesRequest
Returns: Google::Ai::Generativelanguage::V1beta::FileService::ListFilesResponse
Parameters:
page_size-int32page_token-string
get_file
my $response = $client->get_file( name => $name, );Calls the RPC method
GetFileongoogle.ai.generativelanguage.v1beta.FileService.Request: Google::Ai::Generativelanguage::V1beta::FileService::GetFileRequest
Returns: Google::Ai::Generativelanguage::V1beta::File::File
Parameters:
name-string
delete_file
my $response = $client->delete_file( name => $name, );Calls the RPC method
DeleteFileongoogle.ai.generativelanguage.v1beta.FileService.Request: Google::Ai::Generativelanguage::V1beta::FileService::DeleteFileRequest
Returns: Google::Protobuf::Empty::Empty
Parameters:
name-string
download_file
my $response = $client->download_file( name => $name, );Calls the RPC method
DownloadFileongoogle.ai.generativelanguage.v1beta.FileService.Request: Google::Ai::Generativelanguage::V1beta::FileService::DownloadFileRequest
Returns: Google::Ai::Generativelanguage::V1beta::FileService::DownloadFileResponse
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.v1beta.GenerativeService.Request: Google::Ai::Generativelanguage::V1beta::GenerativeService::GenerateContentRequest
Returns: Google::Ai::Generativelanguage::V1beta::GenerativeService::GenerateContentResponse
Parameters:
model-stringsystem_instruction- Google::Ai::Generativelanguage::V1beta::Content::Contentcontents- ArrayRef of Google::Ai::Generativelanguage::V1beta::Content::Contenttools- ArrayRef of Google::Ai::Generativelanguage::V1beta::Content::Tooltool_config- Google::Ai::Generativelanguage::V1beta::Content::ToolConfigsafety_settings- ArrayRef of Google::Ai::Generativelanguage::V1beta::Safety::SafetySettinggeneration_config- Google::Ai::Generativelanguage::V1beta::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.v1beta.GenerativeService.Request: Google::Ai::Generativelanguage::V1beta::GenerativeService::GenerateAnswerRequest
Returns: Google::Ai::Generativelanguage::V1beta::GenerativeService::GenerateAnswerResponse
Parameters:
model-stringcontents- ArrayRef of Google::Ai::Generativelanguage::V1beta::Content::Contentanswer_style- Google::Ai::Generativelanguage::V1beta::GenerativeService::AnswerStylesafety_settings- ArrayRef of Google::Ai::Generativelanguage::V1beta::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.v1beta.GenerativeService.Request: Google::Ai::Generativelanguage::V1beta::GenerativeService::GenerateContentRequest
Returns: Google::Ai::Generativelanguage::V1beta::GenerativeService::GenerateContentResponse
Parameters:
model-stringsystem_instruction- Google::Ai::Generativelanguage::V1beta::Content::Contentcontents- ArrayRef of Google::Ai::Generativelanguage::V1beta::Content::Contenttools- ArrayRef of Google::Ai::Generativelanguage::V1beta::Content::Tooltool_config- Google::Ai::Generativelanguage::V1beta::Content::ToolConfigsafety_settings- ArrayRef of Google::Ai::Generativelanguage::V1beta::Safety::SafetySettinggeneration_config- Google::Ai::Generativelanguage::V1beta::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.v1beta.GenerativeService.Request: Google::Ai::Generativelanguage::V1beta::GenerativeService::EmbedContentRequest
Returns: Google::Ai::Generativelanguage::V1beta::GenerativeService::EmbedContentResponse
Parameters:
model-stringcontent- Google::Ai::Generativelanguage::V1beta::Content::Contenttask_type- Google::Ai::Generativelanguage::V1beta::GenerativeService::TaskTypetitle-stringoutput_dimensionality-int32
batch_embed_contents
my $response = $client->batch_embed_contents( model => $model, requests => [ ... ], );Calls the RPC method
BatchEmbedContentsongoogle.ai.generativelanguage.v1beta.GenerativeService.Request: Google::Ai::Generativelanguage::V1beta::GenerativeService::BatchEmbedContentsRequest
Returns: Google::Ai::Generativelanguage::V1beta::GenerativeService::BatchEmbedContentsResponse
Parameters:
model-stringrequests- ArrayRef of Google::Ai::Generativelanguage::V1beta::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.v1beta.GenerativeService.Request: Google::Ai::Generativelanguage::V1beta::GenerativeService::CountTokensRequest
Returns: Google::Ai::Generativelanguage::V1beta::GenerativeService::CountTokensResponse
Parameters:
model-stringcontents- ArrayRef of Google::Ai::Generativelanguage::V1beta::Content::Contentgenerate_content_request- Google::Ai::Generativelanguage::V1beta::GenerativeService::GenerateContentRequest
bidi_generate_content
my $response = $client->bidi_generate_content();Calls the RPC method
BidiGenerateContentongoogle.ai.generativelanguage.v1beta.GenerativeService.Request: Google::Ai::Generativelanguage::V1beta::GenerativeService::BidiGenerateContentClientMessage
Returns: Google::Ai::Generativelanguage::V1beta::GenerativeService::BidiGenerateContentServerMessage
get_model
my $response = $client->get_model( name => $name, );Calls the RPC method
GetModelongoogle.ai.generativelanguage.v1beta.ModelService.Request: Google::Ai::Generativelanguage::V1beta::ModelService::GetModelRequest
Returns: Google::Ai::Generativelanguage::V1beta::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.v1beta.ModelService.Request: Google::Ai::Generativelanguage::V1beta::ModelService::ListModelsRequest
Returns: Google::Ai::Generativelanguage::V1beta::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.v1beta.ModelService.Request: Google::Ai::Generativelanguage::V1beta::ModelService::GetTunedModelRequest
Returns: Google::Ai::Generativelanguage::V1beta::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.v1beta.ModelService.Request: Google::Ai::Generativelanguage::V1beta::ModelService::ListTunedModelsRequest
Returns: Google::Ai::Generativelanguage::V1beta::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.v1beta.ModelService.Request: Google::Ai::Generativelanguage::V1beta::ModelService::CreateTunedModelRequest
Returns: Google::Longrunning::Operations::Operation
Parameters:
tuned_model_id-stringtuned_model- Google::Ai::Generativelanguage::V1beta::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.v1beta.ModelService.Request: Google::Ai::Generativelanguage::V1beta::ModelService::UpdateTunedModelRequest
Returns: Google::Ai::Generativelanguage::V1beta::TunedModel::TunedModel
Parameters:
tuned_model- Google::Ai::Generativelanguage::V1beta::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.v1beta.ModelService.Request: Google::Ai::Generativelanguage::V1beta::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.v1beta.PermissionService.Request: Google::Ai::Generativelanguage::V1beta::PermissionService::CreatePermissionRequest
Returns: Google::Ai::Generativelanguage::V1beta::Permission::Permission
Parameters:
parent-stringpermission- Google::Ai::Generativelanguage::V1beta::Permission::Permission
transfer_ownership
my $response = $client->transfer_ownership( name => $name, email_address => $email_address, );Calls the RPC method
TransferOwnershipongoogle.ai.generativelanguage.v1beta.PermissionService.Request: Google::Ai::Generativelanguage::V1beta::PermissionService::TransferOwnershipRequest
Returns: Google::Ai::Generativelanguage::V1beta::PermissionService::TransferOwnershipResponse
Parameters:
name-stringemail_address-string
predict
my $response = $client->predict( model => $model, instances => [ ... ], parameters => $parameters, );Calls the RPC method
Predictongoogle.ai.generativelanguage.v1beta.PredictionService.Request: Google::Ai::Generativelanguage::V1beta::PredictionService::PredictRequest
Returns: Google::Ai::Generativelanguage::V1beta::PredictionService::PredictResponse
Parameters:
model-stringinstances- ArrayRef of Google::Protobuf::Value::Valueparameters- Google::Protobuf::Value::Value
predict_long_running
my $response = $client->predict_long_running( model => $model, instances => [ ... ], parameters => $parameters, );Calls the RPC method
PredictLongRunningongoogle.ai.generativelanguage.v1beta.PredictionService.Request: Google::Ai::Generativelanguage::V1beta::PredictionService::PredictLongRunningRequest
Returns: Google::Longrunning::Operations::Operation
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.v1beta.RetrieverService.Request: Google::Ai::Generativelanguage::V1beta::RetrieverService::CreateCorpusRequest
Returns: Google::Ai::Generativelanguage::V1beta::Retriever::Corpus
Parameters:
get_corpus
my $response = $client->get_corpus( name => $name, );Calls the RPC method
GetCorpusongoogle.ai.generativelanguage.v1beta.RetrieverService.Request: Google::Ai::Generativelanguage::V1beta::RetrieverService::GetCorpusRequest
Returns: Google::Ai::Generativelanguage::V1beta::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.v1beta.TextService.Request: Google::Ai::Generativelanguage::V1beta::TextService::GenerateTextRequest
Returns: Google::Ai::Generativelanguage::V1beta::TextService::GenerateTextResponse
Parameters:
model-stringprompt- Google::Ai::Generativelanguage::V1beta::TextService::TextPrompttemperature-floatcandidate_count-int32max_output_tokens-int32top_p-floattop_k-int32safety_settings- ArrayRef of Google::Ai::Generativelanguage::V1beta::Safety::SafetySettingstop_sequences- ArrayRef ofstring
embed_text
my $response = $client->embed_text( model => $model, text => $text, );Calls the RPC method
EmbedTextongoogle.ai.generativelanguage.v1beta.TextService.Request: Google::Ai::Generativelanguage::V1beta::TextService::EmbedTextRequest
Returns: Google::Ai::Generativelanguage::V1beta::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.v1beta.TextService.Request: Google::Ai::Generativelanguage::V1beta::TextService::BatchEmbedTextRequest
Returns: Google::Ai::Generativelanguage::V1beta::TextService::BatchEmbedTextResponse
Parameters:
model-stringtexts- ArrayRef ofstringrequests- ArrayRef of Google::Ai::Generativelanguage::V1beta::TextService::EmbedTextRequest
count_text_tokens
my $response = $client->count_text_tokens( model => $model, prompt => $prompt, );Calls the RPC method
CountTextTokensongoogle.ai.generativelanguage.v1beta.TextService.Request: Google::Ai::Generativelanguage::V1beta::TextService::CountTextTokensRequest
Returns: Google::Ai::Generativelanguage::V1beta::TextService::CountTextTokensResponse
Parameters:
model-stringprompt- Google::Ai::Generativelanguage::V1beta::TextService::TextPrompt
LICENSE AND COPYRIGHT
Copyright (C) 2026 Google LLC
This program is released under the Apache 2.0 license.