public static final class Context.Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder> implements ContextOrBuilder
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).Protobuf type
google.cloud.dialogflow.v2beta1.Context| Modifier and Type | Method and Description |
|---|---|
Context.Builder |
addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) |
Context |
build() |
Context |
buildPartial() |
Context.Builder |
clear() |
Context.Builder |
clearField(com.google.protobuf.Descriptors.FieldDescriptor field) |
Context.Builder |
clearLifespanCount()
Optional.
|
Context.Builder |
clearName()
Required.
|
Context.Builder |
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) |
Context.Builder |
clearParameters()
Optional.
|
Context.Builder |
clone() |
Context |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
com.google.protobuf.Descriptors.Descriptor |
getDescriptorForType() |
int |
getLifespanCount()
Optional.
|
String |
getName()
Required.
|
com.google.protobuf.ByteString |
getNameBytes()
Required.
|
com.google.protobuf.Struct |
getParameters()
Optional.
|
com.google.protobuf.Struct.Builder |
getParametersBuilder()
Optional.
|
com.google.protobuf.StructOrBuilder |
getParametersOrBuilder()
Optional.
|
boolean |
hasParameters()
Optional.
|
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
Context.Builder |
mergeFrom(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
Context.Builder |
mergeFrom(Context other) |
Context.Builder |
mergeFrom(com.google.protobuf.Message other) |
Context.Builder |
mergeParameters(com.google.protobuf.Struct value)
Optional.
|
Context.Builder |
mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) |
Context.Builder |
setField(com.google.protobuf.Descriptors.FieldDescriptor field,
Object value) |
Context.Builder |
setLifespanCount(int value)
Optional.
|
Context.Builder |
setName(String value)
Required.
|
Context.Builder |
setNameBytes(com.google.protobuf.ByteString value)
Required.
|
Context.Builder |
setParameters(com.google.protobuf.Struct.Builder builderForValue)
Optional.
|
Context.Builder |
setParameters(com.google.protobuf.Struct value)
Optional.
|
Context.Builder |
setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field,
int index,
Object value) |
Context.Builder |
setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) |
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringaddAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfindInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneofpublic static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder>public Context.Builder clear()
clear in interface com.google.protobuf.Message.Builderclear in interface com.google.protobuf.MessageLite.Builderclear in class com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder>public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
getDescriptorForType in interface com.google.protobuf.Message.BuildergetDescriptorForType in interface com.google.protobuf.MessageOrBuildergetDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder>public Context getDefaultInstanceForType()
getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuildergetDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilderpublic Context build()
build in interface com.google.protobuf.Message.Builderbuild in interface com.google.protobuf.MessageLite.Builderpublic Context buildPartial()
buildPartial in interface com.google.protobuf.Message.BuilderbuildPartial in interface com.google.protobuf.MessageLite.Builderpublic Context.Builder clone()
clone in interface com.google.protobuf.Message.Builderclone in interface com.google.protobuf.MessageLite.Builderclone in class com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder>public Context.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
setField in interface com.google.protobuf.Message.BuildersetField in class com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder>public Context.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
clearField in interface com.google.protobuf.Message.BuilderclearField in class com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder>public Context.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
clearOneof in interface com.google.protobuf.Message.BuilderclearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder>public Context.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
setRepeatedField in interface com.google.protobuf.Message.BuildersetRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder>public Context.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
addRepeatedField in interface com.google.protobuf.Message.BuilderaddRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder>public Context.Builder mergeFrom(com.google.protobuf.Message other)
mergeFrom in interface com.google.protobuf.Message.BuildermergeFrom in class com.google.protobuf.AbstractMessage.Builder<Context.Builder>public Context.Builder mergeFrom(Context other)
public final boolean isInitialized()
isInitialized in interface com.google.protobuf.MessageLiteOrBuilderisInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder>public Context.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
mergeFrom in interface com.google.protobuf.Message.BuildermergeFrom in interface com.google.protobuf.MessageLite.BuildermergeFrom in class com.google.protobuf.AbstractMessage.Builder<Context.Builder>IOExceptionpublic String getName()
Required. The unique identifier of the context. Supported formats: - `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/locations/<Location 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`
string name = 1;getName in interface ContextOrBuilderpublic com.google.protobuf.ByteString getNameBytes()
Required. The unique identifier of the context. Supported formats: - `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/locations/<Location 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`
string name = 1;getNameBytes in interface ContextOrBuilderpublic Context.Builder setName(String value)
Required. The unique identifier of the context. Supported formats: - `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/locations/<Location 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`
string name = 1;value - The name to set.public Context.Builder clearName()
Required. The unique identifier of the context. Supported formats: - `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/locations/<Location 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`
string name = 1;public Context.Builder setNameBytes(com.google.protobuf.ByteString value)
Required. The unique identifier of the context. Supported formats: - `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>`, - `projects/<Project ID>/locations/<Location 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`
string name = 1;value - The bytes for name to set.public int getLifespanCount()
Optional. 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.
int32 lifespan_count = 2;getLifespanCount in interface ContextOrBuilderpublic Context.Builder setLifespanCount(int value)
Optional. 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.
int32 lifespan_count = 2;value - The lifespanCount to set.public Context.Builder clearLifespanCount()
Optional. 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.
int32 lifespan_count = 2;public boolean hasParameters()
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: map
- Else: depending on parameter value type, could be one of string,
number, boolean, null, list or map
- MapValue value:
- If parameter's entity type is a composite entity:
map from composite entity property names to property values
- Else: parameter value
.google.protobuf.Struct parameters = 3;hasParameters in interface ContextOrBuilderpublic com.google.protobuf.Struct getParameters()
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: map
- Else: depending on parameter value type, could be one of string,
number, boolean, null, list or map
- MapValue value:
- If parameter's entity type is a composite entity:
map from composite entity property names to property values
- Else: parameter value
.google.protobuf.Struct parameters = 3;getParameters in interface ContextOrBuilderpublic Context.Builder setParameters(com.google.protobuf.Struct value)
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: map
- Else: depending on parameter value type, could be one of string,
number, boolean, null, list or map
- MapValue value:
- If parameter's entity type is a composite entity:
map from composite entity property names to property values
- Else: parameter value
.google.protobuf.Struct parameters = 3;public Context.Builder setParameters(com.google.protobuf.Struct.Builder builderForValue)
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: map
- Else: depending on parameter value type, could be one of string,
number, boolean, null, list or map
- MapValue value:
- If parameter's entity type is a composite entity:
map from composite entity property names to property values
- Else: parameter value
.google.protobuf.Struct parameters = 3;public Context.Builder mergeParameters(com.google.protobuf.Struct value)
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: map
- Else: depending on parameter value type, could be one of string,
number, boolean, null, list or map
- MapValue value:
- If parameter's entity type is a composite entity:
map from composite entity property names to property values
- Else: parameter value
.google.protobuf.Struct parameters = 3;public Context.Builder clearParameters()
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: map
- Else: depending on parameter value type, could be one of string,
number, boolean, null, list or map
- MapValue value:
- If parameter's entity type is a composite entity:
map from composite entity property names to property values
- Else: parameter value
.google.protobuf.Struct parameters = 3;public com.google.protobuf.Struct.Builder getParametersBuilder()
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: map
- Else: depending on parameter value type, could be one of string,
number, boolean, null, list or map
- MapValue value:
- If parameter's entity type is a composite entity:
map from composite entity property names to property values
- Else: parameter value
.google.protobuf.Struct parameters = 3;public com.google.protobuf.StructOrBuilder getParametersOrBuilder()
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: map
- Else: depending on parameter value type, could be one of string,
number, boolean, null, list or map
- MapValue value:
- If parameter's entity type is a composite entity:
map from composite entity property names to property values
- Else: parameter value
.google.protobuf.Struct parameters = 3;getParametersOrBuilder in interface ContextOrBuilderpublic final Context.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
setUnknownFields in interface com.google.protobuf.Message.BuildersetUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder>public final Context.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
mergeUnknownFields in interface com.google.protobuf.Message.BuildermergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Context.Builder>Copyright © 2023 Google LLC. All rights reserved.