Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AssistantV2

The IBM Watson™ Assistant service combines machine learning, natural language understanding, and an integrated dialog editor to create conversation flows between your apps and your users. interfaces

The Assistant v2 API provides runtime methods your client application can use to send user input to an assistant and receive a response.

API Version: 2.0 See: https://cloud.ibm.com/docs/assistant

Hierarchy

  • BaseService
    • AssistantV2

Index

Constructors

constructor

  • Construct a AssistantV2 object.

    Parameters

    Name Type Attribute Description
    options UserOptions

    Options for the service.

    Returns AssistantV2

Properties

version

version: string

Release date of the API version you want to use. Specify dates in YYYY-MM-DD format. The current version is 2021-06-14.

Static DEFAULT_SERVICE_NAME

DEFAULT_SERVICE_NAME: string = "conversation"

Static DEFAULT_SERVICE_URL

DEFAULT_SERVICE_URL: string = "https://api.us-south.assistant.watson.cloud.ibm.com"

Methods

bulkClassify

  • Identify intents and entities in multiple user utterances.

    Send multiple user inputs to a dialog skill in a single request and receive information about the intents and entities recognized in each input. This method is useful for testing and comparing the performance of different skills or skill versions.

    This method is available only with Enterprise with Data Isolation plans.

    Parameters

    Name Type Attribute Description
    params BulkClassifyParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    skillId string Unique identifier of the skill. To find the skill ID in the Watson Assistant user interface, open the skill settings and click **API Details**.
    headers OutgoingHttpHeaders Optional
    input BulkClassifyUtterance[] Optional An array of input utterances to classify.

    Returns Promise<Response<BulkClassifyResponse>>

createSession

  • Create a session.

    Create a new session. A session is used to send user input to a skill and receive responses. It also maintains the state of the conversation. A session persists until it is deleted, or until it times out because of inactivity. (For more information, see the documentation.

    Parameters

    Name Type Attribute Description
    params CreateSessionParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    assistantId string Unique identifier of the assistant. To find the assistant ID in the Watson Assistant user interface, open the assistant settings and click **API Details**. For information about creating assistants, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task).
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<SessionResponse>>

deleteSession

  • Delete session.

    Deletes a session explicitly before it times out. (For more information about the session inactivity timeout, see the documentation).

    Parameters

    Name Type Attribute Description
    params DeleteSessionParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    assistantId string Unique identifier of the assistant. To find the assistant ID in the Watson Assistant user interface, open the assistant settings and click **API Details**. For information about creating assistants, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task).
    sessionId string Unique identifier of the session.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Empty>>

deleteUserData

  • Delete labeled data.

    Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID.

    You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes data. For more information about personal data and customer IDs, see Information security.

    Note: This operation is intended only for deleting data associated with a single specific customer, not for deleting data associated with multiple customers or for any other purpose. For more information, see Labeling and deleting data in Watson Assistant.

    Parameters

    Name Type Attribute Description
    params DeleteUserDataParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    customerId string The customer ID for which all data is to be deleted.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Empty>>

disableRetries

  • disableRetries(): void
  • Disables retries.

    Returns void

enableRetries

  • enableRetries(retryOptions?: RetryOptions): void
  • Enable retries for unfulfilled requests.

    Parameters

    Name Type Attribute Description
    retryOptions RetryOptions Optional

    configuration for retries

    Returns void

getAuthenticator

  • getAuthenticator(): any
  • Get the instance of the authenticator set on the service.

    Returns any

getHttpClient

  • getHttpClient(): AxiosInstance
  • Get the Axios instance set on the service. All requests will be made using this instance.

    Returns AxiosInstance

listLogs

  • List log events for an assistant.

    List the events from the log of an assistant.

    This method requires Manager access, and is available only with Enterprise plans.

    Parameters

    Name Type Attribute Description
    params ListLogsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    assistantId string Unique identifier of the assistant. To find the assistant ID in the Watson Assistant user interface, open the assistant settings and click **API Details**. For information about creating assistants, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task).
    cursor string Optional A token identifying the page of results to retrieve.
    filter string Optional A cacheable parameter that limits the results to those matching the specified filter. For more information, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-filter-reference#filter-reference).
    headers OutgoingHttpHeaders Optional
    pageLimit number Optional The number of records to return in each page of results.
    sort string Optional How to sort the returned log events. You can sort by **request_timestamp**. To reverse the sort order, prefix the parameter value with a minus sign (`-`).

    Returns Promise<Response<LogCollection>>

message

  • Send user input to assistant (stateful).

    Send user input to an assistant and receive a response, with conversation state (including context data) stored by Watson Assistant for the duration of the session.

    Parameters

    Name Type Attribute Description
    params MessageParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    assistantId string Unique identifier of the assistant. To find the assistant ID in the Watson Assistant user interface, open the assistant settings and click **API Details**. For information about creating assistants, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task).
    sessionId string Unique identifier of the session.
    context MessageContext Optional Context data for the conversation. You can use this property to set or modify context variables, which can also be accessed by dialog nodes. The context is stored by the assistant on a per-session basis.
    headers OutgoingHttpHeaders Optional
    input MessageInput Optional An input object that includes the input text.
    userId string Optional A string value that identifies the user who is interacting with the assistant. The client must provide a unique identifier for each individual end user who accesses the application. For user-based plans, this user ID is used to identify unique users for billing purposes. This string cannot contain carriage return, newline, or tab characters. If no value is specified in the input, **user_id** is automatically set to the value of **context.global.session_id**.

    Returns Promise<Response<MessageResponse>>

messageStateless

  • Send user input to assistant (stateless).

    Send user input to an assistant and receive a response, with conversation state (including context data) managed by your application.

    Parameters

    Name Type Attribute Description
    params MessageStatelessParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    assistantId string Unique identifier of the assistant. To find the assistant ID in the Watson Assistant user interface, open the assistant settings and click **API Details**. For information about creating assistants, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task).
    context MessageContextStateless Optional Context data for the conversation. You can use this property to set or modify context variables, which can also be accessed by dialog nodes. The context is not stored by the assistant. To maintain session state, include the context from the previous response.
    headers OutgoingHttpHeaders Optional
    input MessageInputStateless Optional An input object that includes the input text.
    userId string Optional A string value that identifies the user who is interacting with the assistant. The client must provide a unique identifier for each individual end user who accesses the application. For user-based plans, this user ID is used to identify unique users for billing purposes. This string cannot contain carriage return, newline, or tab characters. If no value is specified in the input, **user_id** is automatically set to the value of **context.global.session_id**.

    Returns Promise<Response<MessageResponseStateless>>

setEnableGzipCompression

  • setEnableGzipCompression(setting: boolean): void
  • Turn request body compression on or off.

    Parameters

    Name Type Attribute Description
    setting boolean

    Will turn it on if 'true', off if 'false'.

    Returns void

setServiceUrl

  • setServiceUrl(url: string): void
  • Set the service URL to send requests to.

    Parameters

    Name Type Attribute Description
    url string

    The base URL for the service.

    Returns void

Generated using TypeDoc