SessionsClient

SessionsClient

A service used for session interactions.

For more information, see the API interactions guide.

Constructor

new SessionsClient(optionsopt)

Construct an instance of SessionsClient.

Parameters:
Name Type Attributes Description
options object <optional>

The configuration object. See the subsequent parameters for more details.

Properties
Name Type Attributes Description
credentials object <optional>

Credentials object.

Properties
Name Type Attributes Description
client_email string <optional>
private_key string <optional>
email string <optional>

Account email address. Required when using a .pem or .p12 keyFilename.

keyFilename string <optional>

Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the projectId option below is not necessary. NOTE: .pem and .p12 require you to specify options.email as well.

port number <optional>

The port on which to connect to the remote host.

projectId string <optional>

The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable GCLOUD_PROJECT for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.

apiEndpoint string <optional>

The domain name of the API remote host.

Members

(static) apiEndpoint

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

(static) port

The port for this API service.

(static) scopes

The scopes needed to make gRPC calls for every method defined in this service.

(static) servicePath

The DNS address for this API service.

Methods

agentPath(project) → {string}

Return a fully-qualified agent resource name string.

Parameters:
Name Type Description
project string

close()

Terminate the GRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

detectIntent(request, optionsopt) → {Promise}

Processes a natural language query and returns structured, actionable data as a result. This method is not idempotent, because it may cause contexts and session entity types to be updated, which in turn might affect results of future queries.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
session string

Required. The name of the session this query is sent to. 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 are using "-". It's up to the API caller to choose an appropriate Session ID and User Id. They can be a random number or some type of user and session identifiers (preferably hashed). The length of the Session ID and User ID must not exceed 36 characters.

For more information, see the API interactions guide.

queryParams google.cloud.dialogflow.v2.QueryParameters

The parameters of this query.

queryInput google.cloud.dialogflow.v2.QueryInput

Required. The input specification. It can be set to:

  1. an audio config which instructs the speech recognizer how to process the speech audio,

  2. a conversational query in the form of text, or

  3. an event that specifies which intent to trigger.

outputAudioConfig google.cloud.dialogflow.v2.OutputAudioConfig

Instructs the speech synthesizer how to generate the output audio. If this field is not set and agent-level speech synthesizer is not configured, no output audio is generated.

outputAudioConfigMask google.protobuf.FieldMask

Mask for output_audio_config indicating which settings in this request-level config should override speech synthesizer settings defined at agent-level.

If unspecified or empty, output_audio_config replaces the agent-level config in its entirety.

inputAudio Buffer

The natural language speech audio to be processed. This field should be populated iff query_input is set to an input audio config. A single request can contain up to 1 minute of speech audio data.

options object <optional>

Call options. See CallOptions for more details.

entityTypePath(project, entity_type) → {string}

Return a fully-qualified entityType resource name string.

Parameters:
Name Type Description
project string
entity_type string

environmentPath(project, environment) → {string}

Return a fully-qualified environment resource name string.

Parameters:
Name Type Description
project string
environment string

getProjectId(callback)

Return the project ID used by this class.

Parameters:
Name Type Description
callback function

the callback to be called with the current project Id.

initialize() → {Promise}

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

intentPath(project, intent) → {string}

Return a fully-qualified intent resource name string.

Parameters:
Name Type Description
project string
intent string

matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName) → {string}

Parse the context from ProjectAgentEnvironmentUserSessionContext resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionContextName string

A fully-qualified path representing project_agent_environment_user_session_context resource.

matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName) → {string}

Parse the context from ProjectAgentSessionContext resource.

Parameters:
Name Type Description
projectAgentSessionContextName string

A fully-qualified path representing project_agent_session_context resource.

matchEntityTypeFromEntityTypeName(entityTypeName) → {string}

Parse the entity_type from EntityType resource.

Parameters:
Name Type Description
entityTypeName string

A fully-qualified path representing EntityType resource.

matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName) → {string}

Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionEntityTypeName string

A fully-qualified path representing project_agent_environment_user_session_entity_type resource.

matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName) → {string}

Parse the entity_type from ProjectAgentSessionEntityType resource.

Parameters:
Name Type Description
projectAgentSessionEntityTypeName string

A fully-qualified path representing project_agent_session_entity_type resource.

matchEnvironmentFromEnvironmentName(environmentName) → {string}

Parse the environment from Environment resource.

Parameters:
Name Type Description
environmentName string

A fully-qualified path representing Environment resource.

matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName) → {string}

Parse the environment from ProjectAgentEnvironmentUserSessionContext resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionContextName string

A fully-qualified path representing project_agent_environment_user_session_context resource.

matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName) → {string}

Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionEntityTypeName string

A fully-qualified path representing project_agent_environment_user_session_entity_type resource.

matchEnvironmentFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName) → {string}

Parse the environment from ProjectAgentEnvironmentUserSession resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionName string

A fully-qualified path representing project_agent_environment_user_session resource.

matchIntentFromIntentName(intentName) → {string}

Parse the intent from Intent resource.

Parameters:
Name Type Description
intentName string

A fully-qualified path representing Intent resource.

matchProjectFromAgentName(agentName) → {string}

Parse the project from Agent resource.

Parameters:
Name Type Description
agentName string

A fully-qualified path representing Agent resource.

matchProjectFromEntityTypeName(entityTypeName) → {string}

Parse the project from EntityType resource.

Parameters:
Name Type Description
entityTypeName string

A fully-qualified path representing EntityType resource.

matchProjectFromEnvironmentName(environmentName) → {string}

Parse the project from Environment resource.

Parameters:
Name Type Description
environmentName string

A fully-qualified path representing Environment resource.

matchProjectFromIntentName(intentName) → {string}

Parse the project from Intent resource.

Parameters:
Name Type Description
intentName string

A fully-qualified path representing Intent resource.

matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName) → {string}

Parse the project from ProjectAgentEnvironmentUserSessionContext resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionContextName string

A fully-qualified path representing project_agent_environment_user_session_context resource.

matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName) → {string}

Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionEntityTypeName string

A fully-qualified path representing project_agent_environment_user_session_entity_type resource.

matchProjectFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName) → {string}

Parse the project from ProjectAgentEnvironmentUserSession resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionName string

A fully-qualified path representing project_agent_environment_user_session resource.

matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName) → {string}

Parse the project from ProjectAgentSessionContext resource.

Parameters:
Name Type Description
projectAgentSessionContextName string

A fully-qualified path representing project_agent_session_context resource.

matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName) → {string}

Parse the project from ProjectAgentSessionEntityType resource.

Parameters:
Name Type Description
projectAgentSessionEntityTypeName string

A fully-qualified path representing project_agent_session_entity_type resource.

matchProjectFromProjectAgentSessionName(projectAgentSessionName) → {string}

Parse the project from ProjectAgentSession resource.

Parameters:
Name Type Description
projectAgentSessionName string

A fully-qualified path representing project_agent_session resource.

matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName) → {string}

Parse the session from ProjectAgentEnvironmentUserSessionContext resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionContextName string

A fully-qualified path representing project_agent_environment_user_session_context resource.

matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName) → {string}

Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionEntityTypeName string

A fully-qualified path representing project_agent_environment_user_session_entity_type resource.

matchSessionFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName) → {string}

Parse the session from ProjectAgentEnvironmentUserSession resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionName string

A fully-qualified path representing project_agent_environment_user_session resource.

matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName) → {string}

Parse the session from ProjectAgentSessionContext resource.

Parameters:
Name Type Description
projectAgentSessionContextName string

A fully-qualified path representing project_agent_session_context resource.

matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName) → {string}

Parse the session from ProjectAgentSessionEntityType resource.

Parameters:
Name Type Description
projectAgentSessionEntityTypeName string

A fully-qualified path representing project_agent_session_entity_type resource.

matchSessionFromProjectAgentSessionName(projectAgentSessionName) → {string}

Parse the session from ProjectAgentSession resource.

Parameters:
Name Type Description
projectAgentSessionName string

A fully-qualified path representing project_agent_session resource.

matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName) → {string}

Parse the user from ProjectAgentEnvironmentUserSessionContext resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionContextName string

A fully-qualified path representing project_agent_environment_user_session_context resource.

matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName) → {string}

Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionEntityTypeName string

A fully-qualified path representing project_agent_environment_user_session_entity_type resource.

matchUserFromProjectAgentEnvironmentUserSessionName(projectAgentEnvironmentUserSessionName) → {string}

Parse the user from ProjectAgentEnvironmentUserSession resource.

Parameters:
Name Type Description
projectAgentEnvironmentUserSessionName string

A fully-qualified path representing project_agent_environment_user_session resource.

projectAgentEnvironmentUserSessionContextPath(project, environment, user, session, context) → {string}

Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string.

Parameters:
Name Type Description
project string
environment string
user string
session string
context string

projectAgentEnvironmentUserSessionEntityTypePath(project, environment, user, session, entity_type) → {string}

Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string.

Parameters:
Name Type Description
project string
environment string
user string
session string
entity_type string

projectAgentEnvironmentUserSessionPath(project, environment, user, session) → {string}

Return a fully-qualified projectAgentEnvironmentUserSession resource name string.

Parameters:
Name Type Description
project string
environment string
user string
session string

projectAgentSessionContextPath(project, session, context) → {string}

Return a fully-qualified projectAgentSessionContext resource name string.

Parameters:
Name Type Description
project string
session string
context string

projectAgentSessionEntityTypePath(project, session, entity_type) → {string}

Return a fully-qualified projectAgentSessionEntityType resource name string.

Parameters:
Name Type Description
project string
session string
entity_type string

projectAgentSessionPath(project, session) → {string}

Return a fully-qualified projectAgentSession resource name string.

Parameters:
Name Type Description
project string
session string

streamingDetectIntent(optionsopt) → {Stream}

Processes a natural language query in audio format in a streaming fashion and returns structured, actionable data as a result. This method is only available via the gRPC API (not REST).

Parameters:
Name Type Attributes Description
options object <optional>

Call options. See CallOptions for more details.