Service Client: Google::Cloud::Dialogflow::V2::Context::ContextsClient
Client stub representing the remote Contexts gRPC service. Delegates call dispatching to Google::gRPC::Client.
target
The endpoint target address. Defaults to dialogflow.googleapis.com:443.
credentials
The authentication credentials provider. Defaults to application default credentials via Google::Auth.
NAME
Google::Cloud::Dialogflow::V2::Context - Compiled Protocol Buffers messages for google/cloud/dialogflow/v2/context.proto
SYNOPSIS
use Google::Cloud::Dialogflow::V2::Context;
my $msg = Google::Cloud::Dialogflow::V2::Context::Context->new({
name => $name,
lifespan_count => $lifespan_count,
parameters => $parameters,
});
# Read or update a field
my $val = $msg->name();
# Binary wire-format roundtrip
my $bytes = $msg->serialize();
my $decoded = Google::Cloud::Dialogflow::V2::Context::Context->parse($bytes);
# Canonical ProtoJSON
my $json = $msg->to_json();
DESCRIPTION
Auto-generated Protobuf message classes compiled from google/cloud/dialogflow/v2/context.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().
MESSAGES
Google::Cloud::Dialogflow::V2::Context::Context
Dialogflow contexts are similar to natural language context. If a person says to you "they are orange", you need context in order to understand what "they" is referring to. Similarly, for Dialogflow to handle an end-user expression like that, it needs to be provided with context in order to correctly match an intent.
Using contexts, you can control the flow of a conversation. You can configure contexts for an intent by setting input and output contexts, which are identified by string names. When an intent is matched, any configured output contexts for that intent become active. While any contexts are active, Dialogflow is more likely to match intents that are configured with input contexts that correspond to the currently active contexts.
For more information about context, see the [Contexts guide](https://cloud.google.com/dialogflow/docs/contexts-overview).
Inherits from Protobuf::Message.
Accessors
$msg->name()/$msg->name($value)Type:
StringRequired. The unique identifier of the context. Format: `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`, or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>`.
The `Context ID` is always converted to lowercase, may only contain characters in `a-zA-Z0-9_-%` and may be at most 250 bytes long.
If `Environment ID` is not specified, we assume default 'draft' environment. If `User ID` is not specified, we assume default '-' user.
The following context names are reserved for internal use by Dialogflow. You should not use these contexts or create contexts with these names:
* `__system_counters__` * `*_id_dialog_context` * `*_dialog_params_size`
$msg->lifespan_count()/$msg->lifespan_count($value)Type:
Int32Optional. The number of conversational query requests after which the context expires. The default is `0`. If set to `0`, the context expires immediately. Contexts expire automatically after 20 minutes if there are no matching queries.
$msg->parameters()/$msg->parameters($value)Type:
Message(Google::Protobuf::Struct::Struct)Optional. The collection of parameters associated with this context.
Depending on your protocol or client library language, this is a map, associative array, symbol table, dictionary, or JSON object composed of a collection of (MapKey, MapValue) pairs:
* MapKey type: string * MapKey value: parameter name * MapValue type: If parameter's entity type is a composite entity then use map, otherwise, depending on the parameter value type, it could be one of string, number, boolean, null, list or map. * MapValue value: If parameter's entity type is a composite entity then use map from composite entity property names to property values, otherwise, use parameter value.
Google::Cloud::Dialogflow::V2::Context::ListContextsRequest
The request message for [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts].
Inherits from Protobuf::Message.
Accessors
$msg->parent()/$msg->parent($value)Type:
StringRequired. The session to list all contexts from. Format: `projects/<Project ID>/agent/sessions/<Session ID>` or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`. If `Environment ID` is not specified, we assume default 'draft' environment. If `User ID` is not specified, we assume default '-' user.
$msg->page_size()/$msg->page_size($value)Type:
Int32Optional. The maximum number of items to return in a single page. By default 100 and at most 1000.
$msg->page_token()/$msg->page_token($value)Type:
StringOptional. The next_page_token value returned from a previous list request.
Google::Cloud::Dialogflow::V2::Context::ListContextsResponse
The response message for [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts].
Inherits from Protobuf::Message.
Accessors
$msg->contexts()/$msg->contexts($value)Type:
Message(Google::Cloud::Dialogflow::V2::Context::Context)The list of contexts. There will be a maximum number of items returned based on the page_size field in the request.
$msg->next_page_token()/$msg->next_page_token($value)Type:
StringToken to retrieve the next page of results, or empty if there are no more results in the list.
Google::Cloud::Dialogflow::V2::Context::GetContextRequest
The request message for [Contexts.GetContext][google.cloud.dialogflow.v2.Contexts.GetContext].
Inherits from Protobuf::Message.
Accessors
$msg->name()/$msg->name($value)Type:
StringRequired. The name of the context. Format: `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>` or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>`. If `Environment ID` is not specified, we assume default 'draft' environment. If `User ID` is not specified, we assume default '-' user.
Google::Cloud::Dialogflow::V2::Context::CreateContextRequest
The request message for [Contexts.CreateContext][google.cloud.dialogflow.v2.Contexts.CreateContext].
Inherits from Protobuf::Message.
Accessors
$msg->parent()/$msg->parent($value)Type:
StringRequired. The session to create a context for. Format: `projects/<Project ID>/agent/sessions/<Session ID>` or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`. If `Environment ID` is not specified, we assume default 'draft' environment. If `User ID` is not specified, we assume default '-' user.
$msg->context()/$msg->context($value)Type:
Message(Google::Cloud::Dialogflow::V2::Context::Context)Required. The context to create.
Google::Cloud::Dialogflow::V2::Context::UpdateContextRequest
The request message for [Contexts.UpdateContext][google.cloud.dialogflow.v2.Contexts.UpdateContext].
Inherits from Protobuf::Message.
Accessors
$msg->context()/$msg->context($value)Type:
Message(Google::Cloud::Dialogflow::V2::Context::Context)Required. The context to update.
$msg->update_mask()/$msg->update_mask($value)Type:
Message(Google::Protobuf::FieldMask::FieldMask)Optional. The mask to control which fields get updated.
Google::Cloud::Dialogflow::V2::Context::DeleteContextRequest
The request message for [Contexts.DeleteContext][google.cloud.dialogflow.v2.Contexts.DeleteContext].
Inherits from Protobuf::Message.
Accessors
$msg->name()/$msg->name($value)Type:
StringRequired. The name of the context to delete. Format: `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>` or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>`. If `Environment ID` is not specified, we assume default 'draft' environment. If `User ID` is not specified, we assume default '-' user.
Google::Cloud::Dialogflow::V2::Context::DeleteAllContextsRequest
The request message for [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2.Contexts.DeleteAllContexts].
Inherits from Protobuf::Message.
Accessors
$msg->parent()/$msg->parent($value)Type:
StringRequired. The name of the session to delete all contexts from. Format: `projects/<Project ID>/agent/sessions/<Session ID>` or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>`. If `Environment ID` is not specified we assume default 'draft' environment. If `User ID` is not specified, we assume default '-' user.
SEE ALSO
Protobuf, Protobuf::Message, Google::Cloud::Dialogflow::V2::Context::Types, https://protobuf.dev/
LICENSE AND COPYRIGHT
Copyright (C) 2026 Google LLC
This program is released under the Apache 2.0 license.