Service Client: Google::Ai::Generativelanguage::V1alpha::DiscussService::DiscussServiceClient

Client stub representing the remote DiscussService gRPC service. Delegates call dispatching to Google::gRPC::Client.

target

The endpoint target address. Defaults to ai.googleapis.com:443.

credentials

The authentication credentials provider. Defaults to application default credentials via Google::Auth.

NAME

Google::Ai::Generativelanguage::V1alpha::DiscussService - Compiled Protocol Buffers messages for google/ai/generativelanguage/v1alpha/discuss_service.proto

SYNOPSIS

use Google::Ai::Generativelanguage::V1alpha::DiscussService;

my $msg = Google::Ai::Generativelanguage::V1alpha::DiscussService::GenerateMessageRequest->new({
    model => $model,
    prompt => $prompt,
    temperature => $temperature,
    candidate_count => $candidate_count,
});

# Read or update a field
my $val = $msg->model();

# Binary wire-format roundtrip
my $bytes   = $msg->serialize();
my $decoded = Google::Ai::Generativelanguage::V1alpha::DiscussService::GenerateMessageRequest->parse($bytes);

# Canonical ProtoJSON
my $json = $msg->to_json();

DESCRIPTION

Auto-generated Protobuf message classes compiled from google/ai/generativelanguage/v1alpha/discuss_service.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().

MESSAGES

Google::Ai::Generativelanguage::V1alpha::DiscussService::GenerateMessageRequest

Request to generate a message response from the model.

Inherits from Protobuf::Message.

Accessors

  • $msg->model() / $msg->model($value)

    Type: String

    Required. The name of the model to use.

    Format: `name=models/{model}`.

  • $msg->prompt() / $msg->prompt($value)

    Type: Message (Google::Ai::Generativelanguage::V1alpha::DiscussService::MessagePrompt)

    Required. The structured textual input given to the model as a prompt.

    Given a prompt, the model will return what it predicts is the next message in the discussion.

  • $msg->temperature() / $msg->temperature($value)

    Type: Float

    Optional. Controls the randomness of the output.

    Values can range over `[0.0,1.0]`, inclusive. A value closer to `1.0` will produce responses that are more varied, while a value closer to `0.0` will typically result in less surprising responses from the model.

  • $msg->candidate_count() / $msg->candidate_count($value)

    Type: Int32

    Optional. The number of generated response messages to return.

    This value must be between `[1, 8]`, inclusive. If unset, this will default to `1`.

  • $msg->top_p() / $msg->top_p($value)

    Type: Float

    Optional. The maximum cumulative probability of tokens to consider when sampling.

    The model uses combined Top-k and nucleus sampling.

    Nucleus sampling considers the smallest set of tokens whose probability sum is at least `top_p`.

  • $msg->top_k() / $msg->top_k($value)

    Type: Int32

    Optional. The maximum number of tokens to consider when sampling.

    The model uses combined Top-k and nucleus sampling.

    Top-k sampling considers the set of `top_k` most probable tokens.

Google::Ai::Generativelanguage::V1alpha::DiscussService::GenerateMessageResponse

The response from the model.

This includes candidate messages and conversation history in the form of chronologically-ordered messages.

Inherits from Protobuf::Message.

Accessors

Google::Ai::Generativelanguage::V1alpha::DiscussService::Message

The base unit of structured text.

A `Message` includes an `author` and the `content` of the `Message`.

The `author` is used to tag messages when they are fed to the model as text.

Inherits from Protobuf::Message.

Accessors

  • $msg->author() / $msg->author($value)

    Type: String

    Optional. The author of this Message.

    This serves as a key for tagging the content of this Message when it is fed to the model as text.

    The author can be any alphanumeric string.

  • $msg->content() / $msg->content($value)

    Type: String

    Required. The text content of the structured `Message`.

  • $msg->citation_metadata() / $msg->citation_metadata($value)

    Type: Message (Google::Ai::Generativelanguage::V1alpha::Citation::CitationMetadata)

    Output only. Citation information for model-generated `content` in this `Message`.

    If this `Message` was generated as output from the model, this field may be populated with attribution information for any text included in the `content`. This field is used only on output.

Google::Ai::Generativelanguage::V1alpha::DiscussService::MessagePrompt

All of the structured input text passed to the model as a prompt.

A `MessagePrompt` contains a structured set of fields that provide context for the conversation, examples of user input/model output message pairs that prime the model to respond in different ways, and the conversation history or list of messages representing the alternating turns of the conversation between the user and the model.

Inherits from Protobuf::Message.

Accessors

  • $msg->context() / $msg->context($value)

    Type: String

    Optional. Text that should be provided to the model first to ground the response.

    If not empty, this `context` will be given to the model first before the `examples` and `messages`. When using a `context` be sure to provide it with every request to maintain continuity.

    This field can be a description of your prompt to the model to help provide context and guide the responses. Examples: "Translate the phrase from English to French." or "Given a statement, classify the sentiment as happy, sad or neutral."

    Anything included in this field will take precedence over message history if the total input size exceeds the model's `input_token_limit` and the input request is truncated.

  • $msg->examples() / $msg->examples($value)

    Type: Message (Google::Ai::Generativelanguage::V1alpha::DiscussService::Example)

    Optional. Examples of what the model should generate.

    This includes both user input and the response that the model should emulate.

    These `examples` are treated identically to conversation messages except that they take precedence over the history in `messages`: If the total input size exceeds the model's `input_token_limit` the input will be truncated. Items will be dropped from `messages` before `examples`.

  • $msg->messages() / $msg->messages($value)

    Type: Message (Google::Ai::Generativelanguage::V1alpha::DiscussService::Message)

    Required. A snapshot of the recent conversation history sorted chronologically.

    Turns alternate between two authors.

    If the total input size exceeds the model's `input_token_limit` the input will be truncated: The oldest items will be dropped from `messages`.

Google::Ai::Generativelanguage::V1alpha::DiscussService::Example

An input/output example used to instruct the Model.

It demonstrates how the model should respond or format its response.

Inherits from Protobuf::Message.

Accessors

Google::Ai::Generativelanguage::V1alpha::DiscussService::CountMessageTokensRequest

Counts the number of tokens in the `prompt` sent to a model.

Models may tokenize text differently, so each model may return a different `token_count`.

Inherits from Protobuf::Message.

Accessors

  • $msg->model() / $msg->model($value)

    Type: String

    Required. The model's resource name. This serves as an ID for the Model to use.

    This name should match a model name returned by the `ListModels` method.

    Format: `models/{model}`

  • $msg->prompt() / $msg->prompt($value)

    Type: Message (Google::Ai::Generativelanguage::V1alpha::DiscussService::MessagePrompt)

    Required. The prompt, whose token count is to be returned.

Google::Ai::Generativelanguage::V1alpha::DiscussService::CountMessageTokensResponse

A response from `CountMessageTokens`.

It returns the model's `token_count` for the `prompt`.

Inherits from Protobuf::Message.

Accessors

  • $msg->token_count() / $msg->token_count($value)

    Type: Int32

    The number of tokens that the `model` tokenizes the `prompt` into.

    Always non-negative.

SEE ALSO

Protobuf, Protobuf::Message, Google::Ai::Generativelanguage::V1alpha::DiscussService::Types, https://protobuf.dev/

LICENSE AND COPYRIGHT

Copyright (C) 2026 Google LLC

This program is released under the Apache 2.0 license.