Client for Dialogflow API

class dialogflow_v2.AgentsClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None)[source]

Agents are best described as Natural Language Understanding (NLU) modules that transform user requests into actionable data. You can include agents in your app, product, or service to determine user intent and respond to the user in a natural way.

After you create an agent, you can add Intents, Contexts, Entity Types, Webhooks, and so on to manage the flow of a conversation and match user input to predefined intents and actions.

You can create an agent using both Dialogflow Standard Edition and Dialogflow Enterprise Edition. For details, see Dialogflow Editions.

You can save your agent for backup or versioning by exporting the agent by using the ExportAgent method. You can import a saved agent by using the ImportAgent method.

Dialogflow provides several prebuilt agents for common conversation scenarios such as determining a date and time, converting currency, and so on.

For more information about agents, see the Dialogflow documentation.

Constructor.

Parameters:
  • (Union[AgentsGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.AgentsGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.
  • channel (grpc.Channel) – DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.
  • credentials (google.auth.credentials.Credentials) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.
  • client_config (dict) – DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.
  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
enums = <module 'dialogflow_v2.gapic.enums' from '/home/docs/checkouts/readthedocs.org/user_builds/dialogflow-python-client-v2/checkouts/latest/dialogflow_v2/gapic/enums.py'>
export_agent(parent, agent_uri=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Exports the specified agent to a ZIP file.

Operation <response: ExportAgentResponse>

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.AgentsClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> response = client.export_agent(parent)
>>>
>>> def callback(operation_future):
...     # Handle result.
...     result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Parameters:
  • parent (str) – Required. The project that the agent to export is associated with. Format: projects/<Project ID>.
  • agent_uri (str) – Optional. The Google Cloud Storage URI to export the agent to. The format of this URI must be gs://<bucket-name>/<object-name>. If left unspecified, the serialized agent is returned inline.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A _OperationFuture instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
classmethod from_service_account_file(filename, *args, **kwargs)[source]

Creates an instance of this client using the provided credentials file.

Parameters:
  • filename (str) – The path to the service account private key json file.
  • args – Additional arguments to pass to the constructor.
  • kwargs – Additional arguments to pass to the constructor.
Returns:

The constructed client.

Return type:

dialogflow_v2.AgentsClient

classmethod from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameters:
  • filename (str) – The path to the service account private key json file.
  • args – Additional arguments to pass to the constructor.
  • kwargs – Additional arguments to pass to the constructor.
Returns:

The constructed client.

Return type:

dialogflow_v2.AgentsClient

get_agent(parent, retry=<object object>, timeout=<object object>, metadata=None)[source]

Retrieves the specified agent.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.AgentsClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> response = client.get_agent(parent)
Parameters:
  • parent (str) – Required. The project that the agent to fetch is associated with. Format: projects/<Project ID>.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A Agent instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
import_agent(parent, agent_uri=None, agent_content=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Imports the specified agent from a ZIP file.

Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from ImportAgentRequest.

Operation <response: google.protobuf.Empty>

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.AgentsClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> response = client.import_agent(parent)
>>>
>>> def callback(operation_future):
...     # Handle result.
...     result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Parameters:
  • parent (str) – Required. The project that the agent to import is associated with. Format: projects/<Project ID>.
  • agent_uri (str) – The URI to a Google Cloud Storage file containing the agent to import. Note: The URI must start with “gs://”.
  • agent_content (bytes) –

    The agent to import.

    Example for how to import an agent via the command line:

    curl                       'https://dialogflow.googleapis.com/v2/projects/<project_name>/agent:import                       -X POST                        -H 'Authorization: Bearer '$(gcloud auth application-default
       print-access-token)                        -H 'Accept: application/json'                        -H 'Content-Type: application/json'                        --compressed                        --data-binary "{
          'agentContent': '$(cat <agent zip file> | base64 -w 0)'
       }"
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A _OperationFuture instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
classmethod project_path(project)[source]

Return a fully-qualified project string.

restore_agent(parent, agent_uri=None, agent_content=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Restores the specified agent from a ZIP file.

Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted.

Operation <response: google.protobuf.Empty>

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.AgentsClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> response = client.restore_agent(parent)
>>>
>>> def callback(operation_future):
...     # Handle result.
...     result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Parameters:
  • parent (str) – Required. The project that the agent to restore is associated with. Format: projects/<Project ID>.
  • agent_uri (str) – The URI to a Google Cloud Storage file containing the agent to restore. Note: The URI must start with “gs://”.
  • agent_content (bytes) –

    The agent to restore.

    Example for how to restore an agent via the command line:

    curl                       'https://dialogflow.googleapis.com/v2/projects/<project_name>/agent:restore                       -X POST                        -H 'Authorization: Bearer '$(gcloud auth application-default
       print-access-token)                        -H 'Accept: application/json'                        -H 'Content-Type: application/json'                        --compressed                        --data-binary "{
           'agentContent': '$(cat <agent zip file> | base64 -w 0)'
       }"
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A _OperationFuture instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
search_agents(parent, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns the list of agents.

Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id “-“. Refer to List Sub-Collections.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.AgentsClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> # Iterate over all results
>>> for element in client.search_agents(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.search_agents(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters:
  • parent (str) – Required. The project to list agents from. Format: projects/<Project ID or '-'>.
  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A PageIterator instance. By default, this is an iterable of Agent instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
train_agent(parent, retry=<object object>, timeout=<object object>, metadata=None)[source]

Trains the specified agent.

Operation <response: google.protobuf.Empty>

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.AgentsClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> response = client.train_agent(parent)
>>>
>>> def callback(operation_future):
...     # Handle result.
...     result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Parameters:
  • parent (str) – Required. The project that the agent to train is associated with. Format: projects/<Project ID>.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A _OperationFuture instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
class dialogflow_v2.ContextsClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None)[source]

A context represents additional information included with user input or with an intent returned by the Dialogflow API. Contexts are helpful for differentiating user input which may be vague or have a different meaning depending on additional details from your application such as user setting and preferences, previous user input, where the user is in your application, geographic location, and so on.

You can include contexts as input parameters of a DetectIntent (or StreamingDetectIntent) request, or as output contexts included in the returned intent. Contexts expire when an intent is matched, after the number of DetectIntent requests specified by the lifespan_count parameter, or after 20 minutes if no intents are matched for a DetectIntent request.

For more information about contexts, see the Dialogflow documentation.

Constructor.

Parameters:
  • (Union[ContextsGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.ContextsGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.
  • channel (grpc.Channel) – DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.
  • credentials (google.auth.credentials.Credentials) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.
  • client_config (dict) – DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.
  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
classmethod context_path(project, session, context)[source]

Return a fully-qualified context string.

create_context(parent, context, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a context.

If the specified context already exists, overrides the context.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.ContextsClient()
>>>
>>> parent = client.session_path('[PROJECT]', '[SESSION]')
>>>
>>> # TODO: Initialize `context`:
>>> context = {}
>>>
>>> response = client.create_context(parent, context)
Parameters:
  • parent (str) – Required. The session to create a context for. Format: projects/<Project ID>/agent/sessions/<Session ID>.
  • context (Union[dict, Context]) –

    Required. The context to create.

    If a dict is provided, it must be of the same form as the protobuf message Context

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A Context instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
delete_all_contexts(parent, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes all active contexts in the specified session.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.ContextsClient()
>>>
>>> parent = client.session_path('[PROJECT]', '[SESSION]')
>>>
>>> client.delete_all_contexts(parent)
Parameters:
  • parent (str) – Required. The name of the session to delete all contexts from. Format: projects/<Project ID>/agent/sessions/<Session ID>.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
delete_context(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes the specified context.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.ContextsClient()
>>>
>>> name = client.context_path('[PROJECT]', '[SESSION]', '[CONTEXT]')
>>>
>>> client.delete_context(name)
Parameters:
  • name (str) – Required. The name of the context to delete. Format: projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
enums = <module 'dialogflow_v2.gapic.enums' from '/home/docs/checkouts/readthedocs.org/user_builds/dialogflow-python-client-v2/checkouts/latest/dialogflow_v2/gapic/enums.py'>
classmethod from_service_account_file(filename, *args, **kwargs)[source]

Creates an instance of this client using the provided credentials file.

Parameters:
  • filename (str) – The path to the service account private key json file.
  • args – Additional arguments to pass to the constructor.
  • kwargs – Additional arguments to pass to the constructor.
Returns:

The constructed client.

Return type:

dialogflow_v2.ContextsClient

classmethod from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameters:
  • filename (str) – The path to the service account private key json file.
  • args – Additional arguments to pass to the constructor.
  • kwargs – Additional arguments to pass to the constructor.
Returns:

The constructed client.

Return type:

dialogflow_v2.ContextsClient

get_context(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Retrieves the specified context.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.ContextsClient()
>>>
>>> name = client.context_path('[PROJECT]', '[SESSION]', '[CONTEXT]')
>>>
>>> response = client.get_context(name)
Parameters:
  • name (str) – Required. The name of the context. Format: projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A Context instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
list_contexts(parent, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns the list of all contexts in the specified session.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.ContextsClient()
>>>
>>> parent = client.session_path('[PROJECT]', '[SESSION]')
>>>
>>> # Iterate over all results
>>> for element in client.list_contexts(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_contexts(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters:
  • parent (str) – Required. The session to list all contexts from. Format: projects/<Project ID>/agent/sessions/<Session ID>.
  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A PageIterator instance. By default, this is an iterable of Context instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
classmethod session_path(project, session)[source]

Return a fully-qualified session string.

update_context(context, update_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates the specified context.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.ContextsClient()
>>>
>>> # TODO: Initialize `context`:
>>> context = {}
>>>
>>> response = client.update_context(context)
Parameters:
  • context (Union[dict, Context]) –

    Required. The context to update.

    If a dict is provided, it must be of the same form as the protobuf message Context

  • update_mask (Union[dict, FieldMask]) –

    Optional. The mask to control which fields get updated.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A Context instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
class dialogflow_v2.EntityTypesClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None)[source]

Entities are extracted from user input and represent parameters that are meaningful to your application. For example, a date range, a proper name such as a geographic location or landmark, and so on. Entities represent actionable data for your application.

When you define an entity, you can also include synonyms that all map to that entity. For example, “soft drink”, “soda”, “pop”, and so on.

There are three types of entities:

  • System - entities that are defined by the Dialogflow API for common data types such as date, time, currency, and so on. A system entity is represented by the EntityType type.
  • Developer - entities that are defined by you that represent actionable data that is meaningful to your application. For example, you could define a pizza.sauce entity for red or white pizza sauce, a pizza.cheese entity for the different types of cheese on a pizza, a pizza.topping entity for different toppings, and so on. A developer entity is represented by the EntityType type.
  • User - entities that are built for an individual user such as favorites, preferences, playlists, and so on. A user entity is represented by the SessionEntityType type.

For more information about entity types, see the Dialogflow documentation.

Constructor.

Parameters:
  • (Union[EntityTypesGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.EntityTypesGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.
  • channel (grpc.Channel) – DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.
  • credentials (google.auth.credentials.Credentials) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.
  • client_config (dict) – DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.
  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
batch_create_entities(parent, entities, language_code=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates multiple new entities in the specified entity type.

Operation <response: google.protobuf.Empty>

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> parent = client.entity_type_path('[PROJECT]', '[ENTITY_TYPE]')
>>>
>>> # TODO: Initialize `entities`:
>>> entities = []
>>>
>>> response = client.batch_create_entities(parent, entities)
>>>
>>> def callback(operation_future):
...     # Handle result.
...     result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Parameters:
  • parent (str) – Required. The name of the entity type to create entities in. Format: projects/<Project ID>/agent/entityTypes/<Entity Type ID>.
  • entities (list[Union[dict, Entity]]) –

    Required. The entities to create.

    If a dict is provided, it must be of the same form as the protobuf message Entity

  • language_code (str) – Optional. The language of entity synonyms defined in entities. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A _OperationFuture instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
batch_delete_entities(parent, entity_values, language_code=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes entities in the specified entity type.

Operation <response: google.protobuf.Empty>

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> parent = client.entity_type_path('[PROJECT]', '[ENTITY_TYPE]')
>>>
>>> # TODO: Initialize `entity_values`:
>>> entity_values = []
>>>
>>> response = client.batch_delete_entities(parent, entity_values)
>>>
>>> def callback(operation_future):
...     # Handle result.
...     result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Parameters:
  • parent (str) – Required. The name of the entity type to delete entries for. Format: projects/<Project ID>/agent/entityTypes/<Entity Type ID>.
  • entity_values (list[str]) – Required. The canonical values of the entities to delete. Note that these are not fully-qualified names, i.e. they don’t start with projects/<Project ID>.
  • language_code (str) – Optional. The language of entity synonyms defined in entities. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A _OperationFuture instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
batch_delete_entity_types(parent, entity_type_names, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes entity types in the specified agent.

Operation <response: google.protobuf.Empty>

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> parent = client.project_agent_path('[PROJECT]')
>>>
>>> # TODO: Initialize `entity_type_names`:
>>> entity_type_names = []
>>>
>>> response = client.batch_delete_entity_types(parent, entity_type_names)
>>>
>>> def callback(operation_future):
...     # Handle result.
...     result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Parameters:
  • parent (str) – Required. The name of the agent to delete all entities types for. Format: projects/<Project ID>/agent.
  • entity_type_names (list[str]) – Required. The names entity types to delete. All names must point to the same agent as parent.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A _OperationFuture instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
batch_update_entities(parent, entities, language_code=None, update_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates or creates multiple entities in the specified entity type. This method does not affect entities in the entity type that aren’t explicitly specified in the request.

Operation <response: google.protobuf.Empty>

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> parent = client.entity_type_path('[PROJECT]', '[ENTITY_TYPE]')
>>>
>>> # TODO: Initialize `entities`:
>>> entities = []
>>>
>>> response = client.batch_update_entities(parent, entities)
>>>
>>> def callback(operation_future):
...     # Handle result.
...     result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Parameters:
  • parent (str) – Required. The name of the entity type to update or create entities in. Format: projects/<Project ID>/agent/entityTypes/<Entity Type ID>.
  • entities (list[Union[dict, Entity]]) –

    Required. The entities to update or create.

    If a dict is provided, it must be of the same form as the protobuf message Entity

  • language_code (str) – Optional. The language of entity synonyms defined in entities. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • update_mask (Union[dict, FieldMask]) –

    Optional. The mask to control which fields get updated.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A _OperationFuture instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
batch_update_entity_types(parent, entity_type_batch_uri=None, entity_type_batch_inline=None, language_code=None, update_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates/Creates multiple entity types in the specified agent.

Operation <response: BatchUpdateEntityTypesResponse>

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> parent = client.project_agent_path('[PROJECT]')
>>>
>>> response = client.batch_update_entity_types(parent)
>>>
>>> def callback(operation_future):
...     # Handle result.
...     result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Parameters:
  • parent (str) – Required. The name of the agent to update or create entity types in. Format: projects/<Project ID>/agent.
  • entity_type_batch_uri (str) – The URI to a Google Cloud Storage file containing entity types to update or create. The file format can either be a serialized proto (of EntityBatch type) or a JSON object. Note: The URI must start with “gs://”.
  • entity_type_batch_inline (Union[dict, EntityTypeBatch]) –

    The collection of entity types to update or create.

    If a dict is provided, it must be of the same form as the protobuf message EntityTypeBatch

  • language_code (str) – Optional. The language of entity synonyms defined in entity_types. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • update_mask (Union[dict, FieldMask]) –

    Optional. The mask to control which fields get updated.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A _OperationFuture instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
create_entity_type(parent, entity_type, language_code=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates an entity type in the specified agent.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> parent = client.project_agent_path('[PROJECT]')
>>>
>>> # TODO: Initialize `entity_type`:
>>> entity_type = {}
>>>
>>> response = client.create_entity_type(parent, entity_type)
Parameters:
  • parent (str) – Required. The agent to create a entity type for. Format: projects/<Project ID>/agent.
  • entity_type (Union[dict, EntityType]) –

    Required. The entity type to create.

    If a dict is provided, it must be of the same form as the protobuf message EntityType

  • language_code (str) – Optional. The language of entity synonyms defined in entity_type. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A EntityType instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
delete_entity_type(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes the specified entity type.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> name = client.entity_type_path('[PROJECT]', '[ENTITY_TYPE]')
>>>
>>> client.delete_entity_type(name)
Parameters:
  • name (str) – Required. The name of the entity type to delete. Format: projects/<Project ID>/agent/entityTypes/<EntityType ID>.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
classmethod entity_type_path(project, entity_type)[source]

Return a fully-qualified entity_type string.

enums = <module 'dialogflow_v2.gapic.enums' from '/home/docs/checkouts/readthedocs.org/user_builds/dialogflow-python-client-v2/checkouts/latest/dialogflow_v2/gapic/enums.py'>
classmethod from_service_account_file(filename, *args, **kwargs)[source]

Creates an instance of this client using the provided credentials file.

Parameters:
  • filename (str) – The path to the service account private key json file.
  • args – Additional arguments to pass to the constructor.
  • kwargs – Additional arguments to pass to the constructor.
Returns:

The constructed client.

Return type:

dialogflow_v2.EntityTypesClient

classmethod from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameters:
  • filename (str) – The path to the service account private key json file.
  • args – Additional arguments to pass to the constructor.
  • kwargs – Additional arguments to pass to the constructor.
Returns:

The constructed client.

Return type:

dialogflow_v2.EntityTypesClient

get_entity_type(name, language_code=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Retrieves the specified entity type.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> name = client.entity_type_path('[PROJECT]', '[ENTITY_TYPE]')
>>>
>>> response = client.get_entity_type(name)
Parameters:
  • name (str) – Required. The name of the entity type. Format: projects/<Project ID>/agent/entityTypes/<EntityType ID>.
  • language_code (str) – Optional. The language to retrieve entity synonyms for. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A EntityType instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
list_entity_types(parent, language_code=None, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns the list of all entity types in the specified agent.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> parent = client.project_agent_path('[PROJECT]')
>>>
>>> # Iterate over all results
>>> for element in client.list_entity_types(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_entity_types(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters:
  • parent (str) – Required. The agent to list all entity types from. Format: projects/<Project ID>/agent.
  • language_code (str) – Optional. The language to list entity synonyms for. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A PageIterator instance. By default, this is an iterable of EntityType instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
classmethod project_agent_path(project)[source]

Return a fully-qualified project_agent string.

update_entity_type(entity_type, language_code=None, update_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates the specified entity type.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.EntityTypesClient()
>>>
>>> # TODO: Initialize `entity_type`:
>>> entity_type = {}
>>>
>>> response = client.update_entity_type(entity_type)
Parameters:
  • entity_type (Union[dict, EntityType]) –

    Required. The entity type to update.

    If a dict is provided, it must be of the same form as the protobuf message EntityType

  • language_code (str) – Optional. The language of entity synonyms defined in entity_type. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • update_mask (Union[dict, FieldMask]) –

    Optional. The mask to control which fields get updated.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A EntityType instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
class dialogflow_v2.IntentsClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None)[source]

An intent represents a mapping between input from a user and an action to be taken by your application. When you pass user input to the DetectIntent (or StreamingDetectIntent) method, the Dialogflow API analyzes the input and searches for a matching intent. If no match is found, the Dialogflow API returns a fallback intent (is_fallback = true).

You can provide additional information for the Dialogflow API to use to match user input to an intent by adding the following to your intent.

  • Contexts - provide additional context for intent analysis. For example, if an intent is related to an object in your application that plays music, you can provide a context to determine when to match the intent if the user input is “turn it off”. You can include a context that matches the intent when there is previous user input of “play music”, and not when there is previous user input of “turn on the light”.
  • Events - allow for matching an intent by using an event name instead of user input. Your application can provide an event name and related parameters to the Dialogflow API to match an intent. For example, when your application starts, you can send a welcome event with a user name parameter to the Dialogflow API to match an intent with a personalized welcome message for the user.
  • Training phrases - provide examples of user input to train the Dialogflow API agent to better match intents.

For more information about intents, see the Dialogflow documentation.

Constructor.

Parameters:
  • (Union[IntentsGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.IntentsGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.
  • channel (grpc.Channel) – DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.
  • credentials (google.auth.credentials.Credentials) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.
  • client_config (dict) – DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.
  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
classmethod agent_path(project, agent)[source]

Return a fully-qualified agent string.

batch_delete_intents(parent, intents, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes intents in the specified agent.

Operation <response: google.protobuf.Empty>

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.IntentsClient()
>>>
>>> parent = client.project_agent_path('[PROJECT]')
>>>
>>> # TODO: Initialize `intents`:
>>> intents = []
>>>
>>> response = client.batch_delete_intents(parent, intents)
>>>
>>> def callback(operation_future):
...     # Handle result.
...     result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Parameters:
  • parent (str) – Required. The name of the agent to delete all entities types for. Format: projects/<Project ID>/agent.
  • intents (list[Union[dict, Intent]]) –

    Required. The collection of intents to delete. Only intent name must be filled in.

    If a dict is provided, it must be of the same form as the protobuf message Intent

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A _OperationFuture instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
batch_update_intents(parent, language_code, intent_batch_uri=None, intent_batch_inline=None, update_mask=None, intent_view=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates/Creates multiple intents in the specified agent.

Operation <response: BatchUpdateIntentsResponse>

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.IntentsClient()
>>>
>>> parent = client.project_agent_path('[PROJECT]')
>>>
>>> # TODO: Initialize `language_code`:
>>> language_code = ''
>>>
>>> response = client.batch_update_intents(parent, language_code)
>>>
>>> def callback(operation_future):
...     # Handle result.
...     result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Parameters:
  • parent (str) – Required. The name of the agent to update or create intents in. Format: projects/<Project ID>/agent.
  • language_code (str) – Optional. The language of training phrases, parameters and rich messages defined in intents. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • intent_batch_uri (str) – The URI to a Google Cloud Storage file containing intents to update or create. The file format can either be a serialized proto (of IntentBatch type) or JSON object. Note: The URI must start with “gs://”.
  • intent_batch_inline (Union[dict, IntentBatch]) –

    The collection of intents to update or create.

    If a dict is provided, it must be of the same form as the protobuf message IntentBatch

  • update_mask (Union[dict, FieldMask]) –

    Optional. The mask to control which fields get updated.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • intent_view (IntentView) – Optional. The resource view to apply to the returned intent.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A _OperationFuture instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
create_intent(parent, intent, language_code=None, intent_view=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates an intent in the specified agent.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.IntentsClient()
>>>
>>> parent = client.project_agent_path('[PROJECT]')
>>>
>>> # TODO: Initialize `intent`:
>>> intent = {}
>>>
>>> response = client.create_intent(parent, intent)
Parameters:
  • parent (str) – Required. The agent to create a intent for. Format: projects/<Project ID>/agent.
  • intent (Union[dict, Intent]) –

    Required. The intent to create.

    If a dict is provided, it must be of the same form as the protobuf message Intent

  • language_code (str) – Optional. The language of training phrases, parameters and rich messages defined in intent. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • intent_view (IntentView) – Optional. The resource view to apply to the returned intent.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A Intent instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
delete_intent(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes the specified intent and its direct or indirect followup intents.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.IntentsClient()
>>>
>>> name = client.intent_path('[PROJECT]', '[INTENT]')
>>>
>>> client.delete_intent(name)
Parameters:
  • name (str) – Required. The name of the intent to delete. If this intent has direct or indirect followup intents, we also delete them. Format: projects/<Project ID>/agent/intents/<Intent ID>.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
enums = <module 'dialogflow_v2.gapic.enums' from '/home/docs/checkouts/readthedocs.org/user_builds/dialogflow-python-client-v2/checkouts/latest/dialogflow_v2/gapic/enums.py'>
classmethod from_service_account_file(filename, *args, **kwargs)[source]

Creates an instance of this client using the provided credentials file.

Parameters:
  • filename (str) – The path to the service account private key json file.
  • args – Additional arguments to pass to the constructor.
  • kwargs – Additional arguments to pass to the constructor.
Returns:

The constructed client.

Return type:

dialogflow_v2.IntentsClient

classmethod from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameters:
  • filename (str) – The path to the service account private key json file.
  • args – Additional arguments to pass to the constructor.
  • kwargs – Additional arguments to pass to the constructor.
Returns:

The constructed client.

Return type:

dialogflow_v2.IntentsClient

get_intent(name, language_code=None, intent_view=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Retrieves the specified intent.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.IntentsClient()
>>>
>>> name = client.intent_path('[PROJECT]', '[INTENT]')
>>>
>>> response = client.get_intent(name)
Parameters:
  • name (str) – Required. The name of the intent. Format: projects/<Project ID>/agent/intents/<Intent ID>.
  • language_code (str) – Optional. The language to retrieve training phrases, parameters and rich messages for. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • intent_view (IntentView) – Optional. The resource view to apply to the returned intent.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A Intent instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
classmethod intent_path(project, intent)[source]

Return a fully-qualified intent string.

list_intents(parent, language_code=None, intent_view=None, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns the list of all intents in the specified agent.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.IntentsClient()
>>>
>>> parent = client.project_agent_path('[PROJECT]')
>>>
>>> # Iterate over all results
>>> for element in client.list_intents(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_intents(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters:
  • parent (str) – Required. The agent to list all intents from. Format: projects/<Project ID>/agent.
  • language_code (str) – Optional. The language to list training phrases, parameters and rich messages for. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • intent_view (IntentView) – Optional. The resource view to apply to the returned intent.
  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A PageIterator instance. By default, this is an iterable of Intent instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
classmethod project_agent_path(project)[source]

Return a fully-qualified project_agent string.

update_intent(intent, language_code, update_mask=None, intent_view=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates the specified intent.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.IntentsClient()
>>>
>>> # TODO: Initialize `intent`:
>>> intent = {}
>>>
>>> # TODO: Initialize `language_code`:
>>> language_code = ''
>>>
>>> response = client.update_intent(intent, language_code)
Parameters:
  • intent (Union[dict, Intent]) –

    Required. The intent to update.

    If a dict is provided, it must be of the same form as the protobuf message Intent

  • language_code (str) – Optional. The language of training phrases, parameters and rich messages defined in intent. If not specified, the agent’s default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.
  • update_mask (Union[dict, FieldMask]) –

    Optional. The mask to control which fields get updated.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • intent_view (IntentView) – Optional. The resource view to apply to the returned intent.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A Intent instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
class dialogflow_v2.SessionEntityTypesClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None)[source]

Entities are extracted from user input and represent parameters that are meaningful to your application. For example, a date range, a proper name such as a geographic location or landmark, and so on. Entities represent actionable data for your application.

Session entity types are referred to as User entity types and are entities that are built for an individual user such as favorites, preferences, playlists, and so on. You can redefine a session entity type at the session level.

For more information about entity types, see the Dialogflow documentation.

Constructor.

Parameters:
  • (Union[SessionEntityTypesGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.SessionEntityTypesGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.
  • channel (grpc.Channel) – DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.
  • credentials (google.auth.credentials.Credentials) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.
  • client_config (dict) – DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.
  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
create_session_entity_type(parent, session_entity_type, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a session entity type.

If the specified session entity type already exists, overrides the session entity type.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.SessionEntityTypesClient()
>>>
>>> parent = client.session_path('[PROJECT]', '[SESSION]')
>>>
>>> # TODO: Initialize `session_entity_type`:
>>> session_entity_type = {}
>>>
>>> response = client.create_session_entity_type(parent, session_entity_type)
Parameters:
  • parent (str) – Required. The session to create a session entity type for. Format: projects/<Project ID>/agent/sessions/<Session ID>.
  • session_entity_type (Union[dict, SessionEntityType]) –

    Required. The session entity type to create.

    If a dict is provided, it must be of the same form as the protobuf message SessionEntityType

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A SessionEntityType instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
delete_session_entity_type(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes the specified session entity type.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.SessionEntityTypesClient()
>>>
>>> name = client.session_entity_type_path('[PROJECT]', '[SESSION]', '[ENTITY_TYPE]')
>>>
>>> client.delete_session_entity_type(name)
Parameters:
  • name (str) – Required. The name of the entity type to delete. Format: projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type Display Name>.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
enums = <module 'dialogflow_v2.gapic.enums' from '/home/docs/checkouts/readthedocs.org/user_builds/dialogflow-python-client-v2/checkouts/latest/dialogflow_v2/gapic/enums.py'>
classmethod from_service_account_file(filename, *args, **kwargs)[source]

Creates an instance of this client using the provided credentials file.

Parameters:
  • filename (str) – The path to the service account private key json file.
  • args – Additional arguments to pass to the constructor.
  • kwargs – Additional arguments to pass to the constructor.
Returns:

The constructed client.

Return type:

dialogflow_v2.SessionEntityTypesClient

classmethod from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameters:
  • filename (str) – The path to the service account private key json file.
  • args – Additional arguments to pass to the constructor.
  • kwargs – Additional arguments to pass to the constructor.
Returns:

The constructed client.

Return type:

dialogflow_v2.SessionEntityTypesClient

get_session_entity_type(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Retrieves the specified session entity type.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.SessionEntityTypesClient()
>>>
>>> name = client.session_entity_type_path('[PROJECT]', '[SESSION]', '[ENTITY_TYPE]')
>>>
>>> response = client.get_session_entity_type(name)
Parameters:
  • name (str) – Required. The name of the session entity type. Format: projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type Display Name>.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A SessionEntityType instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
list_session_entity_types(parent, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns the list of all session entity types in the specified session.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.SessionEntityTypesClient()
>>>
>>> parent = client.session_path('[PROJECT]', '[SESSION]')
>>>
>>> # Iterate over all results
>>> for element in client.list_session_entity_types(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_session_entity_types(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters:
  • parent (str) – Required. The session to list all session entity types from. Format: projects/<Project ID>/agent/sessions/<Session ID>.
  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A PageIterator instance. By default, this is an iterable of SessionEntityType instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
classmethod session_entity_type_path(project, session, entity_type)[source]

Return a fully-qualified session_entity_type string.

classmethod session_path(project, session)[source]

Return a fully-qualified session string.

update_session_entity_type(session_entity_type, update_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates the specified session entity type.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.SessionEntityTypesClient()
>>>
>>> # TODO: Initialize `session_entity_type`:
>>> session_entity_type = {}
>>>
>>> response = client.update_session_entity_type(session_entity_type)
Parameters:
  • session_entity_type (Union[dict, SessionEntityType]) –

    Required. The entity type to update. Format: projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type Display Name>.

    If a dict is provided, it must be of the same form as the protobuf message SessionEntityType

  • update_mask (Union[dict, FieldMask]) –

    Optional. The mask to control which fields get updated.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A SessionEntityType instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
class dialogflow_v2.SessionsClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None)[source]

A session represents an interaction with a user. You retrieve user input and pass it to the DetectIntent (or StreamingDetectIntent) method to determine user intent and respond.

Constructor.

Parameters:
  • (Union[SessionsGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.SessionsGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.
  • channel (grpc.Channel) – DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.
  • credentials (google.auth.credentials.Credentials) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.
  • client_config (dict) – DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.
  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.
detect_intent(session, query_input, query_params=None, output_audio_config=None, input_audio=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

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.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.SessionsClient()
>>>
>>> session = client.session_path('[PROJECT]', '[SESSION]')
>>>
>>> # TODO: Initialize `query_input`:
>>> query_input = {}
>>>
>>> response = client.detect_intent(session, query_input)
Parameters:
  • session (str) – Required. The name of the session this query is sent to. Format: projects/<Project ID>/agent/sessions/<Session ID>. It’s up to the API caller to choose an appropriate session ID. It can be a random number or some type of user identifier (preferably hashed). The length of the session ID must not exceed 36 bytes.
  • query_input (Union[dict, 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.

    If a dict is provided, it must be of the same form as the protobuf message QueryInput

  • query_params (Union[dict, QueryParameters]) –

    Optional. The parameters of this query.

    If a dict is provided, it must be of the same form as the protobuf message QueryParameters

  • output_audio_config (Union[dict, OutputAudioConfig]) –

    Optional. 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.

    If a dict is provided, it must be of the same form as the protobuf message OutputAudioConfig

  • input_audio (bytes) – Optional. 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.
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

A DetectIntentResponse instance.

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.
enums = <module 'dialogflow_v2.gapic.enums' from '/home/docs/checkouts/readthedocs.org/user_builds/dialogflow-python-client-v2/checkouts/latest/dialogflow_v2/gapic/enums.py'>
classmethod from_service_account_file(filename, *args, **kwargs)[source]

Creates an instance of this client using the provided credentials file.

Parameters:
  • filename (str) – The path to the service account private key json file.
  • args – Additional arguments to pass to the constructor.
  • kwargs – Additional arguments to pass to the constructor.
Returns:

The constructed client.

Return type:

dialogflow_v2.SessionsClient

classmethod from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameters:
  • filename (str) – The path to the service account private key json file.
  • args – Additional arguments to pass to the constructor.
  • kwargs – Additional arguments to pass to the constructor.
Returns:

The constructed client.

Return type:

dialogflow_v2.SessionsClient

classmethod session_path(project, session)[source]

Return a fully-qualified session string.

streaming_detect_intent(requests, retry=<object object>, timeout=<object object>, metadata=None)[source]

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).

EXPERIMENTAL: This method interface might change in the future.

Example

>>> import dialogflow_v2
>>>
>>> client = dialogflow_v2.SessionsClient()
>>>
>>> # TODO: Initialize `session`:
>>> session = ''
>>>
>>> # TODO: Initialize `query_input`:
>>> query_input = {}
>>> request = {'session': session, 'query_input': query_input}
>>>
>>> requests = [request]
>>> for element in client.streaming_detect_intent(requests):
...     # process element
...     pass
Parameters:
  • requests (iterator[dict|google.cloud.dialogflow_v2.proto.session_pb2.StreamingDetectIntentRequest]) – The input objects. If a dict is provided, it must be of the same form as the protobuf message StreamingDetectIntentRequest
  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.
  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.
Returns:

Iterable[~google.cloud.dialogflow_v2.types.StreamingDetectIntentResponse].

Raises:
  • google.api_core.exceptions.GoogleAPICallError – If the request failed for any reason.
  • google.api_core.exceptions.RetryError – If the request failed due to a retryable error and retry attempts failed.
  • ValueError – If the parameters are invalid.