Skip to content

Commit

Permalink
Fix #76 by adding replacement patterns to dialogflow (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
crwilcox authored Jul 19, 2018
1 parent 6fb1dd6 commit 26a8860
Show file tree
Hide file tree
Showing 16 changed files with 116 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = agents_grpc_transport.AgentsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = agents_grpc_transport.AgentsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = contexts_grpc_transport.ContextsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = contexts_grpc_transport.ContextsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = entity_types_grpc_transport.EntityTypesGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = entity_types_grpc_transport.EntityTypesGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class IntentsClient(object):
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
Expand All @@ -73,15 +72,13 @@ class IntentsClient(object):
\"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
Expand Down Expand Up @@ -202,11 +199,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = intents_grpc_transport.IntentsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = intents_grpc_transport.IntentsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = session_entity_types_grpc_transport.SessionEntityTypesGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = session_entity_types_grpc_transport.SessionEntityTypesGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = sessions_grpc_transport.SessionsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = sessions_grpc_transport.SessionsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = agents_grpc_transport.AgentsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = agents_grpc_transport.AgentsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down Expand Up @@ -539,19 +540,7 @@ def import_agent(self,
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:
<pre>curl \
'https://dialogflow.googleapis.com/v2beta1/projects/&lt;project_name&gt;/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 &lt;agent zip file&gt; | base64 -w 0)'
}\"</pre>
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
be retried.
Expand Down Expand Up @@ -645,19 +634,7 @@ def restore_agent(self,
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:
<pre>curl \
'https://dialogflow.googleapis.com/v2beta1/projects/&lt;project_name&gt;/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 &lt;agent zip file&gt; | base64 -w 0)'
}\"</pre>
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
be retried.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = contexts_grpc_transport.ContextsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = contexts_grpc_transport.ContextsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):
kwargs: Additional arguments to pass to the constructor.
Returns:
DocumentsClient: The constructed client.
dialogflow_v2beta1.DocumentsClient: The constructed client.
"""
credentials = service_account.Credentials.from_service_account_file(
filename)
Expand Down Expand Up @@ -157,11 +157,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = documents_grpc_transport.DocumentsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = documents_grpc_transport.DocumentsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,17 @@ class EntityTypesClient(object):
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][google.cloud.dialogflow.v2beta1.SessionEntityType] type.
Expand Down Expand Up @@ -189,11 +186,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = entity_types_grpc_transport.EntityTypesGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = entity_types_grpc_transport.EntityTypesGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class IntentsClient(object):
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
Expand All @@ -75,15 +74,13 @@ class IntentsClient(object):
\"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
Expand Down Expand Up @@ -195,11 +192,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = intents_grpc_transport.IntentsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = intents_grpc_transport.IntentsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):
kwargs: Additional arguments to pass to the constructor.
Returns:
KnowledgeBasesClient: The constructed client.
dialogflow_v2beta1.KnowledgeBasesClient: The constructed client.
"""
credentials = service_account.Credentials.from_service_account_file(
filename)
Expand Down Expand Up @@ -163,11 +163,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = knowledge_bases_grpc_transport.KnowledgeBasesGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = knowledge_bases_grpc_transport.KnowledgeBasesGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = session_entity_types_grpc_transport.SessionEntityTypesGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = session_entity_types_grpc_transport.SessionEntityTypesGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,12 @@ def __init__(self,
'Received both a transport instance and '
'credentials; these are mutually exclusive.')
self.transport = transport
self.transport = sessions_grpc_transport.SessionsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)
else:
self.transport = sessions_grpc_transport.SessionsGrpcTransport(
address=self.SERVICE_ADDRESS,
channel=channel,
credentials=credentials,
)

if client_info is None:
client_info = (
Expand Down
Loading

0 comments on commit 26a8860

Please sign in to comment.