NAME
Google::Ai::Generativelanguage::V1beta3::TextServiceClient - Client library for Google Cloud Services
SYNOPSIS
use Google::Ai::Generativelanguage::V1beta3::TextServiceClient;
use Google::Auth;
my $auth = Google::Auth->default();
# 1. High-performance gRPC Transport (Default)
my $grpc_client = Google::Ai::Generativelanguage::V1beta3::TextServiceClient->new(
credentials => $auth,
transport => 'grpc', # Optional: 'grpc' is default
);
# 2. HTTP/REST Transport
my $rest_client = Google::Ai::Generativelanguage::V1beta3::TextServiceClient->new(
credentials => $auth,
transport => 'rest',
);
# Execute service methods
my $res = $grpc_client->some_method( %params );
DESCRIPTION
Google::Ai::Generativelanguage::V1beta3::TextServiceClient 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/v1beta3/citation.protogoogleapis/google/ai/generativelanguage/v1beta3/discuss_service.protogoogleapis/google/ai/generativelanguage/v1beta3/model.protogoogleapis/google/ai/generativelanguage/v1beta3/model_service.protogoogleapis/google/ai/generativelanguage/v1beta3/permission.protogoogleapis/google/ai/generativelanguage/v1beta3/permission_service.protogoogleapis/google/ai/generativelanguage/v1beta3/safety.protogoogleapis/google/ai/generativelanguage/v1beta3/text_service.protogoogleapis/google/ai/generativelanguage/v1beta3/tuned_model.proto
CONSTRUCTOR
new
my $client = Google::Ai::Generativelanguage::V1beta3::TextServiceClient->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:
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.v1beta3.TextService.Request: Google::Ai::Generativelanguage::V1beta3::TextService::GenerateTextRequest
Returns: Google::Ai::Generativelanguage::V1beta3::TextService::GenerateTextResponse
Parameters:
model-stringprompt- Google::Ai::Generativelanguage::V1beta3::TextService::TextPrompttemperature-floatcandidate_count-int32max_output_tokens-int32top_p-floattop_k-int32safety_settings- ArrayRef of Google::Ai::Generativelanguage::V1beta3::Safety::SafetySettingstop_sequences- ArrayRef ofstring
embed_text
my $response = $client->embed_text( model => $model, text => $text, );Calls the RPC method
EmbedTextongoogle.ai.generativelanguage.v1beta3.TextService.Request: Google::Ai::Generativelanguage::V1beta3::TextService::EmbedTextRequest
Returns: Google::Ai::Generativelanguage::V1beta3::TextService::EmbedTextResponse
Parameters:
model-stringtext-string
batch_embed_text
my $response = $client->batch_embed_text( model => $model, texts => [ ... ], );Calls the RPC method
BatchEmbedTextongoogle.ai.generativelanguage.v1beta3.TextService.Request: Google::Ai::Generativelanguage::V1beta3::TextService::BatchEmbedTextRequest
Returns: Google::Ai::Generativelanguage::V1beta3::TextService::BatchEmbedTextResponse
Parameters:
model-stringtexts- ArrayRef ofstring
count_text_tokens
my $response = $client->count_text_tokens( model => $model, prompt => $prompt, );Calls the RPC method
CountTextTokensongoogle.ai.generativelanguage.v1beta3.TextService.Request: Google::Ai::Generativelanguage::V1beta3::TextService::CountTextTokensRequest
Returns: Google::Ai::Generativelanguage::V1beta3::TextService::CountTextTokensResponse
Parameters:
model-stringprompt- Google::Ai::Generativelanguage::V1beta3::TextService::TextPrompt
LICENSE AND COPYRIGHT
Copyright (C) 2026 Google LLC
This program is released under the Apache 2.0 license.