Constructor
new AgentsClient(optionsopt)
Construct an instance of AgentsClient.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
The configuration object. See the subsequent parameters for more details. Properties
|
Members
(static) apiEndpoint
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
(static) port
The port for this API service.
(static) scopes
The scopes needed to make gRPC calls for every method defined in this service.
(static) servicePath
The DNS address for this API service.
Methods
agentPath(project) → {string}
Return a fully-qualified agent resource name string.
Parameters:
| Name | Type | Description |
|---|---|---|
project |
string |
(async) checkExportAgentProgress(name) → {Promise}
Check the status of the long running operation returned by the exportAgent() method.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String |
The operation name that will be passed. |
(async) checkImportAgentProgress(name) → {Promise}
Check the status of the long running operation returned by the importAgent() method.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String |
The operation name that will be passed. |
(async) checkRestoreAgentProgress(name) → {Promise}
Check the status of the long running operation returned by the restoreAgent() method.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String |
The operation name that will be passed. |
(async) checkTrainAgentProgress(name) → {Promise}
Check the status of the long running operation returned by the trainAgent() method.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String |
The operation name that will be passed. |
close()
Terminate the GRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
deleteAgent(request, optionsopt) → {Promise}
Deletes the specified agent.
Parameters:
| Name | Type | Attributes | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
entityTypePath(project, entity_type) → {string}
Return a fully-qualified entityType resource name string.
Parameters:
| Name | Type | Description |
|---|---|---|
project |
string | |
entity_type |
string |
environmentPath(project, environment) → {string}
Return a fully-qualified environment resource name string.
Parameters:
| Name | Type | Description |
|---|---|---|
project |
string | |
environment |
string |
exportAgent(request, optionsopt) → {Promise}
Exports the specified agent to a ZIP file.
Operation <response: ExportAgentResponse>
Parameters:
| Name | Type | Attributes | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
getAgent(request, optionsopt) → {Promise}
Retrieves the specified agent.
Parameters:
| Name | Type | Attributes | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
getProjectId(callback)
Return the project ID used by this class.
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function |
the callback to be called with the current project Id. |
getValidationResult(request, optionsopt) → {Promise}
Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
importAgent(request, optionsopt) → {Promise}
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. After the import, the imported draft agent will be trained automatically (unless disabled in agent settings). However, once the import is done, training may not be completed yet. Please call TrainAgent and wait for the operation it returns in order to train explicitly.
Operation <response: google.protobuf.Empty> An operation which tracks when importing is complete. It only tracks when the draft agent is updated not when it is done training.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
initialize() → {Promise}
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
intentPath(project, intent) → {string}
Return a fully-qualified intent resource name string.
Parameters:
| Name | Type | Description |
|---|---|---|
project |
string | |
intent |
string |
matchContextFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName) → {string}
Parse the context from ProjectAgentEnvironmentUserSessionContext resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentEnvironmentUserSessionContextName |
string |
A fully-qualified path representing project_agent_environment_user_session_context resource. |
matchContextFromProjectAgentSessionContextName(projectAgentSessionContextName) → {string}
Parse the context from ProjectAgentSessionContext resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentSessionContextName |
string |
A fully-qualified path representing project_agent_session_context resource. |
matchEntityTypeFromEntityTypeName(entityTypeName) → {string}
Parse the entity_type from EntityType resource.
Parameters:
| Name | Type | Description |
|---|---|---|
entityTypeName |
string |
A fully-qualified path representing EntityType resource. |
matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName) → {string}
Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentEnvironmentUserSessionEntityTypeName |
string |
A fully-qualified path representing project_agent_environment_user_session_entity_type resource. |
matchEntityTypeFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName) → {string}
Parse the entity_type from ProjectAgentSessionEntityType resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentSessionEntityTypeName |
string |
A fully-qualified path representing project_agent_session_entity_type resource. |
matchEnvironmentFromEnvironmentName(environmentName) → {string}
Parse the environment from Environment resource.
Parameters:
| Name | Type | Description |
|---|---|---|
environmentName |
string |
A fully-qualified path representing Environment resource. |
matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName) → {string}
Parse the environment from ProjectAgentEnvironmentUserSessionContext resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentEnvironmentUserSessionContextName |
string |
A fully-qualified path representing project_agent_environment_user_session_context resource. |
matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName) → {string}
Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentEnvironmentUserSessionEntityTypeName |
string |
A fully-qualified path representing project_agent_environment_user_session_entity_type resource. |
matchIntentFromIntentName(intentName) → {string}
Parse the intent from Intent resource.
Parameters:
| Name | Type | Description |
|---|---|---|
intentName |
string |
A fully-qualified path representing Intent resource. |
matchProjectFromAgentName(agentName) → {string}
Parse the project from Agent resource.
Parameters:
| Name | Type | Description |
|---|---|---|
agentName |
string |
A fully-qualified path representing Agent resource. |
matchProjectFromEntityTypeName(entityTypeName) → {string}
Parse the project from EntityType resource.
Parameters:
| Name | Type | Description |
|---|---|---|
entityTypeName |
string |
A fully-qualified path representing EntityType resource. |
matchProjectFromEnvironmentName(environmentName) → {string}
Parse the project from Environment resource.
Parameters:
| Name | Type | Description |
|---|---|---|
environmentName |
string |
A fully-qualified path representing Environment resource. |
matchProjectFromIntentName(intentName) → {string}
Parse the project from Intent resource.
Parameters:
| Name | Type | Description |
|---|---|---|
intentName |
string |
A fully-qualified path representing Intent resource. |
matchProjectFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName) → {string}
Parse the project from ProjectAgentEnvironmentUserSessionContext resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentEnvironmentUserSessionContextName |
string |
A fully-qualified path representing project_agent_environment_user_session_context resource. |
matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName) → {string}
Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentEnvironmentUserSessionEntityTypeName |
string |
A fully-qualified path representing project_agent_environment_user_session_entity_type resource. |
matchProjectFromProjectAgentSessionContextName(projectAgentSessionContextName) → {string}
Parse the project from ProjectAgentSessionContext resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentSessionContextName |
string |
A fully-qualified path representing project_agent_session_context resource. |
matchProjectFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName) → {string}
Parse the project from ProjectAgentSessionEntityType resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentSessionEntityTypeName |
string |
A fully-qualified path representing project_agent_session_entity_type resource. |
matchProjectFromProjectName(projectName) → {string}
Parse the project from Project resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectName |
string |
A fully-qualified path representing Project resource. |
matchSessionFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName) → {string}
Parse the session from ProjectAgentEnvironmentUserSessionContext resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentEnvironmentUserSessionContextName |
string |
A fully-qualified path representing project_agent_environment_user_session_context resource. |
matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName) → {string}
Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentEnvironmentUserSessionEntityTypeName |
string |
A fully-qualified path representing project_agent_environment_user_session_entity_type resource. |
matchSessionFromProjectAgentSessionContextName(projectAgentSessionContextName) → {string}
Parse the session from ProjectAgentSessionContext resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentSessionContextName |
string |
A fully-qualified path representing project_agent_session_context resource. |
matchSessionFromProjectAgentSessionEntityTypeName(projectAgentSessionEntityTypeName) → {string}
Parse the session from ProjectAgentSessionEntityType resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentSessionEntityTypeName |
string |
A fully-qualified path representing project_agent_session_entity_type resource. |
matchUserFromProjectAgentEnvironmentUserSessionContextName(projectAgentEnvironmentUserSessionContextName) → {string}
Parse the user from ProjectAgentEnvironmentUserSessionContext resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentEnvironmentUserSessionContextName |
string |
A fully-qualified path representing project_agent_environment_user_session_context resource. |
matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName(projectAgentEnvironmentUserSessionEntityTypeName) → {string}
Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource.
Parameters:
| Name | Type | Description |
|---|---|---|
projectAgentEnvironmentUserSessionEntityTypeName |
string |
A fully-qualified path representing project_agent_environment_user_session_entity_type resource. |
projectAgentEnvironmentUserSessionContextPath(project, environment, user, session, context) → {string}
Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string.
Parameters:
| Name | Type | Description |
|---|---|---|
project |
string | |
environment |
string | |
user |
string | |
session |
string | |
context |
string |
projectAgentEnvironmentUserSessionEntityTypePath(project, environment, user, session, entity_type) → {string}
Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string.
Parameters:
| Name | Type | Description |
|---|---|---|
project |
string | |
environment |
string | |
user |
string | |
session |
string | |
entity_type |
string |
projectAgentSessionContextPath(project, session, context) → {string}
Return a fully-qualified projectAgentSessionContext resource name string.
Parameters:
| Name | Type | Description |
|---|---|---|
project |
string | |
session |
string | |
context |
string |
projectAgentSessionEntityTypePath(project, session, entity_type) → {string}
Return a fully-qualified projectAgentSessionEntityType resource name string.
Parameters:
| Name | Type | Description |
|---|---|---|
project |
string | |
session |
string | |
entity_type |
string |
projectPath(project) → {string}
Return a fully-qualified project resource name string.
Parameters:
| Name | Type | Description |
|---|---|---|
project |
string |
restoreAgent(request, optionsopt) → {Promise}
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. After the restore, the restored draft agent will be trained automatically (unless disabled in agent settings). However, once the restore is done, training may not be completed yet. Please call TrainAgent and wait for the operation it returns in order to train explicitly.
Operation <response: google.protobuf.Empty> An operation which tracks when restoring is complete. It only tracks when the draft agent is updated not when it is done training.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
searchAgents(request, optionsopt) → {Promise}
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.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
searchAgentsAsync(request, optionsopt) → {Object}
Equivalent to searchAgents, but returns an iterable object.
for-await-of syntax is used with the iterable to recursively get response element on-demand.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
searchAgentsStream(request, optionsopt) → {Stream}
Equivalent to searchAgents, but returns a NodeJS Stream object.
This fetches the paged responses for searchAgents continuously and invokes the callback registered for 'data' event for each element in the responses.
The returned object has 'end' method when no more elements are required.
autoPaginate option will be ignored.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
setAgent(request, optionsopt) → {Promise}
Creates/updates the specified agent.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
trainAgent(request, optionsopt) → {Promise}
Trains the specified agent.
Operation <response: google.protobuf.Empty>
Parameters:
| Name | Type | Attributes | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |