Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@
TelephonyDtmfEvents,
VoiceSelectionParams,
)
from google.cloud.dialogflow_v2.types.ces_app import CesAppSpec
from google.cloud.dialogflow_v2.types.ces_tool import CesToolSpec
from google.cloud.dialogflow_v2.types.context import (
Context,
CreateContextRequest,
Expand Down Expand Up @@ -186,6 +188,7 @@
ListMessagesRequest,
ListMessagesResponse,
SearchKnowledgeAnswer,
SearchKnowledgeDebugInfo,
SearchKnowledgeRequest,
SearchKnowledgeResponse,
SuggestConversationSummaryRequest,
Expand Down Expand Up @@ -382,20 +385,24 @@
AudioInput,
AutomatedAgentReply,
CreateParticipantRequest,
DatastoreResponseReason,
DialogflowAssistAnswer,
DtmfParameters,
FaqAnswer,
GenerateSuggestionsResponse,
GetParticipantRequest,
IngestedContextReferenceDebugInfo,
InputTextConfig,
IntentSuggestion,
KnowledgeAssistAnswer,
KnowledgeAssistDebugInfo,
ListParticipantsRequest,
ListParticipantsResponse,
Message,
MessageAnnotation,
OutputAudio,
Participant,
ServiceLatency,
SmartReplyAnswer,
StreamingAnalyzeContentRequest,
StreamingAnalyzeContentResponse,
Expand Down Expand Up @@ -456,6 +463,7 @@
UpdateToolRequest,
)
from google.cloud.dialogflow_v2.types.tool_call import ToolCall, ToolCallResult
from google.cloud.dialogflow_v2.types.toolset import ToolsetTool
from google.cloud.dialogflow_v2.types.validation_result import (
ValidationError,
ValidationResult,
Expand Down Expand Up @@ -554,6 +562,8 @@
"SpeechModelVariant",
"SsmlVoiceGender",
"TelephonyDtmf",
"CesAppSpec",
"CesToolSpec",
"Context",
"CreateContextRequest",
"DeleteAllContextsRequest",
Expand All @@ -579,6 +589,7 @@
"ListMessagesRequest",
"ListMessagesResponse",
"SearchKnowledgeAnswer",
"SearchKnowledgeDebugInfo",
"SearchKnowledgeRequest",
"SearchKnowledgeResponse",
"SuggestConversationSummaryRequest",
Expand Down Expand Up @@ -751,15 +762,18 @@
"FaqAnswer",
"GenerateSuggestionsResponse",
"GetParticipantRequest",
"IngestedContextReferenceDebugInfo",
"InputTextConfig",
"IntentSuggestion",
"KnowledgeAssistAnswer",
"KnowledgeAssistDebugInfo",
"ListParticipantsRequest",
"ListParticipantsResponse",
"Message",
"MessageAnnotation",
"OutputAudio",
"Participant",
"ServiceLatency",
"SmartReplyAnswer",
"StreamingAnalyzeContentRequest",
"StreamingAnalyzeContentResponse",
Expand All @@ -774,6 +788,7 @@
"SuggestSmartRepliesRequest",
"SuggestSmartRepliesResponse",
"UpdateParticipantRequest",
"DatastoreResponseReason",
"CloudConversationDebuggingInfo",
"DetectIntentRequest",
"DetectIntentResponse",
Expand Down Expand Up @@ -812,6 +827,7 @@
"UpdateToolRequest",
"ToolCall",
"ToolCallResult",
"ToolsetTool",
"ValidationError",
"ValidationResult",
"CreateVersionRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import sys

import google.api_core as api_core

from google.cloud.dialogflow_v2 import gapic_version as package_version

__version__ = package_version.__version__
Expand Down Expand Up @@ -109,6 +108,8 @@
TelephonyDtmfEvents,
VoiceSelectionParams,
)
from .types.ces_app import CesAppSpec
from .types.ces_tool import CesToolSpec
from .types.context import (
Context,
CreateContextRequest,
Expand Down Expand Up @@ -137,6 +138,7 @@
ListMessagesRequest,
ListMessagesResponse,
SearchKnowledgeAnswer,
SearchKnowledgeDebugInfo,
SearchKnowledgeRequest,
SearchKnowledgeResponse,
SuggestConversationSummaryRequest,
Expand Down Expand Up @@ -329,20 +331,24 @@
AudioInput,
AutomatedAgentReply,
CreateParticipantRequest,
DatastoreResponseReason,
DialogflowAssistAnswer,
DtmfParameters,
FaqAnswer,
GenerateSuggestionsResponse,
GetParticipantRequest,
IngestedContextReferenceDebugInfo,
InputTextConfig,
IntentSuggestion,
KnowledgeAssistAnswer,
KnowledgeAssistDebugInfo,
ListParticipantsRequest,
ListParticipantsResponse,
Message,
MessageAnnotation,
OutputAudio,
Participant,
ServiceLatency,
SmartReplyAnswer,
StreamingAnalyzeContentRequest,
StreamingAnalyzeContentResponse,
Expand Down Expand Up @@ -403,6 +409,7 @@
UpdateToolRequest,
)
from .types.tool_call import ToolCall, ToolCallResult
from .types.toolset import ToolsetTool
from .types.validation_result import ValidationError, ValidationResult
from .types.version import (
CreateVersionRequest,
Expand Down Expand Up @@ -561,6 +568,8 @@ def _get_version(dependency_name):
"BatchUpdateEntityTypesResponse",
"BatchUpdateIntentsRequest",
"BatchUpdateIntentsResponse",
"CesAppSpec",
"CesToolSpec",
"ClearSuggestionFeatureConfigOperationMetadata",
"ClearSuggestionFeatureConfigRequest",
"CloudConversationDebuggingInfo",
Expand Down Expand Up @@ -603,6 +612,7 @@ def _get_version(dependency_name):
"CreateToolRequest",
"CreateVersionRequest",
"CustomPronunciationParams",
"DatastoreResponseReason",
"DeleteAgentRequest",
"DeleteAllContextsRequest",
"DeleteContextRequest",
Expand Down Expand Up @@ -702,6 +712,7 @@ def _get_version(dependency_name):
"InferenceParameter",
"IngestContextReferencesRequest",
"IngestContextReferencesResponse",
"IngestedContextReferenceDebugInfo",
"InitializeEncryptionSpecMetadata",
"InitializeEncryptionSpecRequest",
"InitializeEncryptionSpecResponse",
Expand All @@ -715,6 +726,7 @@ def _get_version(dependency_name):
"IntentView",
"IntentsClient",
"KnowledgeAssistAnswer",
"KnowledgeAssistDebugInfo",
"KnowledgeBase",
"KnowledgeBasesClient",
"KnowledgeOperationMetadata",
Expand Down Expand Up @@ -778,11 +790,13 @@ def _get_version(dependency_name):
"SearchAgentsRequest",
"SearchAgentsResponse",
"SearchKnowledgeAnswer",
"SearchKnowledgeDebugInfo",
"SearchKnowledgeRequest",
"SearchKnowledgeResponse",
"Sentiment",
"SentimentAnalysisRequestConfig",
"SentimentAnalysisResult",
"ServiceLatency",
"SessionEntityType",
"SessionEntityTypesClient",
"SessionsClient",
Expand Down Expand Up @@ -832,6 +846,7 @@ def _get_version(dependency_name):
"ToolCall",
"ToolCallResult",
"ToolsClient",
"ToolsetTool",
"TrainAgentRequest",
"TriggerEvent",
"UndeployConversationModelOperationMetadata",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@
from google.api_core import retry_async as retries
from google.api_core.client_options import ClientOptions
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

from google.cloud.dialogflow_v2 import gapic_version as package_version
from google.oauth2 import service_account # type: ignore
Comment on lines 38 to +39
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change, and similar changes in other files, disrupt the standard Python import order defined in PEP 8. PEP 8 recommends grouping imports into standard library, third-party, and local application sections, separated by blank lines. The previous code correctly separated the third-party google.oauth2 import from the local google.cloud.dialogflow_v2 import. The new ordering mixes them and removes the separating blank line, which can harm readability and maintainability. It's recommended to revert to the standard import grouping across the project.

For example, the order should be:

from google.oauth2 import service_account  # type: ignore

from google.cloud.dialogflow_v2 import gapic_version as package_version
Suggested change
from google.cloud.dialogflow_v2 import gapic_version as package_version
from google.oauth2 import service_account # type: ignore
from google.oauth2 import service_account # type: ignore
from google.cloud.dialogflow_v2 import gapic_version as package_version
References
  1. PEP 8 recommends grouping imports into standard library, third-party, and local application sections, separated by blank lines. (link)


try:
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
Expand All @@ -48,12 +47,11 @@
import google.api_core.operation_async as operation_async # type: ignore
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
import google.protobuf.struct_pb2 as struct_pb2 # type: ignore
from google.cloud.location import locations_pb2 # type: ignore
from google.longrunning import operations_pb2 # type: ignore

from google.cloud.dialogflow_v2.services.agents import pagers
from google.cloud.dialogflow_v2.types import agent, validation_result
from google.cloud.dialogflow_v2.types import agent as gcd_agent
from google.cloud.location import locations_pb2 # type: ignore
from google.longrunning import operations_pb2 # type: ignore

from .client import AgentsClient
from .transports.base import DEFAULT_CLIENT_INFO, AgentsTransport
Expand Down Expand Up @@ -83,18 +81,18 @@ class AgentsAsyncClient:

agent_path = staticmethod(AgentsClient.agent_path)
parse_agent_path = staticmethod(AgentsClient.parse_agent_path)
common_billing_account_path = staticmethod(AgentsClient.common_billing_account_path)
parse_common_billing_account_path = staticmethod(
AgentsClient.parse_common_billing_account_path
)
common_folder_path = staticmethod(AgentsClient.common_folder_path)
parse_common_folder_path = staticmethod(AgentsClient.parse_common_folder_path)
common_project_path = staticmethod(AgentsClient.common_project_path)
parse_common_project_path = staticmethod(AgentsClient.parse_common_project_path)
common_organization_path = staticmethod(AgentsClient.common_organization_path)
parse_common_organization_path = staticmethod(
AgentsClient.parse_common_organization_path
)
common_project_path = staticmethod(AgentsClient.common_project_path)
parse_common_project_path = staticmethod(AgentsClient.parse_common_project_path)
common_folder_path = staticmethod(AgentsClient.common_folder_path)
parse_common_folder_path = staticmethod(AgentsClient.parse_common_folder_path)
common_billing_account_path = staticmethod(AgentsClient.common_billing_account_path)
parse_common_billing_account_path = staticmethod(
AgentsClient.parse_common_billing_account_path
)
common_location_path = staticmethod(AgentsClient.common_location_path)
parse_common_location_path = staticmethod(AgentsClient.parse_common_location_path)

Expand Down Expand Up @@ -788,10 +786,10 @@ async def train_agent(
The returned ``Operation`` type has the following
method-specific fields:

- ``metadata``: An empty `Struct
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct>`__
- ``response``: An `Empty
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty>`__
- ``metadata``: An empty `Struct
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct>`__
- ``response``: An `Empty
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty>`__

Note: You should always train an agent prior to sending it
queries. See the `training
Expand All @@ -818,11 +816,11 @@ async def sample_train_agent():
)

# Make the request
operation = client.train_agent(request=request)
operation = await client.train_agent(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down Expand Up @@ -935,10 +933,10 @@ async def export_agent(
The returned ``Operation`` type has the following
method-specific fields:

- ``metadata``: An empty `Struct
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct>`__
- ``response``:
[ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
- ``metadata``: An empty `Struct
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct>`__
- ``response``:
[ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]

.. code-block:: python

Expand All @@ -962,11 +960,11 @@ async def sample_export_agent():
)

# Make the request
operation = client.export_agent(request=request)
operation = await client.export_agent(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down Expand Up @@ -1081,10 +1079,10 @@ async def import_agent(
The returned ``Operation`` type has the following
method-specific fields:

- ``metadata``: An empty `Struct
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct>`__
- ``response``: An `Empty
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty>`__
- ``metadata``: An empty `Struct
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct>`__
- ``response``: An `Empty
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty>`__

The operation only tracks when importing is complete, not when
it is done training.
Expand Down Expand Up @@ -1115,11 +1113,11 @@ async def sample_import_agent():
)

# Make the request
operation = client.import_agent(request=request)
operation = await client.import_agent(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down Expand Up @@ -1216,10 +1214,10 @@ async def restore_agent(
The returned ``Operation`` type has the following
method-specific fields:

- ``metadata``: An empty `Struct
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct>`__
- ``response``: An `Empty
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty>`__
- ``metadata``: An empty `Struct
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct>`__
- ``response``: An `Empty
message <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty>`__

The operation only tracks when restoring is complete, not when
it is done training.
Expand Down Expand Up @@ -1250,11 +1248,11 @@ async def sample_restore_agent():
)

# Make the request
operation = client.restore_agent(request=request)
operation = await client.restore_agent(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Loading