ConversationsClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.dialogflow_v2beta1.services.conversations.transports.base.ConversationsTransport, typing.Callable[[...], google.cloud.dialogflow_v2beta1.services.conversations.transports.base.ConversationsTransport]]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Service for managing Conversations.
Properties
api_endpoint
Return the API endpoint used by the client instance.
Returns | |
---|---|
Type | Description |
str |
The API endpoint used by the client instance. |
transport
Returns the transport used by the client instance.
Returns | |
---|---|
Type | Description |
ConversationsTransport |
The transport used by the client instance. |
universe_domain
Return the universe domain used by the client instance.
Returns | |
---|---|
Type | Description |
str |
The universe domain used by the client instance. |
Methods
ConversationsClient
ConversationsClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.dialogflow_v2beta1.services.conversations.transports.base.ConversationsTransport, typing.Callable[[...], google.cloud.dialogflow_v2beta1.services.conversations.transports.base.ConversationsTransport]]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Instantiates the conversations client.
Parameters | |
---|---|
Name | Description |
credentials |
Optional[google.auth.credentials.Credentials]
The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. |
transport |
Optional[Union[str,ConversationsTransport,Callable[..., ConversationsTransport]]]
The transport to use, or a Callable that constructs and returns a new transport. If a Callable is given, it will be called with the same set of initialization arguments as used in the ConversationsTransport constructor. If set to None, a transport is chosen automatically. |
client_options |
Optional[Union[google.api_core.client_options.ClientOptions, dict]]
Custom options for the client. 1. The |
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 |
Exceptions | |
---|---|
Type | Description |
google.auth.exceptions.MutualTLSChannelError |
If mutual TLS transport creation failed for any reason. |
__exit__
__exit__(type, value, traceback)
Releases underlying transport's resources.
agent_path
agent_path(project: str) -> str
Returns a fully-qualified agent string.
answer_record_path
answer_record_path(project: str, answer_record: str) -> str
Returns a fully-qualified answer_record string.
batch_create_messages
batch_create_messages(
request: typing.Optional[
typing.Union[
google.cloud.dialogflow_v2beta1.types.conversation.BatchCreateMessagesRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
requests: typing.Optional[
typing.MutableSequence[
google.cloud.dialogflow_v2beta1.types.conversation.CreateMessageRequest
]
] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.dialogflow_v2beta1.types.conversation.BatchCreateMessagesResponse
Batch ingests messages to conversation. Customers can use this RPC to ingest historical messages to conversation.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dialogflow_v2beta1
def sample_batch_create_messages():
# Create a client
client = dialogflow_v2beta1.ConversationsClient()
# Initialize request argument(s)
requests = dialogflow_v2beta1.CreateMessageRequest()
requests.parent = "parent_value"
requests.message.content = "content_value"
request = dialogflow_v2beta1.BatchCreateMessagesRequest(
parent="parent_value",
requests=requests,
)
# Make the request
response = client.batch_create_messages(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Union[google.cloud.dialogflow_v2beta1.types.BatchCreateMessagesRequest, dict]
The request object. The request message for [Conversations.BatchCreateMessagesRequest][]. |
parent |
str
Required. Resource identifier of the conversation to create message. Format: |
requests |
MutableSequence[google.cloud.dialogflow_v2beta1.types.CreateMessageRequest]
Required. A maximum of 300 messages can be created in a batch. [CreateMessageRequest.message.send_time][] is required. All created messages will have identical Message.create_time. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Returns | |
---|---|
Type | Description |
google.cloud.dialogflow_v2beta1.types.BatchCreateMessagesResponse |
The request message for [Conversations.BatchCreateMessagesResponse][]. |
cancel_operation
cancel_operation(
request: typing.Optional[
google.longrunning.operations_pb2.CancelOperationRequest
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> None
Starts asynchronous cancellation on a long-running operation.
The server makes a best effort to cancel the operation, but success
is not guaranteed. If the server doesn't support this method, it returns
google.rpc.Code.UNIMPLEMENTED
.
Parameters | |
---|---|
Name | Description |
request |
The request object. Request message for |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
common_billing_account_path
common_billing_account_path(billing_account: str) -> str
Returns a fully-qualified billing_account string.
common_folder_path
common_folder_path(folder: str) -> str
Returns a fully-qualified folder string.
common_location_path
common_location_path(project: str, location: str) -> str
Returns a fully-qualified location string.
common_organization_path
common_organization_path(organization: str) -> str
Returns a fully-qualified organization string.
common_project_path
common_project_path(project: str) -> str
Returns a fully-qualified project string.
complete_conversation
complete_conversation(
request: typing.Optional[
typing.Union[
google.cloud.dialogflow_v2beta1.types.conversation.CompleteConversationRequest,
dict,
]
] = None,
*,
name: typing.Optional[str] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.dialogflow_v2beta1.types.conversation.Conversation
Completes the specified conversation. Finished conversations are purged from the database after 30 days.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dialogflow_v2beta1
def sample_complete_conversation():
# Create a client
client = dialogflow_v2beta1.ConversationsClient()
# Initialize request argument(s)
request = dialogflow_v2beta1.CompleteConversationRequest(
name="name_value",
)
# Make the request
response = client.complete_conversation(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Union[google.cloud.dialogflow_v2beta1.types.CompleteConversationRequest, dict]
The request object. The request message for Conversations.CompleteConversation. |
name |
str
Required. Resource identifier of the conversation to close. Format: |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Returns | |
---|---|
Type | Description |
google.cloud.dialogflow_v2beta1.types.Conversation |
Represents a conversation. A conversation is an interaction between an agent, including live agents and Dialogflow agents, and a support customer. Conversations can include phone calls and text-based chat sessions. |
conversation_model_path
conversation_model_path(
project: str, location: str, conversation_model: str
) -> str
Returns a fully-qualified conversation_model string.
conversation_path
conversation_path(project: str, conversation: str) -> str
Returns a fully-qualified conversation string.
conversation_profile_path
conversation_profile_path(project: str, conversation_profile: str) -> str
Returns a fully-qualified conversation_profile string.
create_conversation
create_conversation(
request: typing.Optional[
typing.Union[
google.cloud.dialogflow_v2beta1.types.conversation.CreateConversationRequest,
dict,
]
] = None,
*,
parent: typing.Optional[str] = None,
conversation: typing.Optional[
google.cloud.dialogflow_v2beta1.types.conversation.Conversation
] = None,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.dialogflow_v2beta1.types.conversation.Conversation
Creates a new conversation. Conversations are auto-completed after 24 hours.
Conversation Lifecycle: There are two stages during a conversation: Automated Agent Stage and Assist Stage.
For Automated Agent Stage, there will be a dialogflow agent responding to user queries.
For Assist Stage, there's no dialogflow agent responding to user queries. But we will provide suggestions which are generated from conversation.
If
xref_Conversation.conversation_profile
is configured for a dialogflow agent, conversation will start
from Automated Agent Stage
, otherwise, it will start from
Assist Stage
. And during Automated Agent Stage
, once an
xref_Intent with
xref_Intent.live_agent_handoff
is triggered, conversation will transfer to Assist Stage.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dialogflow_v2beta1
def sample_create_conversation():
# Create a client
client = dialogflow_v2beta1.ConversationsClient()
# Initialize request argument(s)
conversation = dialogflow_v2beta1.Conversation()
conversation.conversation_profile = "conversation_profile_value"
request = dialogflow_v2beta1.CreateConversationRequest(
parent="parent_value",
conversation=conversation,
)
# Make the request
response = client.create_conversation(request=request)
# Handle the response
print(response)
Parameters | |
---|---|
Name | Description |
request |
Union[google.cloud.dialogflow_v2beta1.types.CreateConversationRequest, dict]
The request object. The request message for Conversations.CreateConversation. |
parent |
str
Required. Resource identifier of the project creating the conversation. Format: |
conversation |
google.cloud.dialogflow_v2beta1.types.Conversation
Required. The conversation to create. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Returns | |
---|---|
Type | Description |
google.cloud.dialogflow_v2beta1.types.Conversation |
Represents a conversation. A conversation is an interaction between an agent, including live agents and Dialogflow agents, and a support customer. Conversations can include phone calls and text-based chat sessions. |
cx_security_settings_path
cx_security_settings_path(
project: str, location: str, security_settings: str
) -> str
Returns a fully-qualified cx_security_settings string.